You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the flowing code in order to get faucet status (open / close)
from some reason in HomeKit its appeared as updating
please advise :-)
Thanks in advanced.
void my_homekit_report() {
cha_faucet.value.uint8_value = sensorVal; // read from Input set as int
homekit_characteristic_notify(&cha_faucet, cha_faucet.value);
}
The text was updated successfully, but these errors were encountered:
sensorVal = 0 (inactive) or 1 (active). Other values cannot be used
and replace
homekit_characteristic_t cha_faucet = HOMEKIT_CHARACTERISTIC_(ACTIVE, 0);
hi,
I used the flowing code in order to get faucet status (open / close)
from some reason in HomeKit its appeared as updating
please advise :-)
Thanks in advanced.
my.accessory.c
#include <homekit/homekit.h>
#include <homekit/characteristics.h>
void my_accessory_identify(homekit_value_t _value) {
printf("accessory identify\n");
}
homekit_characteristic_t cha_faucet = HOMEKIT_CHARACTERISTIC_(ACTIVE, false);
homekit_accessory_t accessories[] = {
// Faucet 29
HOMEKIT_ACCESSORY(.id=29, .category=homekit_accessory_category_faucet, .services=(homekit_service_t[]) {
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Water Flow Sensor"),
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "HomeKit"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "0123456"),
HOMEKIT_CHARACTERISTIC(MODEL, "ESP8266/ESP32"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "1.0"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify),
NULL
}),
HOMEKIT_SERVICE(FAUCET, .primary=true, .characteristics=(homekit_characteristic_t*[]) {
//HOMEKIT_CHARACTERISTIC(NAME, "Faucet"),
&cha_faucet,
NULL
}),
NULL
}),
NULL
};
homekit_server_config_t config = {
.accessories = accessories,
.password = "111-11-111"
};
Faucet.ino
extern "C" homekit_server_config_t config;
extern "C" homekit_characteristic_t cha_faucet;
void my_homekit_report() {
cha_faucet.value.uint8_value = sensorVal; // read from Input set as int
homekit_characteristic_notify(&cha_faucet, cha_faucet.value);
}
The text was updated successfully, but these errors were encountered: