hobbyquaker / node-red-contrib-zigbee

Node-RED Nodes for ZigBee Devices 🐝
MIT License
86 stars 15 forks source link

Read lamp status? #52

Open miDan23 opened 5 years ago

miDan23 commented 5 years ago

Hi,

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

Or should I remember their status with global variables?

hobbyquaker commented 5 years ago

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

miDan23 commented 5 years ago

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?

hobbyquaker commented 5 years ago

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.

kneip68 commented 5 years ago

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

miDan23 commented 5 years ago

@kneip68 : You can try the following:

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

hobbyquaker commented 5 years ago

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.

kneip68 commented 5 years ago

@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.

miDan23 commented 5 years ago

@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.

hobbyquaker commented 5 years ago

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 commented 5 years ago

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