Open mriksman opened 2 years ago
Hi
Yes, homekit_setup_mdns() uses name of the first accessory only. It is considered to be "the main" accessory and thus it's category and name is used. This is the case for accessory bridges: the bridge accessory goes first, then all other accessories. Thus, overall the advertised name of the accessory and it's category is derived from accessories[0]. esp-homekit does not support running multiple servers on the same device.
All IDs are automatically assigned if you did not assign them manually. It traverses the accessory-service-characteristic graph in order the are defined and assigns IDs sequentially unless it encounters non-zero ID in which case it will keep it and continue to assign IDs from the next ID. This is done to support controlling IDs in case some accessory/service/characteristic was removed in new firmware, but you want to keep all other accessory/service/characteristic IDs unchanged (and this is the advised way of doing it in HomeKit spec).
Regarding your code, I have found one problem. When you allocate characteristics array with size depending on whether it is dimmer or not, you're off by one: you need an extra element for the NULL pointer at the end. I also would recommend just having array of size 4, it does not hurt and it is less error prone.
Regarding your code, I have found one problem. When you allocate characteristics array with size depending on whether it is dimmer or not, you're off by one: you need an extra element for the NULL pointer at the end. I also would recommend just having array of size 4, it does not hurt and it is less error prone.
Nice catch! I doubt this is what is causing my issue though...? Or maybe it is..?
Can you think of anything that would be causing my accessories that are separated to intermittently go 'No Response'?
When you say "both accessories will go No Response", "both" means configured accessories within one physical device, right? Did you check console logs? Does it crash?
Correct. Single/physical ESP controller, but with the separate_accessories
flag set, so I can place them in different rooms.
I changed it to characteristics[4]
, but the issue remains.
I do not think they are crashing; the status LED flashes for 10 seconds after a reboot, and I haven't noticed this. I will double-check and revert back.
Should I be creating a separate Accessory with category homekit_accessory_category_bridge
? And then add each homekit_accessory_category_lightbulb
as separate accessories after that? It does seem strange that one light has 'Bridge >' in its settings, which links back to the other light.
I want to add some Custom Characteristics to log number of restarts. But; I do not want to add it to all lights, or even just one light. Can you add Custom Characteristics to the 'Bridge' accessory? So something like this;
Accessories
Bridge Accessory
Accessory Information Service
Name Characteristic
Firmware Characteristic
**Custom Characteristic**
Lightbulb Accessory (1)
Accessory Information Service
Name Characteristic
Firmware Characteristic
Lightbulb Service
On Characteristic
Brightness Characteristic
Lightbulb Accessory (2)
Accessory Information Service
Name Characteristic
Firmware Characteristic
Lightbulb Service
On Characteristic
Brightness Characteristic
Normally I add the custom characteristic to the main service (I added some to a HEATER_COOLER
), and it shows up in the Eve App.
Looking at your code, I don't see anything specific to Bridge Accesories. Homebridge and Espressif's HomeKit SDK both set some kind of is_bridge
flag for the first Accessory..
I have added the Custom Characteristic that tracks number of restarts, and last restart reason. After seeing the device go 'No Response' for a few minutes and come back, I checked the Characteristic in Eve, and found that it had not restarted. So something else is happening.
Any other thoughts?
Hi,
When I use the below code to create a device with separate accessories, both will intermittently go 'No Response'. Perhaps something to do with using the same
ACCESSORY_INFORMATION
Service (andNAME
)?Does each Accessory need a different name set in the
ACCESSORY_INFORMATION
Service? It appearshomekit_setup_mdns
only uses the name fromaccessories[0]
?Do I need to specifically set
.id
for each Accessory, or is this handled by thehomekit_accessories_init
function?