node-red-contrib-zigbee2mqtt icon indicating copy to clipboard operation
node-red-contrib-zigbee2mqtt copied to clipboard

[Feature Request] Send manually constructed commands using Out node (or new node)

Open rechichidaniel opened this issue 2 years ago • 7 comments

Can you please add the ability to construct commands and payloads manually in an Out node? Currently, we can only select from preset command options in a dropdown list.

Context: I used a Zigbee sniffer to see what commands my Philips Hue bridge was sending before I moved to Zigbee2MQTT, and now I'd like to use Node Red to send the commands that Zigbee2MQTT can only send from the dev console.

Commands like these:

Cluster Command Payload
0x0006 0x40 (off with effect) { "effected": 0, "effectvariant": 0 }
0x0008 0x02 (write attributes) 0x4000 (startup level) = 0xff (previous)
* Z2M can send 2x other startup commands without dev console, but not this one)
etc. etc. etc.

Something like the zigbee2mqtt dev console in a node. Using the Fade Off example:

  • Cluster: 0x0006 which I pulled from the Hue packet.
  • Command: 0x40 which I also pulled from the Hue packet.
  • Payload:
{
"effectid":0,
"effectvariant":0
}

image

rechichidaniel avatar Dec 29 '22 03:12 rechichidaniel

you an use raw json as payload 2022-12-29_07-37-47

andreypopov avatar Dec 29 '22 04:12 andreypopov

Thanks Andrey. I can add the payload in json format, but how do I add the rest of the command? e.g. command, cluster, endpoint, etc. Command 0x40 isn't in the dropdown list so I would need to add it some other way. And I'm not sure how to add the 0x0006 cluster.

Using the Fade Off command as an example:

  • Endpoint: 1
  • Cluster: 0x0006
  • Command: 0x40
  • Payload: {"effectid":0,"effectvariant":0}

I'm assuming the endpoint is the device, but I'm not sure.

rechichidaniel avatar Dec 29 '22 07:12 rechichidaniel

For others who get stuck, this is how you send the full command. Thank you Gwww on the Home Assistant forum.

{
    "command": {
        "cluster": 6,
        "command": 64,
        "payload": {
            "effectid": 0,
            "effectvariant": 0
        }
    }
}

Z2M Node Red Output Config

JSON Command

rechichidaniel avatar Jan 10 '23 10:01 rechichidaniel

Ability to set multiple parameters at once directly in the UI would be nice. Simple example : setting state = ON and brightness = 100 is a very usual case which is not easily done right now if I'm not mistaken.

pagaille avatar Apr 02 '23 09:04 pagaille

The command you want is called MoveToLevelWithOnOff. You can't send more than one ZigBee command at a time (to my knowledge) but there are a tonne of commands designed to do more than one thing.

Are you using standalone Z2M or are you using Z2M as a Home Assistant add-on? In the Z2M UI, you have to know the correct command to send but from the developer tab in HA (and other places), you don't have to know the commands because you can just select the parameters you want and let Z2M/HA figure it out.

rechichidaniel avatar Apr 02 '23 14:04 rechichidaniel

Thanks. I ended up using {"brightness":255,"state":"ON"} which works. My point is that it should be straightforward to do so from the UI (directly in the dropdown).

pagaille avatar Apr 02 '23 14:04 pagaille

I'd like that too. Have you got a feature request or issue posted somewhere that I can follow? Sorry, in my last reply I got distracted and didn't realise we were talking in the node-red-contrib-zigbee2mqtt GitHub. I thought this was the Z2M GitHub.

rechichidaniel avatar Apr 02 '23 15:04 rechichidaniel