Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save esbenr/a3321e31e8576e413f5031a163f557a1 to your computer and use it in GitHub Desktop.
Save esbenr/a3321e31e8576e413f5031a163f557a1 to your computer and use it in GitHub Desktop.
Zigbee2MQTT smooth dimming in Node-Red
[
{
"id": "c0a0e0.ae6cbf2",
"type": "subflow",
"name": "Zigbee2MQTT dim & toggle",
"info": "",
"category": "",
"in": [
{
"x": 480,
"y": 340,
"wires": [
{
"id": "821795d7.433b58"
}
]
}
],
"out": [],
"env": [
{
"name": "topic",
"type": "str",
"value": ""
}
],
"color": "#DDAA99"
},
{
"id": "94df66c8.23c748",
"type": "switch",
"z": "c0a0e0.ae6cbf2",
"name": "Direction",
"property": "direction",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "up",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 820,
"y": 220,
"wires": [
[
"488569b9.ed45a8"
],
[
"be09eac4.e90d18"
]
]
},
{
"id": "488569b9.ed45a8",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "Set direction down",
"rules": [
{
"t": "set",
"p": "direction",
"pt": "flow",
"to": "down",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1040,
"y": 180,
"wires": [
[
"de7aef74.e638b"
]
]
},
{
"id": "be09eac4.e90d18",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "Set direction up",
"rules": [
{
"t": "set",
"p": "direction",
"pt": "flow",
"to": "up",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1030,
"y": 260,
"wires": [
[
"32ce8567.49120a"
]
]
},
{
"id": "da116e59.611b2",
"type": "mqtt out",
"z": "c0a0e0.ae6cbf2",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "d51b5899.a2d5d8",
"x": 1520,
"y": 180,
"wires": []
},
{
"id": "de7aef74.e638b",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "MQTT message UP",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "topic",
"tot": "env"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"brightness_move\": 70}",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1280,
"y": 180,
"wires": [
[
"da116e59.611b2"
]
]
},
{
"id": "5f89dab8.652954",
"type": "mqtt out",
"z": "c0a0e0.ae6cbf2",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "d51b5899.a2d5d8",
"x": 1520,
"y": 260,
"wires": []
},
{
"id": "32ce8567.49120a",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "MQTT message DOWN",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "topic",
"tot": "env"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"brightness_move\": -70}",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1300,
"y": 260,
"wires": [
[
"5f89dab8.652954"
]
]
},
{
"id": "bad6cfaf.6876d",
"type": "mqtt out",
"z": "c0a0e0.ae6cbf2",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "d51b5899.a2d5d8",
"x": 1090,
"y": 340,
"wires": []
},
{
"id": "370e7b7e.f5dca4",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "MQTT message STOP",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "topic",
"tot": "env"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"brightness_move\": 0}",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 860,
"y": 340,
"wires": [
[
"bad6cfaf.6876d"
]
]
},
{
"id": "96ea6236.ce35a",
"type": "mqtt out",
"z": "c0a0e0.ae6cbf2",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"broker": "d51b5899.a2d5d8",
"x": 1090,
"y": 460,
"wires": []
},
{
"id": "7e1107c0.6c8b38",
"type": "change",
"z": "c0a0e0.ae6cbf2",
"name": "MQTT message TOGGLE",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "topic",
"tot": "env"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"state\": \"TOGGLE\"}",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 870,
"y": 460,
"wires": [
[
"96ea6236.ce35a"
]
]
},
{
"id": "821795d7.433b58",
"type": "switch",
"z": "c0a0e0.ae6cbf2",
"name": "Action",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "dim",
"vt": "str"
},
{
"t": "eq",
"v": "stop",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 630,
"y": 340,
"wires": [
[
"94df66c8.23c748"
],
[
"370e7b7e.f5dca4"
],
[
"7e1107c0.6c8b38"
]
]
},
{
"id": "d51b5899.a2d5d8",
"type": "mqtt-broker",
"name": "Mosquto Broker",
"broker": "192.168.1.6",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment