Arduino-HomeKit-ESP8266 icon indicating copy to clipboard operation
Arduino-HomeKit-ESP8266 copied to clipboard

homekit_accessory_category_faucet

Open gielk opened this issue 2 years ago • 5 comments
trafficstars

Is there anyone on GitHub who has an example or can show the code for building an ESP8266 HomeKit faucet? I was able to make a switch, but I am having trouble understanding how to convert it to a faucet. I did see the 'homekit_accessory_category_faucet' category, but I am not sure how to proceed.

gielk avatar Jan 27 '23 22:01 gielk

You should use the "ACTIVE" characteristic (uint8) instead of "ON" (bool). I improvised a configuration code for a faucet (didn't try it), it may be useful:

#include <homekit/homekit.h> #include <homekit/characteristics.h>

void my_accessory_identify(homekit_value_t _value) { printf("accessory identify\n"); }

// FAUCET // required: ACTIVE // optional: NAME, STATUS_FAULT

// format: uint8; homekit_characteristic_t cha_faucet_active = HOMEKIT_CHARACTERISTIC_(ACTIVE, false);

homekit_accessory_t accessories[] = { HOMEKIT_ACCESSORY(.id=1, .category=homekit_accessory_category_faucet, .services=(homekit_service_t[]) { HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) { HOMEKIT_CHARACTERISTIC(NAME, “Faucet”), HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Arduino 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*[]){ &cha_faucet_active, NULL }), NULL }), NULL };

homekit_server_config_t config = { .accessories = accessories, .password = "111-11-111" };

angel41671 avatar Apr 05 '23 12:04 angel41671

Awesome I am going to try it when I have time.

gielk avatar Apr 05 '23 12:04 gielk

Hey, thanks for inspiring me. I wanted to do something similar and I got this to work with some tinkering.
https://github.com/pjmeijer/FaucetHomeKitESP8266

pjmeijer avatar Jun 23 '23 17:06 pjmeijer

However, looking at this I'm not sure I'm doing it correctly: https://github.com/apple/HomeKitADK/blob/master/HAP/HAPServiceTypes.h Here they are talking about valves associated with with another type.

Looking in Arduino-HomeKit_ESP8266 I find this and that's what I used: #define HOMEKIT_SERVICE_FAUCET HOMEKIT_APPLE_UUID2("D7")

/** Defines that the accessory supports the control of a irrigation system.

Required Characteristics:

  • ACTIVE
  • PROGRAM_MODE
  • IN_USE

Optional Characteristics:

  • NAME
  • REMAINING_DURATION
  • STATUS_FAULT */

pjmeijer avatar Jun 23 '23 18:06 pjmeijer

Hi, It is a whole range of irrigation stuff. This works as the simplest of faucet. I have a 220V valve from Ali that does the work. Archive.zip

Good luck

PimV5755 avatar Jul 07 '23 08:07 PimV5755