REGEX help Tasmota read out Temperature

when i run the HTTP api command for power state on my tasmota device i get {"POWER":"OFF"}

I get ON or OFF state so this ITEM file works!
String SonoffVarmareGV "Sonoff GetValue" { http="<[http://192.168.1.82/cm?user=admin&password=ksldjflksdf&cmnd=Power:10000:REGEX(.*?\\{\"POWER\":\"(.*?)\"\\}.*)]"}

but when i HTTP api my tasmota device and want only to read out Temperature with REGEX?

{"StatusSNS":{"Time":"2020-08-01T21:32:24","DS18B20":{"Id":"0301A27974B7","Temperature":26.6},"TempUnit":"C"}}

hope someone can help me with the REGEX command to read out only Temperature

no i dont have MQTT im running old OpenHAB version 2.2 apperently i can only install 1.11 version of MQTT

Obviously, we’d recommend upgrading.

Failing that, can you use the JSONPATH transform instead? Does it have to be REGEX?

JSONPATH would be great

Well, not quite sure how it would work with the http binding, but it might look something like:

JSONPATH($.StatusSNS.DS18B20.Temperature)

Of course, ensure you have the JSONPATH transformation installed via PaperUI’s add-ons.

EDIT:

Hopefully someone else more knowledgeable can weigh in, but I assumed any openHAB 2 system could use any V2 binding (at least, the V2 MQTT binding…)

{ http="<[http://192.168.1.82/cm?user=admin&password=asdasdsa&cmnd=status%2010:JSONPATH($.StatusSNS.DS18B20.Temperature)"}

tried this but no luck, maybe i missed something in the code

What does this mean - do you get an error or warning in the openHAB logs?

I’m only familiar with Tasmota over MQTT, where the JSONPATH would usually be:

JSONPATH($.DS18B20.Temperature)

Might be worth trying, but it shouldn’t based on your JSON extract you showed in your OP. EDIT: I see now that you’re calling STATUS 10, so your original JSON extract looks correct.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.