[SOLVED] Temperature and Humidity from Sonoff is not displaing in basicUI

(Jose Ferreira) #1


I’m new to OpenHab.
I’m using a Sonoff TH16 with a AM2301 sensor (temperature and humidity sensor). I can actuate in a light, yet I can’t present the temperature and humidity values in the basicUI.
I configure the items as:

Number StorageRoom_Humidity “Humidade” (StorageRoom, gHumidity) {mqtt="<[broker:tele/TempDisp/SENSOR:state:JSONPATH($.AM2301.Humidity)]", autoupdate=“true”}
Number StorageRoom_Temperature “Temperatura” (StorageRoom, gTemperature) {mqtt="<[broker:tele/TempDisp/SENSOR:state:JSONPATH($.AM2301.Temperature)]", autoupdate=“true”}

In the sitemap i did this:
Group item=StorageRoom label=“Despensa” icon=“suitcase” {
Frame {
Switch item=StorageRoom_Light label=“Acender Luz” icon=“light”
Frame {
Switch item=StorageRoom_Fan label=“Ligar Ventoinha” icon=“fan_ceiling”
Text item=none label="" icon=“none”
Text item=StorageRoom_Temperature label=“Temperatura [%.1f ºC]” icon=“temperature”
Text item=StorageRoom_Humidity label=“Humidade [%.1f %%]” icon=“humidity”

In the BasicUI appears like this:

To know the OpenHab was connecting with the sonoff, I’m following the exchange of messages. So, as you can see the messages are being exchanged:
tasmota/tele/sonoff/SENSOR {“Time”:“2018-08-28T01:05:36”,“AM2301”:{“Temperature”:28.6,“Humidity”:53.1},“TempUnit”:“C”}
tasmota/sonoff-A00EEA/tele/STATE {“Time”:“2018-08-28T01:10:13”,“Uptime”:“0T06:15:16”,“Vcc”:3.158,“POWER1”:“OFF”,“Wifi”:{“AP”:xx,“SSId”:“xxxx”,“RSSI”:xxx,“APMac”:“xxxxxx”}}
tasmota/sonoff-A00EEA/tele/SENSOR {“Time”:“2018-08-28T01:10:13”,“Switch1”:“ON”}
tasmota/tele/sonoff/STATE {“Time”:“2018-08-28T01:10:43”,“Uptime”:“0T00:15:36”,“Vcc”:3.186,“POWER”:“OFF”,“Wifi”:{“AP”:xx,“SSId”:“xxxx”,“RSSI”:xxx,“APMac”:“xxxxxxx”}}
tasmota/tele/sonoff/SENSOR {“Time”:“2018-08-28T01:10:43”,“AM2301”:{“Temperature”:28.6,“Humidity”:53.0},“TempUnit”:“C”}

I do not know what I’m doing wrong. Can you support me?

Thank you

(charalampos varytimos) #2

change it

Number StorageRoom_Humidity “Humidade” (StorageRoom, gHumidity) {mqtt="<[broker:tasmota/tele/sonoff/SENSOR:state:JSONPATH($.AM2301.Humidity)]", autoupdate=“true”}

(Juan) #3

I had the same problem at the beginning, until with this formula is working for me:

In the sitemap i did this:

Switch item=StorageRoom_Fan


Number StorageRoom_Temperature "Temperature  [%.1f °C]" <temperature>       {mqtt="<[mosquitto:tele/TempDisp/SENSOR:state:JSONPATH($.SI7021.Temperature)]"}

Number StorageRoom_Humidity "Humidity  [%.1f %%]" <humidity>     {mqtt="<[mosquitto:tele/TempDisp/SENSOR:state:JSONPATH($.SI7021.Humidity)]"}    

Try that, maybe restarting the system could work.

(Vincent Regaud) #4

You don’t need the autoupdate param as you are not sending commands to the device.

Number StorageRoom_Humidity “Humidade” (StorageRoom, gHumidity) { mqtt="<[broker:tasmota/tele/sonoff/SENSOR:state:JSONPATH($.AM2301.Humidity)]" }

Also for next time, please use the code fences when publishing code, thanks

(Jose Ferreira) #5

It is working, I was able to displaying the temperature and humidity.
Thank you so much.

But now I have a new question. If I have more than one Sonoff TH10 using the same sensor (AM2301). How do I know which one I asking for the information?

(Vincent Regaud) #6

You need to set the topic in the tasmota interface:

(Jose Ferreira) #7

I already test it

Thank you.