dastrix80
(Kris K)
October 13, 2023, 11:34pm
1
Hi All
Using 3.4 and having issues reading temp/humidty
My sonoff sensor is configured as so:
My MQTT Thing has:
And the Channel has this value, which is very old/wrong (Actual sonof shows humidity 51% for example)
May someone point me in the right direction?
Thanks!
Matze0211
(Matthias)
October 14, 2023, 5:16am
2
You have two times the same screenshot but missing the thing definition.
Can you share your thing definition(copy and paste from the code tab instead of doing a screenshot)?
Also if I would be you: I would connect to mqtt with a3rd party tool, e.g. mqtt explorer, to validate topic name and what’s really send from sonoff to mqtt, so that you know if the issue is with sonoff or OH
dastrix80
(Kris K)
October 14, 2023, 5:38am
3
Sorry! apologies
UID: mqtt:topic:59b16930c3
label: Subfloor Ventilation
thingTypeUID: mqtt:topic
configuration:
payloadNotAvailable: Offline
availabilityTopic: tele/subfloortemp/LWT
payloadAvailable: Online
bridgeUID: mqtt:broker:MQTT_Broker
location: Subfloor
channels:
- id: Subfloor_Fan_Power
channelTypeUID: mqtt:switch
label: Subfloor Fan Power
description: ""
configuration:
commandTopic: cmnd/subfloortemp/POWER
stateTopic: stat/subfloortemp/POWER
- id: Subfloor_Temperature
channelTypeUID: mqtt:number
label: Subfloor Temperature
description: ""
configuration:
stateTopic: tele/subfloortemp/SENSOR
transformationPattern: JSONPATH:$.AM2301.Temperature
unit: °C
- id: Subfloor_Humidity
channelTypeUID: mqtt:number
label: Subfloor Humidity
description: ""
configuration:
stateTopic: tele/subfloortemp/SENSOR
transformationPattern: JSONPATH:$.AM2301.Humidity
unit: "%"
Matze0211
(Matthias)
October 14, 2023, 5:53am
4
The power topic (working as per your headline) has
stat/subfloortemp/POWER
as a topic, but humidity and temp have a different topic.
I’m not familiar with sonoff but I would try e.g.
stat/subfloortemp/HUMIDITY
as a topic.
Without knowing what data is really published from your device to mqtt, it’s hard to help. Therefore still recommending to verify published mqtt messages with another tool before configuring your thing
dastrix80
(Kris K)
October 14, 2023, 5:55am
5
Thanks and sorry updating the topic name is under the item?
Matze0211
(Matthias)
October 14, 2023, 7:04am
6
It’s within the thing configuration you have posted before. Have a look at the “stateTopic” records
But that’s just a guess, as all state topics normally have the same pattern.
Without knowing what’s really send by your device, it’s hard to help
ubeaut
(Greg)
October 14, 2023, 8:42am
7
Under logging on the device do you have a value for the Telemetry period because if it doesn’t send anything you won’t see any values.
dastrix80
(Kris K)
October 14, 2023, 9:46pm
8
Yes, 300. And the state topics are correct I believe.
ubeaut
(Greg)
October 14, 2023, 9:49pm
9
I have a TH16 but my json path is:
JSONPATH:$.SI7021.Humidity
What does you tele topic look like?
dastrix80
(Kris K)
October 14, 2023, 10:00pm
10
MQTT Explorer has this:
So i think the topic is the same for Temp, Humidity right?
ubeaut
(Greg)
October 14, 2023, 10:09pm
11
What does the tele topic look like on the device console?
dastrix80
(Kris K)
October 14, 2023, 10:14pm
12
23:14:13 LOG: SerialLog 2, WebLog 2, SysLog 0, LogHost domus1, LogPort 514, TelePeriod 300
23:14:33 LOG: SerialLog 2, WebLog 2, SysLog 0, LogHost domus1, LogPort 514, TelePeriod 60
23:14:33 MQT: tele/subfloortemp/STATE = {"Time":"2023-10-14T23:14:33","Uptime":"0T00:15:04","Vcc":3.171,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Tard","BSSId":"FC:EC:DA:11:AC:9A","Channel":1,"RSSI":100,"LinkCount":1,"Downtime":"0T00:00:03"}}
23:14:33 MQT: tele/subfloortemp/SENSOR = {"Time":"2023-10-14T23:14:33","AM2301":{"Temperature":18.7,"Humidity":56.0},"TempUnit":"C"}
ubeaut
(Greg)
October 14, 2023, 10:36pm
13
Mine looks similar:
09:30:30 MQT: tele/sonoffth16/SENSOR = {"Time":"2023-10-15T09:30:30","SI7021":{"Temperature":16.9,"Humidity":52.5},"TempUnit":"C"}
Here is my setup so you can compare.
UID: mqtt:topic:8e609206
label: Sonoff TH16
thingTypeUID: mqtt:topic
configuration:
payloadNotAvailable: Offline
availabilityTopic: tele/sonoffth16/LWT
payloadAvailable: Online
bridgeUID: mqtt:broker:mqttbroker
channels:
- id: sonoffth16
channelTypeUID: mqtt:switch
label: Sonoff TH16
description: null
configuration:
commandTopic: cmnd/sonoffth16/POWER
stateTopic: stat/sonoffth16/POWER
off: OFF
on: ON
- id: th16humidity
channelTypeUID: mqtt:number
label: Sonoff TH16 humidity
description: null
configuration:
stateTopic: tele/sonoffth16/SENSOR
transformationPattern: JSONPATH:$.SI7021.Humidity
- id: sonoffth16temperature
channelTypeUID: mqtt:number
label: Sonoff TH16 temperature
description: null
configuration:
stateTopic: tele/sonoffth16/SENSOR
transformationPattern: JSONPATH:$.SI7021.Temperature
unit: °C
Mine is working.
dastrix80
(Kris K)
October 14, 2023, 10:38pm
14
Yep its the same, I just recreated the MQTT thing, same issue. The sensor is working because the values on the sonoff console are correct
Ive got another in my ceiling that has the same configuration, it too works
This must be a Openhab bug
ubeaut
(Greg)
October 14, 2023, 10:56pm
15
If it was a bug then no MQTT would work and your other devices wouldn’t work either.
Maybe remove the % in the unit measurement for humidity
dastrix80:
unit: "%"
The only difference I have is I don’t bother with password for my mqtt. But if that were the case the power switch would not work either.
Other than that is looks like it “should” work.
Matze0211
(Matthias)
October 15, 2023, 12:14am
16
dastrix80:
Ive got another in my ceiling that has the same configuration, it too works
This must be a Openhab bug
Are there any message in OH log?
Is your item constantly showing the same wrong value → not updating at all OR randomly showing different values, but updating?
Your humidity item is number:temperature - as humidity is % and not °C I would choose number: dimensionless as type.
1 Like
ubeaut
(Greg)
October 15, 2023, 12:47am
17
My items are just numbers and they work:
dastrix80
(Kris K)
October 16, 2023, 6:24pm
18
Edit: plain ol number seems to have fixed it! Thankyou!