Sonoff RM433 remote with Homeassistant
I would like to share how I added this Sonoff RM433 remote to my home automation setup using Homeassistant.
Having a physical remote was something that I think was missing here at home.
Sometimes you just need to trigger a scene, or turn something off without requiring Siri or Google Home interaction, and the remote is there. It’s a physical thing, you can press some buttons. This is particularly useful to be used by someone at home that may not have access to Homeassistant companion app, or even Siri.
Unboxing
Here’s an image of the original package
You can buy this in the ITEAD store.
Step by step 🛠
RF Bridge 📻
I will assume that you already have an RF Bridge, also configured on Homeassistant, ready to get some RF codes.
I personally use a Sonoff RF Bridge with Tasmota. It’s pretty straightforwad to capture RF codes.
(There are a lot of youtube videos explaining how to flash Tasmota into a Sonoff device - you’ll find one eventually)
Tasmota publishes any RF detection into the following topic: tele/sonoffrfbridge/RESULT
(where sonoffrfbridge
is the name of the unit).
Here’s an example of the payload published to the RESULT
topic:
{
"Time":"2020-06-12T13:54:57",
"RfReceived":{
"Sync":7560,
"Low":250,
"High":710,
"Data":"5D375C",
"RfKey":"None"
}
}
I’ve created a sensor
in Homeassistant that will capture the new transmitted codes, and will parse this JSON, just with this:
- platform: mqtt
state_topic: 'tele/sonoffrfbridge/RESULT'
value_template: '{{value_json.RfReceived.Data}}'
name: sonoff_bridge_443
expire_after: 1
As you can see, it’s just matching the nested nodes: RfReceived.Data
.
So we can now observe sensor.sonoff_bridge_443
and act accordingly with a set of rules.
You can use the Tasmota console of the RF Bridge to start capturing some hex codes that the RM433 triggers, we’ll need those codes right ahead. Codes with 6 hexadecimal characters like the following:
5D3758
5D375C
Remote Binary sensor
One option to get this remote to work with Homeassistant is to create a binary_sensor
with all the buttons that we need to map:
rm433_button1
rm433_button2
- and so on…
They’ll trigger when each each button is pressed, and a code is received, turning the binary sensor ON
. Adding a delay_off
it will turn the sensor OFF
in 1 second after being enabled.
It’s a trick like we use for Motion detection devices that have no OFF
state.
Bear in mind that we’ll us the codes captured to put into these binary sensors:
- platform: template
sensors:
rm433_button1:
value_template: '{{ is_state("sensor.sonoff_bridge_443", "5D3758") }}'
friendly_name: 'RM433 Button 1'
delay_off: 1
rm433_button2:
value_template: '{{ is_state("sensor.sonoff_bridge_443", "5D375C") }}'
friendly_name: 'RM433 Button 2'
delay_off: 1
I’ve added just 2 buttons for a demo but you cann add all the other 8 buttons.
Along with these binary_sensor
s you can now bind them to your other stuff, creating automation rules.
As an example, I’m using a button to enable scenes, or even start my bread toaster 🍞timer in my automations.yaml
file:
Example of “Start Toaster timer” (a 10m timer that turns ON/OFF my kitchen toaster switch):
- id: 'Button 1 - Turn ON Toaster timer'
alias: Turn ON Toaster Timer when rm433_button1 triggered
initial_state: true
trigger:
- entity_id: binary_sensor.rm433_button1
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: timer.toaster
state: idle
action:
- service: timer.start
entity_id: timer.toaster
Activating Dinner scene:
- id: 'Button 2 - Turn ON Dinner Scene'
alias: Turn ON Dinner Scene when rm433_button2 triggered
initial_state: true
trigger:
- entity_id: binary_sensor.rm433_button2
from: 'off'
platform: state
to: 'on'
action:
- service: scene.turn_on
entity_id: scene.dinner
And that’s it.