UI shows JSON instead of value for MQTT sensor


I have an installation with several temperature sensors set up via MQTT auto discovery but in the UI it will not show the temperature value, instead it shows the JSON published on the state topic. For my novice eyes, the configuration looks correct so what am I missing?

The config for one of the sensors is published on the topic


and it looks like this (reformatted to be more readable):

  "device": {
    "name": "215_temperaturehumidity",
    "identifiers": [
    "model": "temperaturehumidity",
    "manufacturer": "fineoffset"
  "unique_id": "215_telldus_temperature",
  "name": "telldus_215_temperature",
  "state_topic": "telldus/215/temperature/state",
  "state_value_template": "{{ value_json.temperature }}",
  "device_class": "temperature",
  "unit_of_measurement": "°C"

From the mqtt_dump.txt file:

telldus/215/temperature/state,{"temperature": "-9.4"}

This will show up as

{“temperature”: “-9.4”} °C

in the Home Assistant UI. My expectation is that it would show

-9.4 °C

and that the graph will be drawn when looking inside but it is blank.
It seems like the state_value_template is not applied for the incoming state update.

Is there some apparent problem in the configuration or is my expectation faulty?

How can I debug this further? Since I am a software developer by trade, I have tried navigating the code to figure out what is supposed to happen but I have not really found my way in there.


According to the documentation for an MQTT Sensor, the option’s name is value_template.

Which integration is using MQTT Discovery to create this sensor? If you have access to its source code, perhaps you can modify it.


Correction. Linked to the wrong option.

Thanks for the hint.

Its a 433 to MQTT bridge thingy I have running in a docker container and I have the source for it so I’ll try to tweak the code to send the value_template instead and see what happens.


FWIW, the MQTT Light integration uses state_value_template.

My guess is because so many light properties are supported and many can be configured with a template, that someone decided it may be a good thing to explicitly indicate which property the value_template is handling. Having said that, there are other complex entities, like cover and climate that simply use value_template. :man_shrugging:t3:

I had great success removing the state_ part from the value_template. Now I get the expected result.

I also have problems with how switches are behaving so I guess there is more problems in the integration I’ll have to look into but I will check the relevant docs for the switch for that.

Thanks again for leading me in the right direction to be able to solve my problem.

My switch problem was also solved by this change so now they look like my non 433 switches. No more lightning strikes. Yay. :slight_smile: