[SOLVED] REST API historicState

  • Platform information:
    • Hardware: RPi 3
    • OS: openhabian latest
    • Java Runtime Environment:
    • openHAB version: 2.2 snapshot

Hi community,

i’m trying to move my rules from XTent to Node-RED (great tool btw!), one of which reads a value from KNX (got that) and compares it to a stored value from mariaDB/JDBC (using persistence).

This already works so/so in my rule (not OH’s fault, more of a knxd issue), but i can’t seem to find a way to get a historicState into Node-RED.

I tried to find something similar through the REST API, but to no avail - can someone point me in the right direction, or is this not possible at all?

Best regards,

Depending on where the historical data is coming from you could use a global variable in Node-Red to store it when generated. Another option would be to look at the various database nodes available in Node-Red to see f there are any already available for that. Final option would be to switch to a compatible database or write the database calls using a function node.

Hope that helps,


I think i already saw some ready-made nodes for MariaDB/MySQL, i just had hopes up that openHAB would expose the function calls ready for XTent to the REST API too.
I’m bit uneasy with reinventing something that openHAB already has with layers upon layers of abstraction - starting from installing database drivers (new node-types) to hardcoding database, table names and queries into Node-RED.

Sorry, I thought you were asking from the Node-RED side. Can’t help you on the OH side with those bindings.

You will have to do a bit of parsing on the Node-Red side to extract the value from the returned JSON. But with this REST call you can get all the Historic data you need.

1 Like

Thank you again, Rich, i will look into that - seems VERY promising. What’s a little parsing compared to a lot of reprogramming? :slight_smile:

Note, the above is just a screen shot from the REST API Documentation which you can install under the Misc tab.