Switching to new binary MQTT sensor format

hi all,
I got a warning that the wold binarys ensor way for my espresence won’t work soon. I tried to switch from this:

 - platform: mqtt
  name: livingroom
   state_topic: espresense/rooms/livingroom/status
    json_attributes_topic: espresense/rooms/livingroom/telemetry
    payload_on: online
    payload_off: offline
    device_class: connectivity

To This

mqtt:
    binary_sensor:
    - name: livingroom
    topic: espresense/rooms/livingroom/status
    json_attributes_topic: espresense/rooms/livingroom/telemetry
    payload_available: online
    payload_not_available: offline
    device_class: connectivity  

And of course I do things wrong, but I don’t know where to start outside of the documentation… I’m a beginner at HA

I get these config errors:

Invalid config for [mqtt]: extra keys not allowed @ data['mqtt']['device_class']. Got 'connectivity'
extra keys not allowed @ data['mqtt']['json_attributes_topic']. Got 'espresense/rooms/livingroom/telemetry'
extra keys not allowed @ data['mqtt']['payload_available']. Got 'online'
extra keys not allowed @ data['mqtt']['payload_not_available']. Got 'offline'
extra keys not allowed @ data['mqtt']['topic']. Got 'espresense/rooms/livingroom/status'
required key not provided @ data['mqtt']['binary_sensor'][0]['state_topic']. Got None. (See /config/configuration.yaml, line 86).
Invalid config for [sensor.mqtt]: [payload_on] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->payload_on. (See ?, line ?).

Thanks! :slight_smile:

Your indenting is wrong, creating invalid YAML.

mqtt:
  binary_sensor:
    - name: livingroom
      topic: espresense/rooms/livingroom/status
      <-- more lines at this level -->