Did anything change with MQTT sensors?

A few HASS.IO updates ago, my MQTT sensors stopped working. MQTT itself is running for a switch and works fine but not for the sensors.

This is what I have in my configuration.yaml:

#MQTT Sensor - CPU Temperatur
sensor:
  - platform: mqtt
    name: "cpu_temp_rahmen"
    state_topic: "frame/cpu_temp"
    unit_of_measurement: '°C'
    state_on: "ON"
    state_off: "OFF"
    availability_topic: "frame/cpu_temp/available"
    payload_available: "online"
    payload_not_available: "offline"
  - platform: mqtt
    name: "image_count_rahmen"
    state_topic: "frame/images"
    unit_of_measurement: 'Bilder'
    state_on: "ON"
    state_off: "OFF"
    availability_topic: "frame/images/available"
    payload_available: "online"
    payload_not_available: "offline"

And this is the error message that I get:

2019-02-11 12:14:13 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.mqtt]: [state_on] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->state_on. (See /config/configuration.yaml, line 60). Please check the docs at MQTT Sensor - Home Assistant
2019-02-11 12:14:13 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.mqtt]: [state_on] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->state_on. (See /config/configuration.yaml, line 69). Please check the docs at MQTT Sensor - Home Assistant

Any idea what I may be doing wrong?

The error message indicates state_on is an invalid option. That’s correct and the documentation for an MQTT Sensor does not list state_on or state_off.

In the past, Home Assistant would ignore invalid options but, starting with 0.87, it identifies them and rejects the associated entity.

You need to remove the invalid options from the configuration of your MQTT sensors.

It’s the last item listed in Breaking Changes:

MQTT platforms will now flag mistyped configs from configuration.yaml correctly as invalid, instead of just ignoring them. (@emontnemery - #20562) (mqtt docs) (breaking change)

1 Like

Thanks @123. I removed these lines but it still won’t show the sensors…

Are there any error messages reported in Home Assistant’s log?

Ah, following a host reboot rather than a HA restart, it works now. Thanks @123!