Help wanted - Quby Smart thermostat - data extraction

openhab2
toon
Tags: #<Tag:0x00007f014b9da500> #<Tag:0x00007f014b9da230>

(Paul P) #1

Hello all,

I have been reading and reading but i guess this goes above my head, i’m hoping you guys can help me get on the right path.

I have a thermostat which is rooted and provides me with a lot of data

I can run for example:

http://192.168.X.XX/hdrv_zwave?action=getDevices.js

And get:

{ 
"dev_settings_device":{"uuid":"193b91af-dc9d-4a9a-9e43-9b5682fe6238", "name":"settings_device", "internalAddress":"settings_device", "type":"settings_device", "supportsCrc":"0", "location":"(null)"},
"dev_2":{"uuid":"d2a1a2c3-7d65-459b-a655-5bb2b9742f57", "name":"HAE_METER_v2", "internalAddress":"2", "type":"HAE_METER_v2", "supportsCrc":"1", "ccList":"22 3c 3d 3e 56 60 70 72 7a 86 8b 73", "supportedCC":"22 3c 3d 3e 56 60 70 72 7a 86 8b 73", "IsConnected":"1", "DeviceName":"", "HealthValue":"10", "location":"(null)"},
"dev_2.1":{"uuid":"0fab6560-1c0f-4270-b85b-582261f51df2", "name":"HAE_METER_v2_1", "internalAddress":"2.1", "type":"gas", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentGasFlow":"NaN", "CurrentGasQuantity":"NaN", "location":"(null)"},
"dev_2.2":{"uuid":"112c8033-f72f-4ddb-8fcb-cfd3ad719c6e", "name":"HAE_METER_v2_2", "internalAddress":"2.2", "type":"elec", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "location":"(null)"},
"dev_2.3":{"uuid":"f489ff70-2db6-4e28-8368-fe9204e5856e", "name":"HAE_METER_v2_3", "internalAddress":"2.3", "type":"elec_delivered_nt", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentElectricityFlow":"680.00", "CurrentElectricityQuantity":"4204766.00", "location":"(null)"},
"dev_2.4":{"uuid":"332dc006-70e7-4364-aa57-71612199f9eb", "name":"HAE_METER_v2_4", "internalAddress":"2.4", "type":"elec_received_nt", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentElectricityFlow":"0.00", "CurrentElectricityQuantity":"0.00", "location":"(null)"},
"dev_2.5":{"uuid":"aeef8b39-c855-489b-93d8-8833489c5213", "name":"HAE_METER_v2_5", "internalAddress":"2.5", "type":"elec_delivered_lt", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentElectricityFlow":"0.00", "CurrentElectricityQuantity":"4649517.00", "location":"(null)"},
"dev_2.6":{"uuid":"199725dc-a289-4c3b-a14d-5d797b1afcb9", "name":"HAE_METER_v2_6", "internalAddress":"2.6", "type":"elec_received_lt", "supportsCrc":"0", "ccList":"3c 3d 3e 72 86", "supportedCC":"3c 3d 3e 72 86", "CurrentElectricityFlow":"0.00", "CurrentElectricityQuantity":"6289.00", "location":"(null)"}
}

Or i can run http://192.168.x.x/happ_thermstat?action=getThermostatInfo

And get:

{"result":"ok", "currentTemp":"2106", "currentSetpoint":"2100", "currentInternalBoilerSetpoint":"33", "programState":"1", "activeState":"0", "nextProgram":"1", "nextState":"2", "nextTime":"1547240400","nextSetpoint":"1600","randomConfigId":"1804289383","errorFound":"255","connection":"0","burnerInfo":"0","otCommError":"0","currentModulationLevel":"17"}

I have read a lot about the HTTP binding and Json transformation but i am completely lost on the matter.

Maby some of you would be able to help me out a bit and make me get the data from the thermostat and show in in my openhab install.

I now that for domoticz they have it working even with changing the temperature and programs etc.

See this post for details:

https://www.domoticz.com/forum/viewtopic.php?t=11421

Thank you in advance!


(Vincent Regaud) #2

Ok, your Json in prettry format is:

{
   "dev_settings_device":{
      "uuid":"193b91af-dc9d-4a9a-9e43-9b5682fe6238",
      "name":"settings_device",
      "internalAddress":"settings_device",
      "type":"settings_device",
      "supportsCrc":"0",
      "location":"(null)"
   },
   "dev_2":{
      "uuid":"d2a1a2c3-7d65-459b-a655-5bb2b9742f57",
      "name":"HAE_METER_v2",
      "internalAddress":"2",
      "type":"HAE_METER_v2",
      "supportsCrc":"1",
      "ccList":"22 3c 3d 3e 56 60 70 72 7a 86 8b 73",
      "supportedCC":"22 3c 3d 3e 56 60 70 72 7a 86 8b 73",
      "IsConnected":"1",
      "DeviceName":"",
      "HealthValue":"10",
      "location":"(null)"
   },
   "dev_2.1":{
      "uuid":"0fab6560-1c0f-4270-b85b-582261f51df2",
      "name":"HAE_METER_v2_1",
      "internalAddress":"2.1",
      "type":"gas",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentGasFlow":"NaN",
      "CurrentGasQuantity":"NaN",
      "location":"(null)"
   },
   "dev_2.2":{
      "uuid":"112c8033-f72f-4ddb-8fcb-cfd3ad719c6e",
      "name":"HAE_METER_v2_2",
      "internalAddress":"2.2",
      "type":"elec",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentElectricityFlow":"NaN",
      "CurrentElectricityQuantity":"NaN",
      "location":"(null)"
   },
   "dev_2.3":{
      "uuid":"f489ff70-2db6-4e28-8368-fe9204e5856e",
      "name":"HAE_METER_v2_3",
      "internalAddress":"2.3",
      "type":"elec_delivered_nt",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentElectricityFlow":"680.00",
      "CurrentElectricityQuantity":"4204766.00",
      "location":"(null)"
   },
   "dev_2.4":{
      "uuid":"332dc006-70e7-4364-aa57-71612199f9eb",
      "name":"HAE_METER_v2_4",
      "internalAddress":"2.4",
      "type":"elec_received_nt",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentElectricityFlow":"0.00",
      "CurrentElectricityQuantity":"0.00",
      "location":"(null)"
   },
   "dev_2.5":{
      "uuid":"aeef8b39-c855-489b-93d8-8833489c5213",
      "name":"HAE_METER_v2_5",
      "internalAddress":"2.5",
      "type":"elec_delivered_lt",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentElectricityFlow":"0.00",
      "CurrentElectricityQuantity":"4649517.00",
      "location":"(null)"
   },
   "dev_2.6":{
      "uuid":"199725dc-a289-4c3b-a14d-5d797b1afcb9",
      "name":"HAE_METER_v2_6",
      "internalAddress":"2.6",
      "type":"elec_received_lt",
      "supportsCrc":"0",
      "ccList":"3c 3d 3e 72 86",
      "supportedCC":"3c 3d 3e 72 86",
      "CurrentElectricityFlow":"0.00",
      "CurrentElectricityQuantity":"6289.00",
      "location":"(null)"
   }
}

Now, let’s say I want the CurrentElectricityQuantity of dev_2.6
Then the JSONPATH is : $.dev_2.6.CurrentElectricityQuantity
Simple as that

Example:

rule "extract data from json"
when
    Time cron "1 0/5 * ? * * *"
then
    val String jsonString = sendHttpGetRequest("http://192.168.x.xx/hdrv_zwave?action=getDevices.js", 5000)
    val String CurrentElectricityQuantity = transform("JSONPATH", "$.dev_2.6.CurrentElectricityQuantity", jsonString)
    logInfo("TEST", CurrentElectricityQuantity)
end

Same principle applies for the other URL

I use:


to make the json readable
and

To test jsonpath