Openhab 3 http binding through UI

Hello fiends,

I have just migrated to OPENHAB 3, and I’m trying to get the power value of my Efergy sensor through the http binding (through the new UI). The value I’m trying to get is contained in this response of a URL:

[{“cid”:“PWER”,“data”:[{“1610309338000”:188}],“sid”:“824212”,“units”:“W”,“age”:2}]

Specifically, I want to get the value 188

Can anyone give me a hand on how to do it through http binding configuration on UI?

Thanks!

That looks like JSON format, the JSONPATH transformation should help.

Is this string, before the 188, always the same?

No, this number changes in every query… :frowning:

Thanks Jürgen, hafniumzinc, the problem is that the string before the value I want to get changes in every query (as it’s a kind of time value)

[{“cid”:“PWER”,“data”:[{“1610309338000”:188 }],“sid”:“824212”,“units”:“W”,“age”:2}]

If it’s a time value, can you precompute it?

Thanks Jürgen but I’m not an expert on programming, nor JSON, even nor Openhab! :slight_smile:

The .js script I had in Openhab2 to get this value was:

JSON.parse(input)[0].data[0][Object.keys(JSON.parse(input)[0].data[0])[0]]

The question is how this translates into the value I have to set into the field “State Transformation” in the Openhab 3 graphic interface…

Thanks!