Python Plugin: 433 RF Switches

Python and python framework

Moderator: leecollings

Post Reply
blauwebuis
Posts: 331
Joined: Wednesday 21 December 2016 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Contact:

Python Plugin: 433 RF Switches

Post by blauwebuis »

This plugin allows you to clone 433 radio signals. Just connect a cheap 433 receiver and transmitter directly to your Raspberry Pi's pins.

This works great with cheap remote controlled power switches. These use very predictable signals that are always the same. This plugin can copy the signals form your remote control, and then transmit them when you use switches in Domoticz.

If you only use your RFXCom or RFLink to switch this type of device, then this plugin (and 1 euro worth of hardware) may be all you need.

Detailed installation and usage instruction can be found on the wiki:
https://www.domoticz.com/wiki/Plugins/RFSwitches
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python Plugin: 433 RF Switches

Post by jake »

Cool, could I use it to control my somfy sunscreen with?
blauwebuis
Posts: 331
Joined: Wednesday 21 December 2016 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Contact:

Re: Python Plugin: 433 RF Switches

Post by blauwebuis »

I don't know. Try it? I uploaded a new version that should actually work for everyone now :-)

If the signals form your somfy remote don't have some kind of 'rolling code' (a security feature), then it will work. The plugin basically just copies signals, and replays them on command.
gerardwr
Posts: 32
Joined: Saturday 28 January 2017 11:30
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by gerardwr »

Somfy uses a rolling code, So this Will not work.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python Plugin: 433 RF Switches

Post by jake »

gerardwr wrote:Somfy uses a rolling code, So this Will not work.
I just orderd a RF set the other day. Too bad, but I'll find other use for it someday!
User avatar
DeBaat
Posts: 33
Joined: Saturday 27 January 2018 14:52
Target OS: NAS (Synology & others)
Domoticz version: V3.8153
Contact:

Re: Python Plugin: 433 RF Switches

Post by DeBaat »

gerardwr wrote: Friday 26 January 2018 22:09 Somfy uses a rolling code, So this Will not work.
Do you have any other suggestion then on how to control these Somfy motors?
gerardwr
Posts: 32
Joined: Saturday 28 January 2017 11:30
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by gerardwr »

DeBaat wrote: Sunday 11 February 2018 12:37
Do you have any other suggestion then on how to control these Somfy motors?

I have seen various projects on Google controlling a Somfy RF remote with an Arduino.

And You can control Somfy with specific code for Arduino or Raspberry and a 433Mhz transmitter, have a look on Github.

Have a look here for an extensive description of the Somfy rolling code protocol:
https://pushstack.wordpress.com/somfy-rts-protocol/
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python Plugin: 433 RF Switches

Post by jake »

I ordered the 433Mhz boards from AliExpress as mentioned above, before I saw that Somfy isn't the standard 433Mhz thing. My wife found it rather strange that I didn't even open the envelope 'all the way from China', because I have no need for it at the moment.

Although I just discovered AliExpress, it sometimes doesn't feel right, that I can order parts for 0,63 Euro and have it sent across the world. At arrival I put it aside for a 'who knows when' project. However, paying 10 euro's more, would have the same end of story, but would have hurt my wallet and propbably would only make an 'intermediate' rich.

Hopefully the board still can be used someday for the Somfy project.
iamvic
Posts: 1
Joined: Thursday 15 March 2018 10:34
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by iamvic »

Hi, I managed to follow your instructions :D and now I have a couple of switches working, but my question is about time, Is it possible to vary the amount of time when that switch is triggered? In my case is a blind, I have two switches (up and down).
supermat
Posts: 14
Joined: Thursday 07 April 2016 18:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by supermat »

For Somfy you can use RFLink.
I was made a tuto many years ago. You need an arduino and a transeiver 433,42Mhz (Not the standard 433,92Mhz)
https://matdomotique.wordpress.com/2016 ... -et-somfy/

Since this time it's work very well in my home.
mmmmm
Posts: 2
Joined: Sunday 02 September 2018 15:26
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by mmmmm »

Is it possible (using RFswitches) to use a single 433MHz button https://www.google.pl/search?q=433mhz+b ... rgGoRxI5M: as a toogle switch in DOMOTICZ?

This button sends a fixed 7 digit code when pressed.
Id like to have a control over kodi player e.g. when button pressed play next track.
yo3hjv
Posts: 6
Joined: Monday 11 February 2019 0:21
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by yo3hjv »

