node-red-contrib-zigbee2mqtt
node-red-contrib-zigbee2mqtt copied to clipboard
Get node doesn't report all states
Hi
I have deployed a 'get' node on a light to and am using a function node to read and convert the state "OFF" into "on" and vice versa.
When I deploy the flow with the light off, I have found that the 'get' node doesn't return any state. It's not until I switch the light on manually that it then starts to report a state.
Thank you for any assistance you can provide
[
{
"id": "6dbdb5a1effce752",
"type": "zigbee2mqtt-in",
"z": "635e619426fb372a",
"name": "",
"server": "50ac1823712ba896",
"friendly_name": "switch_master_2 (929002398602)",
"device_id": "0x001788010b7bcf05",
"state": "0",
"outputAtStartup": true,
"filterChanges": false,
"enableMultiple": false,
"x": 160,
"y": 320,
"wires": [
[
"f2dbbc379ee99ee5"
]
]
},
{
"id": "f2dbbc379ee99ee5",
"type": "function",
"z": "635e619426fb372a",
"name": "Boolean to string",
"func": "var msgon = { payload: \"on\" };\nvar msgoff = { payload: \"off\" };\n\nif (['on_press', 'off_press', 'toggle'].includes(msg.payload.action)) {\n return [msgon];\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 410,
"y": 280,
"wires": [
[
"e6ea5d575ae2f850"
]
]
},
{
"id": "ddc8eb1f2f951a9b",
"type": "zigbee2mqtt-in",
"z": "635e619426fb372a",
"name": "",
"server": "50ac1823712ba896",
"friendly_name": "switch_master_1 (E1524/E1810)",
"device_id": "0xbc33acfffe1dacda",
"state": "0",
"outputAtStartup": true,
"filterChanges": false,
"enableMultiple": false,
"x": 150,
"y": 260,
"wires": [
[
"f2dbbc379ee99ee5"
]
]
},
{
"id": "e6ea5d575ae2f850",
"type": "zigbee2mqtt-get",
"z": "635e619426fb372a",
"name": "",
"server": "50ac1823712ba896",
"friendly_name": "master_light_1 (LED1736G9)",
"device_id": "0x847127fffe2b0d49",
"state": "0",
"enableMultiple": false,
"x": 640,
"y": 280,
"wires": [
[
"5ed077fe78a97c94"
]
]
},
{
"id": "5ed077fe78a97c94",
"type": "function",
"z": "635e619426fb372a",
"name": "Boolean to string",
"func": "var msgon = { payload: \"on\" };\nvar msgoff = { payload: \"off\" };\n\nswitch (msg.payload.state) {\n case \"OFF\":\n return msgon;\n case \"ON\":\n return msgoff;\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 280,
"wires": [
[
"4bb7cec654147e17"
]
]
},
{
"id": "4bb7cec654147e17",
"type": "debug",
"z": "635e619426fb372a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 360,
"wires": []
},
{
"id": "50ac1823712ba896",
"type": "zigbee2mqtt-server",
"name": "Zigbee2MQTT",
"host": "192.168.1.51",
"mqtt_port": "1883",
"mqtt_username": "",
"mqtt_password": "",
"mqtt_qos": "2",
"tls": "",
"usetls": false,
"base_topic": "zigbee2mqtt"
}
]
Hey mate, probably I have the same kind of issue but with slightly different behavior.
My flow is pretty simple:
And configuration for get nodes target for full payload
However I receiving
null
and node shows ok
However In
node returning full correct payload
What I expecting: get
node should to return last known state for node
Same with me. The payload of the get node is "null" after a deploy of node-red. After a restart of zigbee2mqtt the get node works (until the next deploy).
Same here. I was happy about this project but with this error it is almost useless again. Please fix this...
I can't reproduce it
- Enable Retain option for all devices
- Deploy only modified nodes
- show me info from bridge node
- provide me full z2m config
When you do full deploy, mqtt connection is being destroyed, MQTT re-subscribes, but without retain you don't get the latest values.
I no longer use the nodered integration so feel free to close the issue if you don't think it's a bug 🙂 I left it open in case the others can confirm the retain flag fixes
Hi, this is definitely a bug. I thought I was going insane, till I stumbled across this. So what's even stranger: I have two installations, one at my home (which I use for the last 2 years) and recently a second installation at my brothers home. For some reason in his Node-RED installation I get this exact problem. Once I restart zigbee2mqtt add-on, then the state nodes reports all payload variables. As soon as I hit deploy in Node-RED, everything come backs at null.
This happens ONLY with group devices of z2m. Individual devices work fine. Also I have retain enabled with the devices on the installation that has this bug. But as I said, individual devices report all values, but groups always return null after NR deploy, till next Z2M add-don restart (and then NR deploy wrecks it again).
In my installation, everything works 100% ok, no matter how many times I deploy. Some something is definitely not right. What can I provide to help fixt this matter?
Both installations are running most recent versions: Node-RED 14.0.1, Zigbee2mqtt 1.29.2-1 and node-red-contrib-zigbee2mqtt 2.6.4.`
See in image below, everything comes as null when getting state of a group. Only thing it can report is that is has 2 members.
Is there any update to this? I have 24 Aqara window sensors with retain: true
set and on 2 of those 24 when I change the friendly_name
the payload is null in NodeRed. If I don't change the friendly_name
then the payload is as it should be.
no update, I have no idea Did you try yo restart node-red and zigbee2mqtt?
no update, I have no idea Did you try yo restart node-red and zigbee2mqtt?
Yep, no dice :(
My only thought is maybe there is some stale entries in Mosquitto? But it doesn't make sense because I get the payload when I leave the friendly_name
unchanged.
before name change:
after name change:
Is there some other custom parameter that I can set which could contain a name for the sensor so that my automations report the right name?