Binary Sensors shown in Home Assistant Lovelace UI
%author% via %publisher%
Home / How to create binary sensors for RF and BLE sensors and Open MQTT Gateway in Home Assistant
Home Assistant Integrations

How to create binary sensors for RF and BLE sensors and Open MQTT Gateway in Home Assistant

Open MQTT Gateway (OMG) running on ESP32 micro controllers offers low latency and reliability for picking up RF 433MHz and Bluetooth BLE signals! There are a ton of configuration options in the firmware and this article shows how to integrate it to Home Assistant with binary sensors.

OMG does have the ability to add sensors automatically to Home Assistant via MQTT discovery, however this results in sensors named after their integer payloads (not user friendly and difficult to work with.)

Creating binary sensors for Open MQTT Gateway

There are two ways to create these sensors depending what type of sensor you own and how you configure Open MQTT Gateway.

Method 1

The first method is using payload_on and the off_delay parameter introduced in Home assistant v0.81.

- platform: mqtt
  name: "mtn_lounge"
  device_class: 'motion'
  state_topic: "home/gw/433toMQTT"
  value_template: '{{ value_json.value }}'
  payload_on: 9151402
  off_delay: 5

Method 2

The second way to add binary sensors to Home Assistant is using the payload_off. You may use the delay as well but it would overwrite the payload_off. This can be useful if you want the sensor to time out. Sometimes my front door sensor does not send the door closed signal correctly. In that case, its useful to have the sensor reset back to closed after a pre-defined delay.

- platform: mqtt
  name: "front_door"
  device_class: 'door'
  state_topic: "home/gateway/433toMQTT"
  value_template: '{{ value_json.value }}'
  payload_on: '12280842'
  payload_off: '12280846'

Conclusion

How are you using the various binary_sensor platforms in your configurations? Do you know a better way to achieve the above? Please let me know in the comments below!

MY MISSION

This blog started nearly 10 years ago to help me document my technical adventures in home automation and various side projects. Since then, my audience has grown significantly thanks to readers like you.

While blog content can be incredibly valuable to visitors, it’s difficult for bloggers to capture any of that value – and we still have to work for a living too. There are many ways to support my efforts should you choose to do so:

Consider joining my newsletter or shouting a coffee to help with research, drafting, crafting and publishing of new content or the costs of web hosting.

It would mean the world if gave my Android App a go or left a 5-star review on Google Play. You may also participate in feature voting to shape the apps future.

Alternatively, leave the gift of feedback, visit my Etsy Store or share a post you liked with someone who may be interested. All helps spread the word.

BTC network: 32jWFfkMQQ6o4dJMpiWVdZzSwjRsSUMCk6

Continue your adventure here

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

DON’T MISS OUT!
Subscribe To Newsletter
Be the first to get latest updates and exclusive content straight to your email inbox.
Stay Updated
Give it a try, you can unsubscribe anytime.
close-link