Post navigation

4 thoughts on “Hive Thermostat flow”

I eventually managed to get your flow here to work for me, but encountered two/three problems along the way:

1: copying this JSON flow as HTML results in the quote marks not being interpreted by NodeRed as quotes, so you have to paste the code into a text editor, search and replace the quotes, and then the import from Clipboard will work.

2: The same problem also produces a much more subtle issue: the JSONpath expressions all have a single elision character embedded in them instead of three separate dots, meaning that the expressions don’t work and no data is returned. You have to manually edit each contrib-json node’s expression in NodeRed to delete the ‘$…’ that is in there and manually re-type ‘$…’ The result looks the same, but will actually work now where it didn’t before.

3: My Hive setup has two devices that produce temperature values, so I get an array out of the ‘heating/temperature’ call instead of a single value, which confuses the subsequent parsing and produces no value for the content. To fix this, either correct the JSONpath expression to get just the first value, or to select the one with just the nodeType of thermostat (neither of which I managed to do despite much fiddling with JSONpath expressions) or just add a Regular Expression onto the end of the ‘normalise’ node to replace everything from the comma onwards, so the expression is “,.*” (without the quote marks).

So ideally, if you could paste in the JSON code in raw format instead of HTML that would fix the first two issues and save someone else some hours of debugging …

OK, so I’ve fixed the JSONpath expression for problem #3 now. If you use this in the “Get Temperature” contrib-json node then you pick up the temp only from the thermostat, even if there are other temp devices around:
$..[?(@.nodeType==’http://alertme.com/schema/json/node.class.thermostat.json#’)].attributes.temperature.reportedValue.