Hello guys.
I have a similar (somehow) problem with RFSwitches)...
I cannot find a way to send a command from RF remote unit TO Domoticz. EX: I want to light a bulb when I pressed a button on the RF 433 remote.

The hardware is OK, made with a cheap 433 Rx and Tx (FS100A, like THIS https://www.instructables.com/id/RF-315 ... -and-Ardu/).
I followed the instructions here: https://www.domoticz.com/wiki/Plugins/RFSwitches

I do have a Switch on the Dashboard and the RF remote is "learned" a.k.a Domoticz transmitt valid code to the receiving unit everytime a push the dashboard button.

BUT, i want to receive the command send by RF remote and have Domoticz send a command to a EspEasy unit to do something.

First of all, is this possible?
Second, how can I made this?

Thank you!

Adrian
blauwebuis
Posts: 331
Joined: Wednesday 21 December 2016 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: current
Contact:

Re: Python Plugin: 433 RF Switches

Post by blauwebuis »

Unfortunately 433 RF Switches can only learn and then send codes. It cannot detect them.

If you are using MySensors, then you might be interested in this project:
https://github.com/createcandle/Devices ... Signal-hub
eugene5
Posts: 1
Joined: Tuesday 12 November 2019 6:17
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by eugene5 »

Hey.
Can someone make an implementation for Domoticz to display rf433 signals from switches in real time?
Ready to pay.
roslobetjes
Posts: 1
Joined: Tuesday 12 November 2019 23:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: 433 RF Switches

Post by roslobetjes »

Hi all,

I'm trying to add some Flamingo SF-501P switches to Domoticz on my Raspberry Pi. I already tried RFSniffer (doesn't recognize the protocol of the transmitter) and multiple versions of the scripts from https://weejewel.tweakblogs.net/blog/86 ... ry-pi.html by trying to learn the switch a chosen channel/address.

Since this also didn't work out for me I tried this plugin. I succeeded in adding a switch, but when I turn it on for the first time I get the following error once.

Code: Select all

2019-11-12 23:09:36.274 Status: dzVents: Error (2.4.19): Discarding device. No last update info found: {["batteryLevel"]=0, ["signalLevel"]=0, ["name"]="RFSwitches - New RF switch #2", ["switchType"]="On/Off", ["data"]={["maxDimLevel"]=100, ["icon"]="lightbulb", ["hardwareID"]=0, ["_nValue"]=1, ["usedByCamera"]=false, ["protected"]=false, ["levelVal"]=0, ["unit"]=2, ["hardwareType"]="RFSwitches", ["_state"]="On", ["hardwareTypeValue"]=94, ["hardwareName"]="RFSwitches"}, ["switchTypeValue"]=0, ["subType"]="Switch", ["changed"]=true, ["lastUpdate"]="", ["deviceType"]="Light/Switch", ["description"]="", ["rawData"]={"On"}, ["deviceID"]="", ["timedOut"]=false, ["baseType"]="device", ["id"]=32, ["lastLevel"]=255}
Piscope shows no data transmitted or received. Transmitter and receiver work fine with another type of 433MHz switches. Is there anyone who knows how to prevent this error?
tarmacalastair
Posts: 95
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Does this plugin still work?

Post by tarmacalastair »

Well I was excited to find this plugin but I just can't get it to work.

I've bought the hardware from Ebay and it looks just like the two items in the picture. I've followed the wiki which is a bit vague (tells you to create the directory with sudo but then use wget without sudo which then fails because of permissions) so I've tried creating the directory and files both as root and as my normal pi user.

In both cases, the plugin shows up in Domoticz (I called it rf) and creates a "rf Learn 433 switch". Then if I follow the instructions the plugin creates a new switch but nothing hppens when I activate it in Domoticz.
I have tried the stable and latest beta of Domoticz. In all cases nothing happens with the hardware and this is reported in the log on creating the switch:

Code: Select all

2022-05-05 08:33:09.731 rf: onCommand called for Unit 1: Parameter 'On', Level: 0
2022-05-05 08:33:09.745 rf: sudo /bin/python3 /home/pi/domoticz/plugins/RFSwitches/433cloner.py --txpin 17 --rxpin 27 record 2On
2022-05-05 08:33:09.688 Status: User: Admin (IP: 192.168.0.x) initiated a switch command (1/rf - Learn 433 switch/On)
2022-05-05 08:33:26.880 rf: onCommand called for Unit 1: Parameter 'Off', Level: 0
2022-05-05 08:33:26.895 rf: New RF Switch created, #2
2022-05-05 08:33:26.895 rf: sudo /bin/python3 /home/pi/domoticz/plugins/RFSwitches/433cloner.py --txpin 17 --rxpin 27 record 2Off
2022-05-05 08:33:26.867 Status: User: Admin (IP: 192.168.0.x) initiated a switch command (1/rf - Learn 433 switch/Off) 
But then, when I activate the new switch, nothing happens with the physical switch and this appears in the log:

