Closed royfocker19 closed 4 years ago
Here is my accessory that has swing mode
Hi Maxim, I already tested that, but I wanted to use the specific service for slat to have what is described here:
I want to have the possibility of having the slat closed, fixed or swinging. I don't know if it works that way, but maybe if slat is set to fixed or jammed, you could specify the current tilt angle.
In that case you need to add a Slat service with slat characteristics
I’m doing that, but it doesn’t show up on de accessory. I’ll share my code
Are you still planning to share your code?
Yes sorry, I didn’t have the pc with me till today, I went through a surgery last week. I will share it in a few hours.
HOMEKIT_ACCESSORY(.id=3, .category=homekit_accessory_category_fan, .services=(homekit_service_t*[]){
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "FAN"),
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "YP"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "0012347"),
HOMEKIT_CHARACTERISTIC(MODEL, "FAN"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, light_sensor_identify),
NULL
}),
HOMEKIT_SERVICE(FAN2, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Fan2"),
&fan_active,
&fan_rotation_speed,
&fan_swing_mode,
NULL
}),
HOMEKIT_SERVICE(SLAT, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Slats"),
&slat_type,
¤t_slat_state,
&swing_mode,
NULL
}),
NULL
}),
Can you also provide definitions of all characteristics used in there
homekit_characteristic_t temperature = HOMEKIT_CHARACTERISTIC_(CURRENT_TEMPERATURE, 0);
homekit_characteristic_t humidity = HOMEKIT_CHARACTERISTIC_(CURRENT_RELATIVE_HUMIDITY, 0);
//homekit_characteristic_t target_temperature = HOMEKIT_CHARACTERISTIC_(TARGET_TEMPERATURE, 22, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_temp_update));
//AC Required Parameters
homekit_characteristic_t active = HOMEKIT_CHARACTERISTIC_(ACTIVE, 0,.callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_active_change));
homekit_characteristic_t current_temperature = HOMEKIT_CHARACTERISTIC_(CURRENT_TEMPERATURE, 0);
homekit_characteristic_t current_heater_cooler_state = HOMEKIT_CHARACTERISTIC_(CURRENT_HEATER_COOLER_STATE, 0);
homekit_characteristic_t target_heater_cooler_state = HOMEKIT_CHARACTERISTIC_(TARGET_HEATER_COOLER_STATE, 0, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update));
//optionals
homekit_characteristic_t units = HOMEKIT_CHARACTERISTIC_(TEMPERATURE_DISPLAY_UNITS, 0);
homekit_characteristic_t cooling_threshold = HOMEKIT_CHARACTERISTIC_(COOLING_THRESHOLD_TEMPERATURE, 18,.callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_temp_update),.min_value = (float[]) {17},.max_value = (float[]) {30},.min_step = (float[]) {1} );
homekit_characteristic_t heating_threshold = HOMEKIT_CHARACTERISTIC_(HEATING_THRESHOLD_TEMPERATURE, 22,.callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_temp_update),.min_value = (float[]) {17},.max_value = (float[]) {30},.min_step = (float[]) {1});
homekit_characteristic_t rotation_speed = HOMEKIT_CHARACTERISTIC_(ROTATION_SPEED, 0, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update));
homekit_characteristic_t swing_mode = HOMEKIT_CHARACTERISTIC_(SWING_MODE, 0, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update));
homekit_characteristic_t slat_type = HOMEKIT_CHARACTERISTIC_(SLAT_TYPE, 1, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update));
homekit_characteristic_t current_slat_state = HOMEKIT_CHARACTERISTIC_(CURRENT_SLAT_STATE, 0, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update));
homekit_characteristic_t fan_active = HOMEKIT_CHARACTERISTIC_(ACTIVE, 0, .setter=fan_active_set);
homekit_characteristic_t fan_rotation_speed = HOMEKIT_CHARACTERISTIC_(
ROTATION_SPEED, 0,
.min_step = (float[]) {33.3},
.callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update)
);
homekit_characteristic_t fan_swing_mode = HOMEKIT_CHARACTERISTIC_(
SWING_MODE, 0,
.callback=HOMEKIT_CHARACTERISTIC_CALLBACK(on_update)
);
Are you using the Home app to check this? Not every service is properly displayed in there.
It looks kind of correct, it might be the problem is somewhere else. Also, it would be nice to set primary service for you accessory (e.g. Fan)
Ok, I tried to create simple Fan & Slat accessory and there seemed to be no Slat seen. So I removed fan and left just a Slat. And what I've found is that it paired OK, but in Home.app it showed as generic accessory with message "This accessory is not currently supported by the Home app.".
I guess, at this point we can close this issue. Left me know if you have more questions.
Hello everyone, I was trying to add a SLAT to a Heater_Cooler or a FAN, I should see the swing mode but I can't see it. Does anyone have an example of the utilisation os SLAT service?