Hi to all
I have a sonoff TH16 with sensor AM2301.
I have this mqtt.cfg:
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
localbroker.url=tcp:localhost:xxx
# Optional. User id to authenticate with the broker.
localbroker.user=xxxxx
# Optional. Password to authenticate with the broker.
localbroker.pwd=xxxxx
This is the information from the console of the sonoff:
14:30:26 MQT: tele/sonoffTermostato/STATE = {“Time”:“2019-06-01T14:30:26”,“Uptime”:“0T00:00:14”,“Vcc”:3.230,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“TP-LINK_88A51C”,“BSSId”:“64:66:B3:88:A5:1C”,“Channel”:3,“RSSI”:100,“LinkCount”:1,“Downtime”:“0T00:00:04”}}
14:30:26 MQT: tele/sonoffTermostato/SENSOR = {“Time”:“2019-06-01T14:30:26”,“AM2301”:{“Temperature”:23.9,“Humidity”:57.8},“TempUnit”:“C”}
14:30:36 MQT: stat/sonoffTermostato/RESULT = {“POWER”:“ON”}
14:30:36 MQT: stat/sonoffTermostato/POWER = ON
14:30:37 MQT: stat/sonoffTermostato/RESULT = {“POWER”:“OFF”}
14:30:37 MQT: stat/sonoffTermostato/POWER = OFF
14:30:38 MQT: stat/sonoffTermostato/RESULT = {“POWER”:“ON”}
14:30:38 MQT: stat/sonoffTermostato/POWER = ON
14:30:39 MQT: stat/sonoffTermostato/RESULT = {“POWER”:“OFF”}
14:30:39 MQT: stat/sonoffTermostato/POWER = OFF
my problem is that i not be able to see the value of the humidity and temperature.
Can you help me pls?
Your switch item is setup with the version 2 syntax, if switching is working you are using the version 2 of the mqtt binding.
In this case the items for temperature and humidity are setup wrong! Use the version 2 syntax as well.
2019-06-02 16:01:45.162 [WARN ] [l.generic.ChannelStateTransformation] - Transformation service TELE/SONOFFTERMOSTATO/SENSOR for pattern state:JSONPATH:$.AM2301.Humidity not found!
Do NOT change the working channel for the ON/OFF switch!
You need to create a separate Number channel for temperature and humidity!
For the incoming value transformation use: JSONPATH:$.AM2301.Temperature and for the state topic the one I posted above.
Did you created a MQTT Broker Thing that is connected to your broker? Without that no MQTT Thing and Item will work!
Did you connect your Generic MQTT Thing to that Broker Thing?
The stateTopic for the temperature and humidity must start with “tele” instead of “stat”!