Home Assistant and 433 Dimmers

Last Updated or created 2022-11-17

Getting 433Mhz dimmers working under HA is a pain in the *ss.

After moving my Rfxcom from domoticz to HA, there was still no good way to add dimmers.
I’ve tried adding switches and migrating them to lights, but it didn’t work.

So i took another approach.

Domoticz has a good 433 to mqtt plugin. So i used NodeRed to talk to HA and Domoticz via MQTT.

Rfxcom 433Mhz

Domoticz

MQTT gateway setup

Home Assistant

/config/configuration.yaml

light:    
  - platform: mqtt
    name: "KitchenOutside"
    payload_on: "99"
    payload_off: "0"
    unique_id: "KitchenOutside"
    brightness_scale: "99"
    brightness_state_topic: ha433/kitchenoutside/brightcontrol
    brightness_command_topic: ha433/kitchenoutside/brightcontrol
    state_topic: ha433/kitchenoutside/brightcontrol
    command_topic: ha433/kitchenoutside/control
    optimistic: false
    on_command_type: brightness
  - platform: mqtt
    name: "Living5Spots"
    payload_on: "30"
    payload_off: "0"
    unique_id: "Living5Spots"
    brightness_scale: "30"
    brightness_state_topic: ha433/Living5Spots/brightcontrol
    brightness_command_topic: ha433/Living5Spots/brightcontrol
    state_topic: ha433/Living5Spots/brightcontrol
    command_topic: ha433/Living5Spots/control
    optimistic: false
    on_command_type: brightness

Node Red

Flow

Node-RED Deploy
Search flows
Node	
"d4aab6722750908c"
Type	function
show more 
Export nodes
Export
[
    {
        "id": "31dba0859e04acb4",
        "type": "mqtt in",
        "z": "a49c5bcd66c12a46",
        "name": "",
        "topic": "ha433/kitchenoutside/brightcontrol",
        "qos": "2",
        "datatype": "auto",
        "broker": "8c74c5f6.9a7a48",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 330,
        "y": 160,
        "wires": [
            [
                "e2501f2b6e2ab43d"
            ]
        ]
    },
    {
        "id": "e2501f2b6e2ab43d",
        "type": "function",
        "z": "a49c5bcd66c12a46",
        "name": "Dimmer function",
        "func": "var idx = 9735;\nvar bright = msg.payload;\nmsg.payload = {};\nmsg.payload = {\"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Set Level\", \"level\": bright};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 690,
        "y": 160,
        "wires": [
            [
                "5f0314b0950d24c0"
            ]
        ]
    },
    {
        "id": "5f0314b0950d24c0",
        "type": "mqtt out",
        "z": "a49c5bcd66c12a46",
        "name": "",
        "topic": "domoticz2/in",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "8c74c5f6.9a7a48",
        "x": 970,
        "y": 160,
        "wires": []
    },
    {
        "id": "95eb4d0ed97fdefb",
        "type": "mqtt in",
        "z": "a49c5bcd66c12a46",
        "name": "",
        "topic": "ha433/kitchenoutside/control",
        "qos": "2",
        "datatype": "auto",
        "broker": "8c74c5f6.9a7a48",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 320,
        "y": 220,
        "wires": [
            [
                "d4aab6722750908c"
            ]
        ]
    },
    {
        "id": "d4aab6722750908c",
        "type": "function",
        "z": "a49c5bcd66c12a46",
        "name": "Off function",
        "func": "var idx = 9735;\nvar bright = 0;\nmsg.payload = {};\nmsg.payload = {\"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Set Level\", \"level\": bright};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 220,
        "wires": [
            [
                "5f0314b0950d24c0"
            ]
        ]
    },
    {
        "id": "8c74c5f6.9a7a48",
        "type": "mqtt-broker",
        "name": "mqttserver",
        "broker": "mqttserver",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "15",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
Mqtt Broker output

So …. this works, and i have now a generic mqtt “router”

Update: Below works now

Spread the love