I use the Tasmota code on a Sonoff RF gateway with good success. Here’s an example that might be helpful for you. I have a 433MHz wireless doorbell, and I’ve defined a switch that toggles when someone presses the doorbell button.
This doorbell button doesn’t have an “off”, just a code when it’s pressed. I have similar things in place for PIR motion detectors that just send a code upon motion detection; their configuration is similar to this example.
The input_boolean entity is turned on for 10 seconds and then turned off. Note that only the Data element in the JSON payload is significant; the other numbers will vary a little bit as the RF gateway tries to measure the RF signaling, and it doesn’t always get quite the same answer each time. This is why I used the template condition and the specified value_template expression to test just that one field.
Of course, you can then trigger an automation based on the state change of the input_boolean entity. Or even just do stuff in this automation and not bother with the input_boolean at all. My preference is to have this other input_boolean entity around because I can then easily look at the history of that entity and see the times when it’s state has changed recently.
Hi - I did find a way to send all the command to the Sonoff as a single payload. Instead of sending individual commands, use the BACKLOG command as below:
My current problem is that while I can send all the relvant commands into the backlog, the RF Bridge doesn’t trigger the switch with the code, even though the code and associated data has been learned and assigned to a key that works with a corresponding RfKey command. Still under investigation…
You generate an extra message and network traffic to your MQTT broker, and other received message to process by Home Assistant. You still have a timer running in there, same as me, but mine is inside the action: of the automation, rather than part of the trigger. I’m not sure its necessarily simpler since the logic to control the entity is split in a couple of different places.
In my case, I have one automation to manipulation the state of an input_boolean entity; in your case, you have a template sensor that responds to an MQTT message and an auxiliary automation and traffic to also poke the template sensor again. I think my approach is more “efficient”, though probably doesn’t matter very much in practice…
I went through this entire thread thinking, “there has got to be a more elegant solution than this ‘off’ MQTT message,” and there is. See this thread here and my code reference at the end.
No automation needed. Simply reset after a timeout. So simple.
Yes, you are right, both get job done. My approach is to simulate standard behavior of switch (On / Off) in case any other control system (not only HA) will require visibility of switch status.
It is good example of HA flexibility…number of ways how you can achieve same results
I just received from Banggood a 433MHz learning remote keyfob device, with 4 buttons. It doesn’t seem to have anything useful programmed into it, so I think I’ll need to poke at the sonoff rf bridge to get it to transmit some random codes for the keyfob to learn.
Then, I’ll have another small device to do… well, I’m not sure what at this point! For $8.00, it seemed like something interesting to try.
I had bought a couple of Z-Wave 4-button remotes that have been handy, but they were cheap at the time, I think, because they were very old inventory with LiPo batteries that didn’t hold a charge real well. It wasn’t hard to desolder the old batteries and replace them with some small batteries I found on ebay, but it’s not really a reproducible solution.
I’m hoping that the little 433MHz keyfob will have enough range to work from the car as its sitting outside the house… That might be a fun application for a more immediate action before the WiFi presence thing sniffs that my phone has come home.
this is exactly my user case. Big house many places with little recepotion, and some non critical switches (I don’t care if somebody sniffs my 433 signal)
Just received my sonoff rf bridge and I flashed it with Tasmota. Tried with a PIR sensor and worked at first try!
Now I am trying to fix the transmitting part. I can program the Bridge for up to 16 433 signals correct? Didn’t find a way to put it in learn mode yet, will investigate.
Just to make sure I understood correctly, a way to integrate it with HASS is the following
For receiving signals (PIR, door sensors and so on)
binary_sensor:
- platform: mqtt
name: "Motion sensor"
payload_on: "FFFFF" # the code that you see in the Tasmota log when the sensor is activated
payload_off: "FFFFFoff"
device_class: motion
state_topic: "tele/sonoff_bridge/RESULT"
value_template: '{{ value_json.RfReceived.Data }}' # Data here?
While for the SENDING part, I am a bit more confused. Did I understand correctly the following:
I can use, for example, a 433 Key, put the Bridge in learn mode and associate the number 1 (for example) to that code. So now if I click the number 1 in tasmota interface or click the switch switch.rf_bridge_key_1_pressed
it will send the 433 signal learned. But that signal is also received? I mean if I want to press the 433 remote key 1, the Bridge will RECEIVE that signal (like it does with a PIR sensor activated), correct?
For sending using the memories what you need to do is bring the device you want to control close to the gateway, put that device in learning mode and then press 1 in the sonoff rfbridge. Test it. if it works go to the console and get the code for your switch
You can use the default codes by just pressing the number on the Tasmota webui, if you put the remote key on learning mode it will learn that code.
Or you can make the RF Bridge in learn mode and then press a remote key (that is already programmed) next to the RF Bridge (in this case the default code will be lost)
You put the Sonoff RF Bridge in learn mode writing in console RFkeyx 2 (x can vary from 1 to 16)
For me this is all a kind of new.
I achieved already a lot.
The switches at home are working good but now i am testing with the sonoff bridge with tasmota on it.
What i now want to do os to turn on and off the light what is already working and can be switched on and off by the handy.
I don’t believe i have to create a new switch or not?
Is it a line what needs to be added to this switch so it listen also to the commands from the bridge with the correct data what belongs to the bridge?