MQTT Temp device randomly flips between C/F

I have a weather station that publishes temp data to a MQTT Broker that this Homey device pulls the temp from. The phone and web app randomly switches from thinking that the temp/number pulled is F to C. Later it will switch to displaying the correct value. Pretty sure it isn’t 122 degrees here in the PNW. :slight_smile: Has anyone else seen this behavior or have any suggestions? Thanks!

Here is the topic for the MQTT Temp device:

{
“measure_temperature”: {
“capability”: “measure_temperature”,
“stateTopic”: “weather/outTemp_F”,
“unit_of_measurement”: “°F”,
“units”:“°F”,
“setTopic”: “”,
“valueTemplate”: “”,
“outputTemplate”: “”,
“displayName”: “Temperature”
}
}

Every app provides temperature data in ºC, and Homey automatically converts it to ºF based on your location. Is your location set correctly in More->Settings->Location?

Yes, there is a Pin on my house under location and timezone is set to Los_Angeles.

I just reopened Homey on my Pixel phone and it displayed ~51 degrees and now it is showing 125 degrees.

I forgot to mention that if I open Insights for the temp, the graph is correct and doesn’t have any spikes into the 100’s of degrees. It has also never displayed the incorrect temperature at the top of the Home page where it says “Good Morning, Scott!” and the temp and weather conditions. The random issue happens when connecting to the local SHS address using admin account and my.homey.app (on local network and on cellular/remote).

Home Assistant has been subscribed to the same Temp MQTT Broker topic for years and has never converted the temp to C so I don’t think there are any issues on the Broker/MQTT side.

It’s not an issue with the device sending the data, since temperatures are always provided by the apps in ºC, after which Homey converts it automatically to ºC or ºF, depending on your location.

You should contact Athom:

51ºF is not 125ºC

51ºF is actually 10.6ºC

But 51ºC is 123.8 ºF

As stated

It looks like Homey is receiving the temperature in ºF but expecting/interpreting it as ºC, and converting it to ºF.

Is it possible that something changed to the MQTT topic being written?

Correct. Homey receives F, thinks it is C and converts it. I don’t think it is anything on the MQTT side because Home Assistant has never done this, data being published to the broker hasn’t changed, and this is a screen shot showing the temp directly from the Broker. I left the app open on my phone and it went from displaying the correct temp to incorrect temp (120+) and back to correct over the course of about 10 minutes.

I think I just figured something out. The temp display in Homey switches to 100+ degrees when the Homey MQTT Temp device gets an updated temperature from the Broker. If I then do a Web page refresh the temperature reverts to the correct temp. Another clue to the root cause; if Broker receives exact same temperature, the temperature in Homey doesn’t switch to the 100+ degree temp. But if there is a temperature change Homey will display the incorrect temp until the page is refreshed.

Homey Support says that it is an issue with the MQTT Hub App so I am going to contact them.

Hey, just to report the solution also in the forum :slight_smile:

I added the conversion code and now if the web page is refreshed or the app is opened on my phone the temperature (in F) has been converted to C. If the broker receives an updated temperature the temperature will revert to being displayed correctly. The MQTT Broker receives the temp in F.

Here is the device config:
{
“measure_temperature”: {
“capability”: “measure_temperature”,
“stateTopic”: “weather/outTemp_F”,
“unit_of_measurement”: “°F”,
“units”:“°F”,
“setTopic”: “”,
“valueTemplate”: “(topic) => { return ((topic.value - 32) * 5/9) }”,
“outputTemplate”: “”,
“displayName”: “Temperature”
}
}

Attached are two images of the device.

(attachments)



And it causes a new issue. The temp recorded in Homey Insights for the temperature device is now in C not F. The Insights data had always been correct until adding the conversion to the temperature device.