Toon en P1
Posted: Sat Feb 23, 2019 12:49 am
Hi all,
Al even bezig met mijn rooted Toon (5.0.4). Probeer nu mijn P1 in Domoticz uit te lezen. Maar wat doe ik fout?
http://192.168.178.46/hdrv_zwave?action=getDevices.json
Met dit gedeelte vanuit het Lua script (uiteraard zonder streepjes):
Al even bezig met mijn rooted Toon (5.0.4). Probeer nu mijn P1 in Domoticz uit te lezen. Maar wat doe ik fout?
http://192.168.178.46/hdrv_zwave?action=getDevices.json
Code: Select all
{"dev_2": {"uuid": "718ca056-4cb4-440d-b6be-6e55e63258b4", "name": "HAE_METER_v3", "internalAddress": "2", "type": "HAE_METER_v3", "supportsCrc": "1", "ccList": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "supportedCC": "5e 86 72 32 56 5a 59 85 73 7a 60 8e 22 70 8b 3c 3d 3e", "nodeFlags": [], "IsConnected": "1", "HealthValue": "10", "DeviceName": "HAE_METER_v3"}, "dev_2.1": {"uuid": "cd34df7a-07cc-43f7-9e6b-9e8c8b1f6bd5", "name": "HAE_METER_v3_1", "internalAddress": "2.1", "type": "HAE_METER_v3_1", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "CurrentGasFlow": "428.00", "CurrentGasQuantity": "4521340.00", "DeviceName": ""}, "dev_2.2": {"uuid": "7d7bafcc-6cff-40c0-b979-254ec9b326fc", "name": "HAE_METER_v3_2", "internalAddress": "2.2", "type": "HAE_METER_v3_2", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN"}, "dev_2.3": {"uuid": "aa2c2686-1a9d-41a3-897b-b833708c288d", "name": "HAE_METER_v3_3", "internalAddress": "2.3", "type": "HAE_METER_v3_3", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "NaN", "CurrentElectricityQuantity": "NaN"}, "dev_2.4": {"uuid": "fefcb38f-a643-454a-8679-778443729b5b", "name": "HAE_METER_v3_4", "internalAddress": "2.4", "type": "HAE_METER_v3_4", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "11903395.00"}, "dev_2.5": {"uuid": "962ce202-fc28-43b4-91a9-cc73c124cf84", "name": "HAE_METER_v3_5", "internalAddress": "2.5", "type": "HAE_METER_v3_5", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "0.00"}, "dev_2.6": {"uuid": "bf58c5bc-2408-45fd-ba77-eca3e46999a1", "name": "HAE_METER_v3_6", "internalAddress": "2.6", "type": "HAE_METER_v3_6", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "262.00", "CurrentElectricityQuantity": "8726340.00"}, "dev_2.7": {"uuid": "2d5e1f58-f406-499b-bb9c-b9b796235305", "name": "HAE_METER_v3_7", "internalAddress": "2.7", "type": "HAE_METER_v3_7", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentElectricityFlow": "0.00", "CurrentElectricityQuantity": "0.00"}, "dev_2.8": {"uuid": "2950c4ec-ba25-4baf-a00f-db5ef9b8b88a", "name": "HAE_METER_v3_8", "internalAddress": "2.8", "type": "HAE_METER_v3_8", "supportsCrc": "0", "ccList": "5e 59 85 8e 3c 3d 3e", "supportedCC": "5e 59 85 8e 3c 3d 3e", "nodeFlags": [], "DeviceName": "", "CurrentHeatQuantity": "NaN"}, "dev_3": {"uuid": "dcf353c6-a1a3-452e-81b1-07e2f6744d2d", "name": "Dressoir", "internalAddress": "3", "type": "NAS_WR01Z", "supportsCrc": "0", "ccList": "5e 72 86 85 59 5a 73 70 25 27 71 32 20", "supportedCC": "5e 72 86 85 59 5a 73 70 25 27 71 32 20", "nodeFlags": [], "IsConnected": "1", "HealthValue": "10", "DeviceName": "Dressoir", "TargetStatus": "1", "CurrentElectricityFlow": "17.14", "CurrentElectricityQuantity": "740.00"}}
Code: Select all
--P1 data
local handle4 = assert(io.popen(string.format('curl http://192.168.178.46/hdrv_zwave?action=getDevices.json', ToonIP)))
local GasPowerInfo = handle4:read('*all')
handle4:close()
--JSON data from Toon contains a extra "." which should not be there.
GasPowerInfo = string.gsub(GasPowerInfo, "dev_2", "dev_2")
GasPowerInfo = string.gsub(GasPowerInfo, "dev_2:", "dev_2\":")
local jsonGasPower = json:decode(GasPowerInfo)
--domoticz.log(jsonGasPower)
-- local CurrentElectricityFlowHoog = tonumber(jsonGasPower.dev_2.CurrentElectricityFlow )
-- local CurrentElectricityQuantityHoog = tonumber(jsonGasPower.dev_2.CurrentElectricityQuantity)
-- local CurrentElectricityFlowLaag = tonumber(jsonGasPower.dev_2.CurrentElectricityFlow )
-- local CurrentElectricityQuantityLaag = tonumber(jsonGasPower.dev_2.CurrentElectricityQuantity)
-- local CurrentGasFlow = tonumber(jsonGasPower.dev_2.CurrentGasFlow)
-- local CurrentGasQuantity = tonumber(jsonGasPower.dev_2.CurrentGasQuantity)
-- local CurrentElectricityQuantity = CurrentElectricityFlowHoog + CurrentElectricityFlowLaag
-- local CurrentElectricityDeliveredLaag = 0
-- local CurrentElectricityDeliveredHoog = 0
-- local totalDeliveredPower = 0
-- domoticz.devices(P1SmartMeterPower).updateP1(CurrentElectricityQuantityLaag, CurrentElectricityQuantityHoog, CurrentElectricityDeliveredLaag, CurrentElectricityDeliveredHoog, CurrentElectricityQuantity, totalDeliveredPower).silent()
-- domoticz.devices(P1SmartMeterGas1).updateGas(CurrentGasQuantity).silent()
--JSON data from Toon contains a extra "," which should not be there.
-- Einde P1 data