Closed btk999 closed 1 year ago
Did you try other HomeKit apps, like Eve?
If these also don't show the battery state, please attach the debug log file and the debug dump file, so I can have a look what's going on. See FAQ in the Wiki how to obtain these files.
Hi, the Eve App also dont show the battery state... i created a debug log file and the debug dump file, i hope that helps. The devices are named "Thermostat XX" or "fairy lights xx", i never changed that in deconz debug dump log.zip
deCONZ doesn't expose the battery percentage (config/battery
) for the thermostat. It does expose state/lowbattery
, but Homebridge Hue doesn't use that, as HomeKit requires a battery level for the Battery service.. I don't think I've ever before seen a device that exposed state.lowbattery
, but not config/battery
. Originally state/lowbattery
was created for IAS Zone devices; I'm nor sure why they use it for a Tuya device.
I suppose you could fake a battery percentage based on lowbateery
, but this is not specific to HomeKit, and, I think, should be done in deCONZ, rather than in Homebridge Hue. Also, it's much easier to do in a DDF, than changing code in Homerbridge Hue.
Ok, sounds plausible, thanks for your fast reply! I try to create a DDF for this.
Hi @ebaauw, unfortunately it is not possible to solve this by DDF yet, because DDF is not supported for Tuya TRV Devices in deconz yet. In general they also dont want to add a solution like that (emulating / "calculating" config/battery from state/lowbattery). https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6643
But i'd like to find a solution for this problem so i come back to you to ask if you could help me with a quick & dirty solution in homebridge-hue for this. Would it be possible to add a little switch like "emulate config/battery from state/lowbattery if config/battery is not exposed" or could you give me a hint where i could implement this in a fork?
Probably easiest to insert config.battery
in the Hue bridge response when state.lowbattery
is present, but config.battery
is not. Cf. to how lightlevel
is inserted for the Daylight sensor for each heartbeat in:
https://github.com/ebaauw/homebridge-hue/blob/4d0fd6983299b3c6f9d2e66cbcf25d5684edbb04/lib/HueSensor.js#L1933-L1948
and for initial setup in:
https://github.com/ebaauw/homebridge-hue/blob/4d0fd6983299b3c6f9d2e66cbcf25d5684edbb04/lib/HueSensor.js#L1507-L1542
Obviously, for the thermostat, this would need to be in the ZHAThermostat
case.
Issue
i use several Thermostats (TRV TS0601 // TZE200_ckud7u2l) with deconz and they work fine with this plugin but the battery state is not shown in the Home App (and also not in the homebridge config-ui-x UI within the details of the device) even though the lowbattery attribute is true.
Log Messages
lowbattery: true is sent by deconz but device has no battery state attribute:
![image](https://user-images.githubusercontent.com/20415739/210255615-d19a72ed-430b-4d06-b7d1-4abcddcb8762.png)