Improve 433Mhz reliability Topic is solved

Moderator: leecollings

gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Improve 433Mhz reliability

Post by gerard76 »

I created this script to improve the reliability of my 433Mhz devices. I hate it when Domoticz thinks something is on, while the receiver never got the signal. Whenever a device changes the script sends the same command another 2 times to make sure the receiver gets it. Because the RFXcom also picks up the signal from my remote, those signals are also multiplied and the reliability improved.

You need to create integer uservariables with the same name as your devices, they are used to prevent getting stuck in a loop.

Code: Select all

commandArray = {}
my_devices = {"Lamp in hoek", "Lamp naast bank", "Lamp naast tv", "Lamp naast kachel", "Lamp bij trap", "TV" }

-- loop through the changed devices
for device_name, device_value in pairs(devicechanged) do
    for i, my_device in pairs(my_devices) do
        if device_name == my_device then
            if device_value == "On" and uservariables[device_name] == 0 then
                commandArray['Variable:' .. device_name] = "1"
                commandArray[0]={[device_name]='On'} -- send signal again
                commandArray[1]={[device_name]='On'} -- and again..
            elseif device_value == "Off" and uservariables[device_name] == 1 then
                commandArray['Variable:' .. device_name] = "0"
                commandArray[0]={[device_name]='Off'} -- send signal again
                commandArray[1]={[device_name]='Off'} -- and again..
            end
            return commandArray
        end
    end
end

return commandArray
lvsigo
Posts: 14
Joined: Thursday 24 November 2016 12:14
Target OS: Linux
Domoticz version:
Contact:

Re: Improve 433Mhz reliability

Post by lvsigo »

Hi,

Don't lets us manualy create devices...
Do it in the script

http://easydomoticz.com/forum/viewtopic ... ilit=Twice
User avatar
K3rryBlue
Posts: 77
Joined: Tuesday 07 February 2017 22:13
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10xx
Location: Netherlands
Contact:

Re: Improve 433Mhz reliability

Post by K3rryBlue »

Be carefull, as this will not work well with dimmers.
Sending the on command twice will cause the mayority of dimmers to start the auto dim sequence.
Better sending:

Code: Select all

commandArray[0]={[device_name]='Off'} 
commandArray[0]={[device_name]='On'} -- send signal again
commandArray[1]={[device_name]='Off'} 
commandArray[1]={[device_name]='On'} -- and again..
Domoticz V4.10717, RPi2 -> Linux raspberrypi 4.4.47-v7+ , RFXCOM - RFXtrx433 USB 433.92MHz ,RAZBERRY2 and OpenZWave USB Version: 1.4-2363-g1f10253-dirty
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Improve 433Mhz reliability

Post by zak45 »

User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Improve 433Mhz reliability

Post by Siewert308SW »

Really, using Domo since 2015 and never knew the repeat command.
To be honest... As i searched the chagelog, i think a lot of those added features aren't mentioned in the chagelog and there for unknown to all users.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

Nice. Hadn't seen that in the docs. Much cleaner. I changed the user variables to strings containing 'On' and 'Off'. Also saves a few lines of code.

Code: Select all

commandArray = {}
my_devices = {"Lamp in hoek", "Lamp naast bank", "Lamp naast tv", "Lamp naast kachel", "Lamp bij trap", "TV" }

-- loop through the changed devices
for device_name, device_value in pairs(devicechanged) do
    for i, device in pairs(my_devices) do
        if device_name == device then
            if uservariables[device_name] ~= device_value then
                commandArray['Variable:' .. device_name] = device_value
                commandArray[device_name] = device_value .. ' REPEAT 2 INTERVAL 1'
            end
            return commandArray
        end
    end
end

return commandArray
User avatar
Mediacj
Posts: 74
Joined: Wednesday 11 February 2015 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Improve 433Mhz reliability

Post by Mediacj »

Thanks for sharing it works great!
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

mmm

