Help with MQTT Binary Sensor

Greetings,
I have created a Sonoff RF Bridge binary_sensor as described by Dr. Zzzs but I can’t quite get it working. I don’t ever see an entity get created, or at least one doesn’t get created that is named the the way that I would think it would.

binary_sensor:
  - platform: mqtt
    name: "Front Door"
    state_topic: "tele/sonoff-1254/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "2C740A"
    payload_off: "2C740E"
    device_class: door
    optimistic: false
    qos: 1
    retain: false

Do you see anything that I’m missing?

Thanks,
Jon

So whatever does get created, what is its name? It is something other than this? binary_sensor.front_door

Nothing gets created that I can find.
I would think it should be called binary_sensor.front_door also, but I’ve looked for variations on that as well and can’t find anything.

So you’ve:

  • entered the information shown above into configuration.yaml
  • restarted Home Assistant
  • examined Developer Tools > States and found no entry for binary_sensor.front_door

Did you check Developer Tools > Logs for error messages?

Yes
Yes
Yes
Aha, I wasn’t sure where the best place to find the logs was and you’ve showed me…

Invalid config for [binary_sensor.mqtt]: [optimistic] is an invalid option for [binary_sensor.mqtt]. Check: binary_sensor.mqtt->optimistic. (See /config/configuration.yaml, line 21). Please check the docs at https://home-assistant.io/components/binary_sensor.mqtt/

So I see at https://home-assistant.io/components/binary_sensor.mqtt/, “optimistic” doesn’t exist (anymore?).
I took that whole line out still no joy.
Then I saw the exact same complaint about “retain”
Took that line out too, and finally we’re in business.

Jon

Now you know where to look when starting to debug a problem.

FWIW, both retain and optimistic aren’t valid options for a binary_sensor because they concern themselves with payloads published by an entity and binary_sensors don’t publish anything.

Thanks again. For my own curiosity, are the HA Logs on the Linux filesystem anywhere? (I’m using HASSIO). Sometimes I find it easier to use tools like tail, and/or I might add the file to forward to my log aggregation setup.

I’m not very familiar with hass.io but check the config directory for a file called home-assistant.log.

That file only contains warnings/errors and not the verbose messages that occur during startup and normal operations. Those messages are in /var/log/syslog … but in a venv installation. I don’t know where they are stored for a hass.io installation.