maximkulkin / esp-homekit

Apple HomeKit accessory server library for ESP-OPEN-RTOS
MIT License
1.1k stars 168 forks source link

error #155

Closed coffice12 closed 4 years ago

coffice12 commented 4 years ago

code: HOMEKIT_SERVICE(HEATER_COOLER, .primary=true, .characteristics=(homekit_characteristic_t*[]){ HOMEKIT_CHARACTERISTIC(NAME, "HEATER_COOLER"), HOMEKIT_CHARACTERISTIC( COOLING_THRESHOLD_TEMPERATURE, HOMEKIT_CHARACTERISTIC_CURRENT_DOOR_STATE_CLOSED, .getter=NULL, .setter=NULL ),

if config COOLING_THRESHOLD_TEMPERATURE

will not connect esp homekit

beckmx commented 4 years ago

I guess, (I am not sure) but according to the other examples you are declaring two characteristics in 1, have you tried separating them? HOMEKIT_CHARACTERISTIC(HOMEKIT_CHARACTERISTIC_CURRENT_DOOR_STATE_CLOSED, 0), HOMEKIT_CHARACTERISTIC( COOLING_THRESHOLD_TEMPERATURE, .getter=NULL, .setter=NULL ),

coffice12 commented 4 years ago

HOMEKIT_CHARACTERISTIC( COOLING_THRESHOLD_TEMPERATURE, .getter=NULL, .setter=NULL ),

error:

error: expected expression before '.' token .getter=NULL,

maximkulkin commented 4 years ago

@coffice12 What is this supposed to mean?

HOMEKIT_CHARACTERISTIC(
COOLING_THRESHOLD_TEMPERATURE, HOMEKIT_CHARACTERISTIC_CURRENT_DOOR_STATE_CLOSED
);

When you're designing an accessory it makes sense to 1) check HAP specification on a service you might need for a job (go to "Apple-defined Services" chapter); or 2) check your service definition comment inside the esp-homekit to know which characteristics are required; 3) check characteristic definition for formats and value ranges. In your case value HOMEKIT_CHARACTERISTIC_CURRENT_DOOR_STATE_CLOSED ("1") is outside of default allowed range for COOLING_THRESHOLD_TEMPERATURE (10-35).

coffice12 commented 4 years ago

Problem solved,thank you!!