Scripting is not my thing.. [ to stupid to understand all this epxert stuff. ]
Only will give sometimes the scripts that i think they are usefull a try..
Also like this one..
Have some devices in the grey places of the RFXcom ...
And i will send them 2 or 3 times a 433 command.

Only how is this script activeted? [ crontab? ]
Where to place?
Is there a time setting? [ each minute or? ]
Can i send more then 2 times??
Working for on and off?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

You put it in Domoticz under Setup - More options - Events. Set the pull downs to 'Lua' and the other to 'Device', check the 'activate' mark. Paste the script and change the names to your on/off 433 devices.

You can send more than 2 times, change the 'repeat 2' to 3 or whatever. Remember that 2 means 2 extra times, so 3 total. You have the original signal and then the 2 repeats. I have 5 switchable lights +TV in my living room and the more I repeated the signal the longer it took to turn them all on at once. So pick the lowest number that works for you.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

Ok will give it a try...

Is the last script in this thread for on and of?
The first script they are separated?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

Yes, On and Off.

Do not forget to create the user variables with the same name as your devices under Setup - More Options - User Variables with type string.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

gerard76 wrote:Do not forget to create the user variables with the same name as your devices under Setup - More Options - User Variables with type string.
This part i do not understand,
Please a screendump of the settings :roll:
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

user variables example
user variables example
Screen Shot 2017-04-02 at 21.53.09.png (54.57 KiB) Viewed 5002 times
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

mm
Thanks
Sorry for my dombo questions..
Only why 1 device on and the other off?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
DaWauZ
Posts: 69
Joined: Wednesday 05 November 2014 10:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Improve 433Mhz reliability

Post by DaWauZ »

I dont understand this exactly.
First, I do not have any problems with my rfxcom (-e type) switching things on and off.
Sometimes, I using a remote to put the lights off, and yes, domoticz thinks device is on, but what should this script helps about that?
Is the script triggered by the remote signal, how?
Raspberry Pi 2 model B with domoticz
OMV NAS installed on thin client HP T610
Openelec Kodi Mediaplayer on thin client HP T520 (and with multiboot windows 10)
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

@derik that is just the current state of my lights

@DaWauZ this script helps when domoticz sees the signal from the remote, but the lights do not or if you send signals from domoticz. For example if you have a scene to turn on all lights, but sometimes 1 light will not turn on because it missed the signal.This script fixes that.

In your case I would suggest bringing the RFXcom closer to where you use the remote.
DaWauZ
Posts: 69
Joined: Wednesday 05 November 2014 10:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Improve 433Mhz reliability

Post by DaWauZ »

The only problem with my remote, is not the distance but a kaku hotel switching. I using 2 senders behind wall switch, and also domoticz to put that light automatically on. I also have a hand remote for that same light.
I think I used the remote signal for domoticz, but not the 2 of the wall switches.
Raspberry Pi 2 model B with domoticz
OMV NAS installed on thin client HP T610
Openelec Kodi Mediaplayer on thin client HP T520 (and with multiboot windows 10)
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

Did set a string..
Only what do i need to fill in by value:
ScreenShot210.jpg
ScreenShot210.jpg (55.45 KiB) Viewed 4950 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
gerard76
Posts: 53
Joined: Wednesday 22 March 2017 9:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Contact:

Re: Improve 433Mhz reliability

Post by gerard76 »

Doesn't really matter. The program will fill it out after the first time you switch.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Improve 433Mhz reliability

Post by Derik »

mm
Got an error:

Code: Select all

2017-04-03 19:48:00.876 Error: EventSystem: in Lua: Extra Schakeling Aan: [string "commandArray = {}..."]:5: bad argument #1 to 'pairs' (table expected, got nil)
This is my setting:
ScreenShot211.jpg
ScreenShot211.jpg (58.79 KiB) Viewed 4861 times
And:
ScreenShot212.jpg
ScreenShot212.jpg (86.01 KiB) Viewed 4861 times
Looks there is something wrong
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest