Logic Machine Forum
Zigbee integration - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Zigbee integration (/showthread.php?tid=5779)

Pages: 1 2


RE: Zigbee integration - Alexander - 02.07.2025

I’m not finished yet. How can I use this script as an event-based script and write the retrieved value to a group address?


RE: Zigbee integration - RomansP - 03.07.2025

Hi, use a scheduled script that polls the data as often as needed
Code:
local zb = require('applibs.zigbee')

local ieee = 'f4ce36e12b9esa24'
local res, err = zb.cmdsync('getnamedattributes', ieee, 'HaElectricalMeasurement', {'RmsVoltage'})
log(res)
log(err)
if res then
  local rmsVoltage = res.RmsVoltage
  grp.checkwrite('37/1/3', rmsVoltage) -- 37/1/3 your group address
end

res, err = zb.cmdsync('getrawattribute', ieee, 0xFEE7, 0x0010)
log(res)
log(err)

local total_active_energy = res

if total_active_energy then
  total_active_energy = total_active_energy / 1000 -- to get kWh
  grp.checkwrite('37/1/4', total_active_energy) -- float value
end



RE: Zigbee integration - Alexander - 04.07.2025

(Yesterday, 08:44)RomansP Wrote: Hi, use a scheduled script that polls the data as often as needed
Code:
local zb = require('applibs.zigbee')

local ieee = 'f4ce36e12b9esa24'
local res, err = zb.cmdsync('getnamedattributes', ieee, 'HaElectricalMeasurement', {'RmsVoltage'})
log(res)
log(err)
if res then
  local rmsVoltage = res.RmsVoltage
  grp.checkwrite('37/1/3', rmsVoltage) -- 37/1/3 your group address
end

res, err = zb.cmdsync('getrawattribute', ieee, 0xFEE7, 0x0010)
log(res)
log(err)

local total_active_energy = res

if total_active_energy then
  total_active_energy = total_active_energy / 1000 -- to get kWh
  grp.checkwrite('37/1/4', total_active_energy) -- float value
end

Thanks again!