Re: HomeWizard P1 Wifi into Domoticz
Posted: Friday 06 January 2023 20:23
Create file "p1.lua" in "/home/pi/domoticz/scripts/lua_parsers/" containing:
supplement with your own idx at the top of the script
Then create a hardware device: http-poller
Fill as follows
Code: Select all
------ BEGIN ------
local idGas = <IDX>
local idEnergy = <IDX>
-- Read API values
s = request['content'];
--
-- Gasmeter
--
local a = domoticz_applyJsonPath(s,'.total_gas_m3')
domoticz_updateDevice(idGas,'',a*1000)
--
-- Energiemeter
--
-- Dal import value
local b = domoticz_applyJsonPath(s,'.total_power_import_t1_kwh')
-- Piek import value
local c = domoticz_applyJsonPath(s,'.total_power_import_t2_kwh')
-- Dal return value
local d = domoticz_applyJsonPath(s,'.total_power_export_t1_kwh')
-- Piek return value
local e = domoticz_applyJsonPath(s,'.total_power_export_t2_kwh')
-- Active Watt Usage
local f = domoticz_applyJsonPath(s,'.active_power_w')
local g = math.abs(domoticz_applyJsonPath(s,'.active_power_w'))
local h = domoticz_applyJsonPath(s,'active_power_l1_w')
local i = domoticz_applyJsonPath(s,'active_power_l2_w')
local j = domoticz_applyJsonPath(s,'active_power_l3_w')
--
if f<0 then f = 0 elseif f>0 then g = 0 end
domoticz_updateDevice(idEnergy,'',b*1000 ..";"..c*1000 ..";"..d*1000 ..";"..e*1000 ..";"..f..";"..g)
------ END ------
Then create a hardware device: http-poller
Fill as follows