TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Moderator: leecollings

Post Reply
omega001
Posts: 2
Joined: Saturday 09 March 2019 13:29
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by omega001 »

Hello everybody,
here is my little big tutorial for using remote controllers in Domoticz with blockly function on Synology NAS:
You will need:
433 remote
Sonoff RF bridge
Synology NAS with Domoticz and Mosquitto

At first flash Sonoff RF bridge to tasmota, tutorial is here:

At next you need to prepare Domoticz
Create new dummy device - Usage electric ( because this can read and work with svalue), my name is Sonoff rf elektro
Note IDX number ( my is 25)
Now log in to your RF bridge
Get Settings, Settings MQTT
Get settings, settings, settings Domoticz and fill everywhere idx number
Now you can close RF bridge interface, and go back to Domoticz

Go to Setup , Log
Press button or remote controller ( or door sensor,Pir sensor etc.) and you will see something as this :
svalue.JPG
svalue.JPG (12.67 KiB) Viewed 14131 times
You will see here svalue, in my case is it 12205396.
So now you can get to Setup, More options,Events , and make new blockly scheme [/br]
blockly.JPG
blockly.JPG (16.73 KiB) Viewed 14131 times
Important : Every button has unique svalue, so you need to read every unique svalue by pressing button and then use it for example in blockly.

Enjoy ! :-)
extranet
Posts: 1
Joined: Monday 01 January 2018 19:39
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by extranet »

Hi omega001,

Thanks for your tutorial. This works like a charm.
Have 3 door sensors now sending snapshot of all outside camera's as soon as one of the doors open.

Greetings ;)
erasor2010
Posts: 5
Joined: Thursday 22 August 2019 10:06
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by erasor2010 »

Hi,I tried something similar with 433MhZ Switches for Wall Mounting. But I ran in too a problem. When I Push a Putton on the Switch the Blockly goes in a loop and the Lamp goes on and off. Is there A mistake in my Blockly?
Attachments
lock.png
lock.png (125.38 KiB) Viewed 12421 times
dozen
Posts: 11
Joined: Sunday 28 May 2017 21:06
Target OS: Windows
Domoticz version:
Contact:

Re: TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by dozen »

Have the Same Problem,
Wanted to use every Button as a Toggle switch, but doesn´t work......
aardwolf2
Posts: 12
Joined: Wednesday 16 October 2013 1:01
Target OS: Linux
Domoticz version:
Contact:

Re: TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by aardwolf2 »

A little late to the party, but having just sorted this myself thought I would put the information somewhere, this looked ideal, even though the title is Blockly, and my solution uses dzvents, but I used this thread to get the data coming into domoticz, then butchered some dzvents code to get it working in my setup.

This is for a three way sonoff rf touch switch via a sonoff RF hub but I see no reason why the elseifs can't be extended for every RF transmitter you want to use via the hub, or cut out if you only have one switch. I am not impressed by touch switches, there is no way of feeling for the switches in the dark and they are not very sensitive to touch, I think the front panel is too thick on the sonoff switches as the switches themselves are fine with the front panel off. Single switches are probably a lot better for this, three way, not so much. The hub also takes a while to report a switch press, probaly half a second or so, noticably slower than an RfxTrx433.

I tried setting the dz.devices as local variables to make the code more readable and two of the three switches refused to work, the elseif statement was parsed but the toggle command was not sent, removed the variables and it works fine hence the comments so I know which code is operating which bulb, no idea why it didn't work as I use local variables in other code and it works fine, I am not a programmer so I'm probably missing something simple, I also prefer using idx numbers instead of names as I have had this break in the past, can't remember why though.

The following stuff will need changing to match yours actual values: devices = { 123 } is the idx of the fake electricity meter that the hub sends the rf codes to, 1385128, 1385124, 1385122 are the actual RF codes the switch sends, if you log into the rf hub you can see these on the console window when operating a switch if you are looking for an easy way to get them as they don't get reported in the Domoticz log normally. 100, 200 and 300 represent the idx for each device that we want to switch, change all of these to match your values.

Code: Select all

return {
    on = { devices = { 123 } },
    
    execute = function(dz, bridge) 

--switch 1 sends code 1385128 if we receive that toggle bulb 1 that has idx of 100

        if bridge.actualWatt == 1385128 then
            dz.devices(100).toggleSwitch()
            
--switch 2  sends code 1385124 if we receive that  toggle bulb 2 that has idx of 200

        elseif bridge.actualWatt == 1385124 then
            dz.devices(200).toggleSwitch()
            
 --switch 3 sends code 1385122 if we receive that  toggle bulb 3 that has idx of 300
 
         elseif bridge.actualWatt == 1385122 then
            dz.devices(300).toggleSwitch()
            
        end
        
    end
}
newpond
Posts: 26
Joined: Sunday 26 September 2021 2:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: TUTORIAL 433 remote -> Sonoff RF bridge (tasmota) -> Domoticz over MQTT -> Blockly

Post by newpond »

to stop the looping, set the son off bridge to reset the value after 1 sec and then when you set the lamp to on, delay this by one sec by doing a set after one second logic.
other wise your second statement will see the light is on and hence keep bouncing it back and forward!!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests