Smanar / Domoticz-deCONZ

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

Power consumption device type #138

Closed jslegers73 closed 6 months ago

jslegers73 commented 1 year ago

I have a power plug that can read out power usage. We I have added it in deConz it shows up in the device list in domoticz. The power consumption/usgae is offered in a RFXMeter. Is it possible to make this a General kWh meter?

Device_list Utility

Like this: General

Smanar commented 1 year ago

Hello, it depend of device. Some device have the power and the consumption on the same cluster (so the same widget) and I m forced to mix them (in a "general kwh"). But your device have the consumption on the device finishing by 0702 and the power on the one finishing by 0b04.

It still possible using script like this one https://github.com/Smanar/Domoticz-deCONZ/wiki/Example-to-make-a-LUA-script-to-mix-temperature-humidity-barometer-on-the-same-sensor

The script was already done but I can't found it again. If you want to do like that I can help you to remake the script.

jslegers73 commented 1 year ago

Hello. Thanks for the answer. I will have a look at this. I'm not a scripting guru but wil try.

Smanar commented 1 year ago

I haven't tested, but with LUA will be something like (using the LUA script from the wiki)

--Mixed sensor for Power/consumption
if devicechanged['deCONZ - power'] or devicechanged['deCONZ - consumption'] then
    print ('Update Mixed sensor')
    --Get all values
    p = otherdevices_svalues['deCONZ - power']
    c = otherdevices_svalues['deCONZ - consumption']
        print ('debug '..p..' '..c  )
    --Set new value
    commandArray['UpdateDevice'] = '75|0|'..p..';'..c

end
jslegers73 commented 1 year ago

Thank you I will try this soon when I have some spare time.

Smanar commented 1 year ago

Same problem for me ^^ I need to simulate your device to test it. Tell me the result you have, or the debug ouput , I can adapt the code.