Smanar / Domoticz-deCONZ

deCONZ plugin for Domoticz (Zigbee application)
GNU General Public License v3.0
36 stars 27 forks source link

Adding battery level widget by device #145

Open BabaIsYou opened 1 year ago

BabaIsYou commented 1 year ago

Hi Smanar,

What do you thing about reusing some parts of this Domoticz plugin Battery level for Z-Wave to have the same option for Zigbee devices ?

As you already parse the whole zigbee devices could it be "easy" to create a battery level widget per Deconz device, (and not one per sensor of course if they share the same battery attribute) ?

Could be a nice integrated and optionnal (by configuration options) feature that could help to get notification per custom battery level and not for the same treshold for whole Domoticz.

Smanar commented 1 year ago

You mean a special device like the one for alarm system ? An alert widget to display battery error message ? Because I m not sure 1 more widget for all devices will be a good idea, it mean lot of widget for something already usable in domoticz on actual one ?

BabaIsYou commented 1 year ago

I mean, the same behavior than the existing plugin I reference. This one create a unique widget per z-wave device that have a battery. Then you can get notification per device if you want instead of a global parameter in Domoticz. It's usefull when you have a device that have trouble to update battery level in Domoticz via OZW but you don't wnat a useless warning each day. Or you can manage individual threshold by "battery device" because some devices are more tolerant to battery variation than other.

It could be a nice option than could be enabled using your optional special parameter. You already have the heart of it because you already parse all the existing ressources at startup.

Another way for me could be to adapt the existing plugin by selecting directly in DeConz DB the information with a SELECT like this one :

SELECT D.mac, S.name, RI.value
FROM devices D
JOIN sub_devices SD ON D.id = SD.device_id
JOIN resource_items RI ON SD.id = RI.sub_device_id
JOIN sensors S ON SD.uniqueid = S.uniqueid
WHERE RI.item LIKE '%/battery'
GROUP BY D.id

that gives something like this image