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

Read lamp status?

Open miDan23 opened this issue 4 years ago • 10 comments

Hi,

is it possible to get the actual state of a lamp?

Or should I remember their status with global variables?

miDan23 avatar Oct 05 '19 22:10 miDan23

Currently node-red-contrib-zigbee doesn't keep a cache of current states, so you have to write them into the context.

hobbyquaker avatar Oct 11 '19 19:10 hobbyquaker

OK ... good to know ... You wrote "currently". Is this going to change? I understand that end devices like motion sensor and dimmer switch cannot receive data. They can only send. But lamps are routers. They should be able to send and receive data. And they can't get asked for their state?

miDan23 avatar Oct 11 '19 19:10 miDan23

You wrote "currently". Is this going to change?

I'm thinking about it :-)

But lamps are routers. They should be able to send and receive data. And they can't get asked for their state?

You can do this already, with the Command Node you can use a read command: image

Get command for the converter node is on my todo, will implement that soon.

hobbyquaker avatar Oct 12 '19 08:10 hobbyquaker

Hi

First off all thx for the effort you put into RedMatic and Zigbee Node. When I put in exactly your command node on a Tradfri Bulb (which should be supported by the converters) I get 19.10.2019, 16:33:44node: command msg : string[26] "attributes is not iterable" when triggered from a Flow., In the setup of the node it answers correctly: image

Any Idea what I am doing wrong? Or do I follow the wrong concept?

Thx, Kneip

kneip68 avatar Oct 19 '19 14:10 kneip68

@kneip68 : You can try the following:

  • Place an Inject, a Convert and a Debug node
  • Connect them
  • In the Converter node: set herdsman and device. Copy the Text behind get topic
  • In the Inject node:
    • Paste the text in the Topic filed and change ${name] to the name of your lamp
    • Set Payload to JSON and enter {"state":""} as payload

After deploying and injecting you should get the state of your lamp.

miDan23 avatar Oct 20 '19 14:10 miDan23

I get 19.10.2019, 16:33:44 node: command msg : string[26] "attributes is not iterable" when triggered from a Flow., In the setup of the node it answers correctly

does the message you inject into the command node contain an attributes property? This would overwrite what you have entered in the command node configuration.

hobbyquaker avatar Oct 21 '19 17:10 hobbyquaker

@miDan23

After deploying and injecting you should get the state of your lamp.

Sure that works, but on my special bulb it only gives me very limited informaton, so I was hoping to get more from the command node.

@hobbyquaker Yes I did in various combinations, but also tried to without. In the meantime I think my misconception was that I could predefine the complete query in the command node, but it seems to me like when I deploy it it looses the info that it should do READ command instead a generic command. So I guess I need to learn more on the usage of the command node.

Could someone please post a flow containing an inject node, a zigbee command node for reading and a debug output node? From there I guess I can figure it out. Thx.

kneip68 avatar Oct 22 '19 11:10 kneip68

@kneip68 Just guess what you get with {"state":"","brightness":"","color_temp":""} ...

Look here (scroll down to zigbee2mqtt/[DEVICE_ID]/set) for an idea what you can get.

miDan23 avatar Oct 22 '19 17:10 miDan23

Yes I did in various combinations, but also tried to without. In the meantime I think my misconception was that I could predefine the complete query in the command node, but it seems to me like when I deploy it it looses the info that it should do READ command instead a generic command.

Thats not your misconception. If the "Execute Command" Button is working but an incoming msg does not it's a bug. Will have to investigate

hobbyquaker avatar Oct 22 '19 17:10 hobbyquaker

can confirm that this is a bug: https://github.com/hobbyquaker/node-red-contrib-zigbee/issues/62

hobbyquaker avatar Oct 22 '19 17:10 hobbyquaker