MQTT config.yaml changes!

Hope someone can help.

I know the YAML is depreciated at the next update, so I have been trying to work out the correct syntax, but I cant make it work.

I have moved lights and switches under the mqtt: section but I can get binary sensors to work.

I have pasted an example! Would someone mind pointing out the obvious to me.

binary_sensor:
  - platform: mqtt
    name: "Lounge PIR"
    state_topic: "Sonoff/LoungePIR"
    availability_topic: "tele/sonoff_bridge/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    device_class: motion

Thanks in advance.

Rob

The example in the docs:

mqtt:
  binary_sensor:
    - name: "Window Contact Sensor"
      state_topic: "home-assistant/window/contact"

So, yours would change to:

mqtt:
  binary_sensor:
    - name: "Lounge PIR"
      state_topic: "Sonoff/LoungePIR"
      availability_topic: "tele/sonoff_bridge/LWT"
      qos: 1
      payload_on: "ON"
      payload_off: "OFF"
      payload_available: "Online"
      payload_not_available: "Offline"
      device_class: motion

It’s the same basic change you made to the light and switch domains.

I’m sure I done that.

I’ll try again.

Thanks for your help