Strona główna / Społeczność / Blog / Domoticz, Mosquito, Node-RED, RF Bridge and 433MHz switch

Domoticz, Mosquito, Node-RED, RF Bridge and 433MHz switch

How to switch light using 3 channels 433MHz switch. It's very simple:

1 RF signal

My 3 button 433MHz switch sends 3 codes:

  • 672BE2- left button
  • 672BE8 - center button
  • 672BE4 - right button

2 MQTT publish

I set up RF Bridge to send MQTT messages like this (center button):

{
  "RfReceived" : {
    "Sync" : 7840,
    "Low" : 250,
    "High" : 780,
    "Data" : "672BE8",
    "RfKey" : "None"
  }
}

to topic:

tele/DVES_B2EFB9/RESULT

Domoticz needs to get mesage with topic:

domoticz/in

with payload like this:

{
  "idx" : 22,
  "command" : "switchlight",
  "switchcmd" : "Toggle"
}

We need to translate:

3, 4 and 5 message translation

Mosquitto and Node-RED are deployed using Docker on same machine:

docker run -it -p 1883:1883 -p 9001:9001 --name mosquitto \
-v mosquitto:/mosquitto/config -v mosquitto:/mosquitto/data \
-v mosquitto:/mosquitto/log eclipse-mosquitto

docker run -d -p 1880:1880 --restart=always  \
--log-opt max-size=10m --log-opt max-file=5 \
-v node-red-data:/data --name nodered \
--link mosquitto:broker nodered/node-red-docker:slim

You can see that I've link mosquitto container as broker.

The switch node splits messages depending on msg.payload.RfReceived.Data, and change node set properties (idx, command and switchcmd)

Here you have complete Node-RED code.

Finally Domoticz tuns the light!

Of course you have to have set up Domoticz first.

Komentarze

Log in or create a user account to comment.

Ten kto umie pisze kod, ten kto nie umie pisze książki..., albo blog.

Pon Wt Śr Czw Pt So N
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30