Help wanted - Quby Smart thermostat - data extraction

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!

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

Currently working on a decent binding for rooted toons :slight_smile:

Daan_Meijer, that would be amazing, anything i could do to assist and collaborate on this?

@ vzorglub

So i got the rule to work, i see in the log that it’s read and its pulling data.
I dont know which log to watch for the (i have looked thru all logs but could not find this)

logInfo("TEST", CurrentElectricityQuantity)

Also i tried a lot of options but could you tell me how to get this data and make it upload to a item?
I really appreciate the time if you can explain this to me!

My end goal is to get the data from the thermostat and present it in Grafana thru influxDB, why install new sensors if i can just pull it from my thermostat.

Create a number item:

Number MyNumberItem

In the rule:

logInfo("TEST", CurrentElectricityQuantity)
MyNumberItem.postUpdate(CurrentElectricityQuantity)

Did that, no issue implementing that.

Did find out that the json was invalid because dev_2.6 has a ‘‘dot’’ in the name so instead i made this and returns valid json.

val String CurrentElectricityQuantity = transform("JSONPATH", "$.[dev_2.6].CurrentElectricityQuantity", jsonString)

Only now i see this in the logs:

23:31:01.563 [WARN ] [arthome.model.script.actions.BusEvent] - Cannot convert '{
"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":"0.00", "CurrentElectricityQuantity":"4249494.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":"428.00", "CurrentElectricityQuantity":"4726956.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)"}
}' to a state type which item 'CurrentElectricity' accepts: [DecimalType, QuantityType, UnDefType].

I guess that it is downloading the entire thing instead of extracting the value we are looking for.

I’ve built a preliminary version of the binding: https://mega.nz/#!yipFDKLY!w31IMioJDM5Oi4GzLIvIKWuwOnQUitLf9DnPhiC18E8

@Paul_P: to help me, please test it and tell me:

  • what works the way you expect it to
  • what doesn’t work the way you expect it to
  • what you’re missing

For other people, please use the dedicated topic for data reporting: Rooted (locally accessible) Toon

Please use JSON Validator to validate JSON data.

JSON Formatter
JSON Validator