Node Red not controlling Zigbee devices

So I have a zzh stick that’s working nicely with zigbee2mqtt, for controlling my Zigbee devices - but only from the main HA interface / lovelace, not node red. I’ve restarted node red, and it sees the entities ok, and can query state - but it’s not turning them on or off.

So this entity is working:

But this node isn’t having any effect:

I’ve only just started using zigbee2mqtt so I’m guessing there’s a different in operation that I don’t know about. Should the ‘call service’ node be different for mqtt stuff for instance?

This is what’s showing up in the logs. Clearly it doesn’t like the entity ID, despite it being what’s shown in lovelace, and what’s picked up in autocomplete in node red?!

Unable to find referenced entities switch.bedwallleft, switch.bedwallright 6:34:27 PM – (WARNING) helpers/service.py - message first occurred at 4:23:36 PM and shows up 42 times

Well it’s obvious to me now - I needed the domain to be ‘switch’ instead of ‘light’. Confusion came from having used these devices before on my Hue bridge, for which ‘light’ needed to be used!

1 Like

But if you are on Node RED, why not sending the mqtt command without a detour via HA?

Set msg.payload to ON and use the mqtt node to send it. Like this example (import via clipboard in node red):

[{"id":"b32f7b62.61d49","type":"inject","z":"50358695.c485b","name":"Einschalten","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":310,"y":1040,"wires":[["1a0f0168.fdc92f"]]},{"id":"1a0f0168.fdc92f","type":"mqtt out","z":"50358695.c485b","name":"Lampe","topic":"ha/Az/Stehlampe/cmnd/POWER","qos":"","retain":"","broker":"dfba118.b6592f","x":530,"y":1060,"wires":[]},{"id":"1c7912bc.03df15","type":"inject","z":"50358695.c485b","name":"Ausschalten","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":310,"y":1080,"wires":[["1a0f0168.fdc92f"]]},{"id":"dfba118.b6592f","type":"mqtt-broker","name":"mosquitto","broker":"192.168.200.58","port":"1883","clientid":"NodeRed","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

grafik

Perhaps I don’t completely understand the relationship between mqtt, HA and node red. HA maintains the state does it not? So that has to be involved? Node red provides the linkage, and mqtt the transport (for the qualifying items)? What would be really useful is a primer for how the three elements fit together. It’s kind of natural in 2021 that there’s a blurring between the elements, but it’s difficult to clearly understand.

Both HA and NodeRed broadcast and listen to MQTT broker (hence the name ‘broker’ :wink:)
so if NodeRed switches something, HA knows it too (and vise versa :yum:)

That makes sense (I think!). I’m new to mqtt (obviously!) so still trying to get my head around it…

You’re welcome. Don’t worry.

And yes, it makes sense :wink: s. also aceindy’s info.

That solved my ‘problem’ too, thank you.