Can anyone explain why one works the other does not?

New to NR so probably doing something really stupid but I cannot figure how this does not work

PNG image1
and this one does
PNG image

The ONLY difference is the Change Node Off is connected through the node junction - does not work, then i connect the Change Node Off direct to the zigbee2MQTT node.

The on works as sent through each of the Night/Morning/Day/Evening/ going through the Node Junction

Non working version here

[
    {
        "id": "73c4ead62a042bb9",
        "type": "zigbee2mqtt-in",
        "z": "b9176636afd7ca52",
        "name": "Bathroom Motion",
        "server": "4bfcdb26f306e280",
        "friendly_name": "Motion/Bathroom (9290012607)",
        "device_id": "0x001788010213781f",
        "state": "occupancy",
        "outputAtStartup": true,
        "filterChanges": true,
        "enableMultiple": false,
        "x": 280,
        "y": 2360,
        "wires": [
            [
                "89cbbcb9c1e4a033"
            ]
        ]
    },
    {
        "id": "89cbbcb9c1e4a033",
        "type": "switch",
        "z": "b9176636afd7ca52",
        "name": "Occupancy",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 510,
        "y": 2360,
        "wires": [
            [
                "22e20d454b1dd943"
            ],
            [
                "1147be957eea3bbf"
            ]
        ]
    },
    {
        "id": "22e20d454b1dd943",
        "type": "switch",
        "z": "b9176636afd7ca52",
        "name": "Mode",
        "property": "currentMode",
        "propertyType": "global",
        "rules": [
            {
                "t": "neq",
                "v": "Night",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Morning",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Day",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Evening",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 4,
        "x": 750,
        "y": 2340,
        "wires": [
            [
                "41cad52aba79cc1f"
            ],
            [
                "dbf19e2917785c14"
            ],
            [
                "e84a25d000e5c3dd",
                "06c372875134d2b4"
            ],
            [
                "57a65a1d22449d14"
            ]
        ]
    },
    {
        "id": "1147be957eea3bbf",
        "type": "change",
        "z": "b9176636afd7ca52",
        "name": "Off",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "OFF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 2460,
        "wires": [
            [
                "16c7cd3823939a36"
            ]
        ]
    },
    {
        "id": "41cad52aba79cc1f",
        "type": "change",
        "z": "b9176636afd7ca52",
        "name": "Night ",
        "rules": [
            {
                "t": "set",
                "p": "brightness",
                "pt": "flow",
                "to": "30.31",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "color_temp",
                "pt": "flow",
                "to": "454",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "on",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 2300,
        "wires": [
            [
                "ec2f357db25a1b68"
            ]
        ]
    },
    {
        "id": "dbf19e2917785c14",
        "type": "change",
        "z": "b9176636afd7ca52",
        "name": "Morning",
        "rules": [
            {
                "t": "set",
                "p": "brightness",
                "pt": "flow",
                "to": "254",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "color_temp",
                "pt": "flow",
                "to": "153",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "on",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 980,
        "y": 2340,
        "wires": [
            [
                "ec2f357db25a1b68"
            ]
        ]
    },
    {
        "id": "e84a25d000e5c3dd",
        "type": "change",
        "z": "b9176636afd7ca52",
        "name": "Day",
        "rules": [
            {
                "t": "set",
                "p": "brightness",
                "pt": "flow",
                "to": "254",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "color_temp",
                "pt": "flow",
                "to": "370",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "on",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 2380,
        "wires": [
            [
                "ec2f357db25a1b68"
            ]
        ]
    },
    {
        "id": "57a65a1d22449d14",
        "type": "change",
        "z": "b9176636afd7ca52",
        "name": "Evening",
        "rules": [
            {
                "t": "set",
                "p": "brightness",
                "pt": "flow",
                "to": "254",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "color_temp",
                "pt": "flow",
                "to": "454",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "on",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 980,
        "y": 2420,
        "wires": [
            [
                "ec2f357db25a1b68"
            ]
        ]
    },
    {
        "id": "06c372875134d2b4",
        "type": "debug",
        "z": "b9176636afd7ca52",
        "name": "Day",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 2260,
        "wires": []
    },
    {
        "id": "ad243240022015b7",
        "type": "inject",
        "z": "b9176636afd7ca52",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 940,
        "y": 2520,
        "wires": [
            [
                "1147be957eea3bbf"
            ]
        ]
    },
    {
        "id": "16c7cd3823939a36",
        "type": "zigbee2mqtt-out",
        "z": "b9176636afd7ca52",
        "name": "",
        "server": "4bfcdb26f306e280",
        "friendly_name": "Office/Desk Light (433714)",
        "device_id": "0x0017880100da2c9c",
        "command": "state",
        "commandType": "z2m_cmd",
        "payload": "payload",
        "payloadType": "msg",
        "optionsValue": "",
        "optionsType": "nothing",
        "x": 1300,
        "y": 2260,
        "wires": []
    },
    {
        "id": "ec2f357db25a1b68",
        "type": "junction",
        "z": "b9176636afd7ca52",
        "x": 1120,
        "y": 2360,
        "wires": [
            [
                "16c7cd3823939a36",
                "399193e1102e95e2",
                "230d5e0c00ea3e3c",
                "3d0009793913ebe7"
            ]
        ]
    },
    {
        "id": "44107fcd4e7180ab",
        "type": "inject",
        "z": "b9176636afd7ca52",
        "name": "Off",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "x": 1110,
        "y": 2220,
        "wires": [
            [
                "16c7cd3823939a36"
            ]
        ]
    },
    {
        "id": "f1e7e7aacc7da4e2",
        "type": "inject",
        "z": "b9176636afd7ca52",
        "name": "On",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "on",
        "payloadType": "str",
        "x": 1110,
        "y": 2160,
        "wires": [
            [
                "16c7cd3823939a36"
            ]
        ]
    },
    {
        "id": "399193e1102e95e2",
        "type": "zigbee2mqtt-out",
        "z": "b9176636afd7ca52",
        "name": "",
        "server": "4bfcdb26f306e280",
        "friendly_name": "Office/Desk Light (433714)",
        "device_id": "0x0017880100da2c9c",
        "command": "brightness",
        "commandType": "z2m_cmd",
        "payload": "brightness",
        "payloadType": "flow",
        "optionsValue": "",
        "optionsType": "nothing",
        "x": 1300,
        "y": 2360,
        "wires": []
    },
    {
        "id": "230d5e0c00ea3e3c",
        "type": "zigbee2mqtt-out",
        "z": "b9176636afd7ca52",
        "name": "",
        "server": "4bfcdb26f306e280",
        "friendly_name": "Office/Desk Light (433714)",
        "device_id": "0x0017880100da2c9c",
        "command": "color_temp",
        "commandType": "z2m_cmd",
        "payload": "color_temp",
        "payloadType": "flow",
        "optionsValue": "",
        "optionsType": "nothing",
        "x": 1300,
        "y": 2440,
        "wires": []
    },
    {
        "id": "3d0009793913ebe7",
        "type": "debug",
        "z": "b9176636afd7ca52",
        "name": "false",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1150,
        "y": 2540,
        "wires": []
    },
    {
        "id": "4bfcdb26f306e280",
        "type": "zigbee2mqtt-server",
        "name": "x",
        "host": "x",
        "mqtt_port": "1883",
        "mqtt_username": "x",
        "mqtt_password": "x",
        "mqtt_qos": "1",
        "tls": "",
        "usetls": false,
        "base_topic": "zigbee2mqtt"
    }
]

The 'on' is lowercase but the 'OFF' is capitalized. Could that be the issue?
Or is the fact that when a msg goes thru the junction, it sends out three mqtt msgs for both on and OFF.
It could be that one of the 'brightness' or 'color_temP- is over riding the OFF

Unable to test, but If you connect off/false through the junction, and as you use context rather than in flow msg to set color and brightness. Then if the out nodes are triggered for color and brightness, due to the off being connected to junction, they still pick up context values. This may result in setting brightness, which may result in the off being overridden.

I'm not sure the above answers are clear so let me paraphrase...

In the top example the off message is being sent to allI of the z2m nodes because they are all connected to the same junction.

In the bottom example the off message is going to only the z2m node that turns the device off.

No the OFF is used in the working and non working version ver

Also tried upper and lower case no difference

It it is the Node Junction that is the issue and ONLY change between work and not work

Yup

And on is being sent to all the zigbee2MQTT and works
Should not off to all the zigbee2MQTT work also or only on ?

why is off treated differently?

Because the message that is meant to turn the device off is ALSO telling it to set brightness and color temp. Most devices I have turn on when setting either brightness or color temp so the off is likely being overridden.

The on nodes are only triggering when the motion sensor is showing occupancy=true

Once that changes then occupancy = false kicks in an off overrides existing brightness doesn't it?

I am ok with it I have made the middle piece a subflow with two outputs one for the ons and one for the off

I did try setting the on off to a flow variable and do that - the on worked the off did not

The node showed off but the zigbee2MQTT was left on :slight_smile:

So not sure why the zigbee2MQTT node shows one thing while the actual zigbee2MQTT is doing something else.

Still getting into NR and zigbee2MQTT so working out the quirks of it :slight_smile:

You don't have to use zigbeemqtt nodes, you can use the standard mqtt nodes.

I would not know you will have to test.
My point was that if you connect off to the junction all three zigbee2mqtt nodes are triggered. Off should only trigger off zigbee2mqtt node.

I had been trying to find a simple single way to send the on, brightness and colour-temp all in one go.

As each zigbee2MQTT node was set to only respond to one element, ie on/off, brightness, colour-temp I assumed it should work.

I have re-done the subflow so that each mode puts out three separate feeds, one for on/off another for brightness and the last for colour-temp.

Switched from using flow and pushed the variables into msg.payload.

Trying to get this to work now.

Thank you to everyone who helped, very much appreciated.

Try this in your Off.

1 Like

Thank you a good idea

Will use it

Isn't it a mistake that you have set '!= Night '.
No light at night?
As well as both Nigth and Morning or Nigth and Day or Night and Evening,
sent at the same time.

You nailed it,

I originally just had on and off and the switch was ==on =! on and I missed it when I got adventurous.

All working perfectly now, thanks all

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.