Code: Select all

 2022-05-05 09:25:30.588 rf: onCommand called for Unit 2: Parameter 'On', Level: 0
2022-05-05 09:25:30.607 rf: sudo /bin/python3 /home/pi/domoticz/plugins/RFSwitches/433cloner.py --txpin 17 --rxpin 27 play 2On
2022-05-05 09:25:30.565 Status: User: Admin (IP: 192.168.0.x) initiated a switch command (2/rf - New RF switch #2/On)
I looked at the command above and tried issuing it directly in the terminal and here is the result:

Code: Select all

sudo /bin/python3 /home/pi/domoticz/plugins/RFSwitches/433cloner.py --txpin 17 --rxpin 27 play 2On
preparing..
Traceback (most recent call last):
  File "/usr/lib/python3.7/shelve.py", line 111, in __getitem__
    value = self.cache[key]
KeyError: '2On'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/domoticz/plugins/RFSwitches/433cloner.py", line 455, in <module>
    main()	
  File "/home/pi/domoticz/plugins/RFSwitches/433cloner.py", line 449, in main
    args.func(args, database)
  File "/home/pi/domoticz/plugins/RFSwitches/433cloner.py", line 378, in play
    code = int(database[recording][0])
  File "/usr/lib/python3.7/shelve.py", line 113, in __getitem__
    f = BytesIO(self.dict[key.encode(self.keyencoding)])
KeyError: b'2On'
I am using a cheap remote control wall plug which works fine with its own remote and also works fine with my RFXtrx433 USB dongle in Domoticz on a different Pi.
I've imaged a fresh Raspberry Pi OS from the beginning and I am using a new Pi4 so there should be no clashes with my existing Domoticz. I initially tried the latest Raspbian 32 bit (Bullseye) but then read the note at https://www.domoticz.com/wiki/Raspberry_Pi so I am now trying the legacy (Buster) version. I get the same issues with both versions of OS and with both stable and beta of Domoticz.

I am all the more confused because the wiki says the receiver needs 3.3V and transmitter 5V but the Instructable posted here says the opposite and the Ebay product page seems to suggest 5V for the receiver and 3.5V- 12V for the transmitter.

Does anyone have any ideas please? I am so confused and my electronics knowledge is minimal. (The larger of the 2 modules is the receiver, isn't it? Again, not overly clear from any of the documents or diagram)

Many thanks.
Running Domoticz and Dashticz beta on Raspberry Pi OS 32 bit - has anyone had success with 64 bit?

Desktop access from Ubuntu Linux
diech
Posts: 3
Joined: Wednesday 30 November 2022 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Contact:

Re: Python Plugin: 433 RF Switches

Post by diech »

As if anyone needs a solution. I've been playing RF switch recently and just ran into a problem that Domoticz RFswitch doesn't work. Why? :evil: . It was only the blauwebuis post that enlightened me that Domoticz only copies remote controls and can send the code - It's not listening to the RF band all the time. Solution. Tasmota on ESP8266 with an RF receiver :D - listens to the RF band all the time - after receiving the Rule - MQTT code and switches what you wish. It works with both the switch and domoticz. Of course, only for signal reception. Broadcasting as previously stated.
tarmacalastair
Posts: 95
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Python Plugin: 433 RF Switches

Post by tarmacalastair »

Thanks for this suggestion, dietch.

I've just done a web search for Tasmota on ESP8266 with an RF receiver and got an awful lot of results. Is there a definitive guide that you've used for setting this up?

Many thanks
Running Domoticz and Dashticz beta on Raspberry Pi OS 32 bit - has anyone had success with 64 bit?

Desktop access from Ubuntu Linux
diech
Posts: 3
Joined: Wednesday 30 November 2022 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Contact:

Re: Python Plugin: 433 RF Switches

Post by diech »

HI,
I used Tasmota Sensors - I connected the RF receiver to GPIO0. To send data to Domoticz, I use Rules in Tasmot after MQTT.

Rule1
ON RfReceived#Data=0xadress_RF_transmitter DO publish domoticz/in {"command": "switchlight", "idx": idx_Domoticz, "switchcmd": "Toggle" } ENDON
rule1 1
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest