Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermostat accessory can't be adde. #31

Open
CMGeorge opened this issue Sep 3, 2018 · 0 comments
Open

Thermostat accessory can't be adde. #31

CMGeorge opened this issue Sep 3, 2018 · 0 comments

Comments

@CMGeorge
Copy link

CMGeorge commented Sep 3, 2018

I tried to set up a Thermostat accessory but it failed.

The debug display the following json fot adding the accessorie:

{"accessories":[{"aid":1,"services":[{"type":"0000004A-0000-1000-8000-0026BB765291","iid":1,"characteristics":[{"type":"0000000F-0000-1000-8000-0026BB765291","iid":2,"perms":["pr","ev"],"format":"uint8","value":0},{"type":"00000033-0000-1000-8000-0026BB765291","iid":3,"p
erms":["pr","pw","ev"],"format":"uint8","value":0},{"type":"00000011-0000-1000-8000-0026BB765291","iid":4,"perms":["pr","ev"],"format":"float","value":0},{"type":"00000035-0000-1000-8000-0026BB765291","iid":5,"perms":["pr","pw","ev"],"format":"float","value":15},{"type":
"00000036-0000-1000-8000-0026BB765291","iid":6,"perms":["pr","pw","ev"],"format":"uint8","value":0},{"type":"00000010-0000-1000-8000-0026BB765291","iid":7,"perms":["pr","ev"],"format":"float","value":50},{"type":"00000034-0000-1000-8000-0026BB765291","iid":8,"perms":["pr
","pw","ev"],"format":"float","value":50},{"type":"00000023-0000-1000-8000-0026BB765291","iid":9,"perms":["pr"],"format":"string","value":"New Thermostat"}]}]}]}

As code example I use:
on HAP preparation:
a = hap_accessory_register((char*)BRIDGE_NAME,
accessory_id,
(char*)"053-58-197",
(char*)MANUFACTURER_NAME,
// HAP_ACCESSORY_CATEGORY_SWITCH,
HAP_ACCESSORY_CATEGORY_BRIDGE,
811,
1,
NULL,
&callback);

On callback

void* accessory_object = hap_accessory_add(hap_support_bridge);

struct hap_characteristic thermostat[] = {
{HAP_CHARACTER_CURRENT_HEATING_COOLING_STATE,
(void*)thermostat_support_current_heating_cooling_state,
NULL,
thermostat_support_current_heating_cooling_state_read,
NULL,
thermostat_support_current_heating_cooling_state_notify
},
{HAP_CHARACTER_TARGET_HEATING_COOLING_STATE,
(void*)thermostat_support_target_heating_cooling_state,
NULL,
thermostat_support_target_heating_cooling_state_read,
thermostat_support_target_heating_cooling_state_write,
thermostat_support_target_heating_cooling_state_notify
},
{HAP_CHARACTER_CURRENT_TEMPERATURE,
(void*)thermostat_support_current_temperature,
NULL,
thermostat_support_current_temperature_read,
NULL,
thermostat_support_current_temperature_notify
},
{HAP_CHARACTER_TARGET_TEMPERATURE,
(void*)thermostat_support_target_temperature,
NULL,
thermostat_support_target_temperature_read,
NULL,
thermostat_support_target_temperature_notify
},
{HAP_CHARACTER_TEMPERATURE_DISPLAY_UNITS,
(void*)thermostat_support_temperature_display_unit,
NULL,
thermostat_support_temperature_display_unit_read,
thermostat_support_temperature_display_unit_write,
thermostat_support_temperature_display_unit_notify
},
// {HAP_CHARACTER_COOLING_THRESHOLD_TEMPERATURE,
// NULL ,
// NULL,
// NULL,
// NULL,
// NULL
// },
{HAP_CHARACTER_CURRENT_RELATIVE_HUMIDITY,
(void*)5000 ,
NULL,
NULL,
NULL,
NULL
},
// {HAP_CHARACTER_HEATING_THRESHOLD_TEMPERATURE,
// NULL ,
// NULL,
// NULL,
// NULL,
// NULL
// },
{HAP_CHARACTER_TARGET_RELATIVE_HUMIDITY,
(void*)5000 ,
NULL,
NULL,
NULL,
NULL
},

		//			{HAP_CHARACTER_ON, (void*)led2, NULL, led_read2, led_write2, led_notify2},
		{HAP_CHARACTER_NAME,
				(void*)ACCESSORY_THERMOSTAT_NAME ,
				NULL,
				NULL,
				NULL,
				NULL
		},

};
hap_service_and_characteristics_add(a,
		accessory_object,
		HAP_SERVICE_THERMOSTAT,
		thermostat,
		ARRAY_SIZE(thermostat));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant