I have a Motion sensor device which includes two separate sensors :
a light intensity sensor with the following attributes
a motion sensor
I have created a flow which turns on a light when motion is detected.
Now, before turning on the light I want to check that the attribute Daylight is true. However I do not know how to check it because it is not part of the payload message. Indeed the message contains only data about the motion sensor but nothing about the light intensity sensor.
This is my flow below. I have tried to check the state of the light sensor (sensor.lightlevel_escalier2) but this gives me a NaN error and it is not about the attributes anyway.
Thank you. While I understand the purpose of the Join node, I still can't figure out how to get the Attributes of the light intensity sensor. I would need to get it before I can add inject it in a message.
If it is a case of not knowing what part of the msg they exist in, then a debug node will help.
There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.
Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.
If this is something else HA related, you may have to go the the HA forums for this one (AFAIK, not many of the folk who regularly help out here are HA users or HA experts)
Feed both messages into the join node, making sure they have different topics, and it should all be there in the result (which you should be able to see as suggested by Steve). If it isn't working then show us (from a debug node) what you are feeding into the Join, what is coming out, and how you have configured it.
as you can see the objects are merged just fine but :
i obviously don't want to inject {prope: 'hello'}, I want to inject the value of a given attribute belonging to a known entity
the inject node does not seem appropriate because I don't see how it can be triggered other than manually clicking on it. The trigger is the pink Device Trigger node (the motion sensor detecting motion) and this should then be merged with the attribute value of the light intenstity sensor (which I do not understand how to query)
This is not a HA issue because all the attributes and values I can see them just fine in the Device tab of HA.
Just re-read this and see that in fact the problem is nothing to do with node-red itself, but you don't know how to get the light level from the sensor in HA. So I think it is an HA problem. Few (if any) here use HA so you will probably have to ask on an HA forum.
Colin, somehow I understand your point. But imo the message payload contains data about the sensor that triggered the flow (here the motion sensor detecting motion).
My question is therefore: is there a way in Node Red to query attributes of a given known entity id, even if it is not part of the message ?
Node red only knows about what is in the message. Entity ids are an HA concept not a node-red concept. You need to find how to get the data from the sensor. If you were not using HA and were accessing the sensor direct from node-red then we could probably help. Though obviously we would need to know what the sensor is and how it is connected.
Accessing the sensor direct from node-red is what I want to achieve. It is a Frient Pro motion sensor connected to a Conbee II zigbee hub. Not sure if that helps.
ah no, I do not use zigbee2mqtt. Maybe I should investigate further but last time I tried to install it, it was just a pain with errors and I gave up.
I see indeed that there are mqtt nodes in node-red, so maybe it's the way to go. Thanks for pointing this out.
I gave it another try. This is the error I'm getting :
Zigbee2MQTT:error 2022-01-28 15:33:11: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-01-28 15:33:11: Failed to start zigbee
Zigbee2MQTT:error 2022-01-28 15:33:11: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
Zigbee2MQTT:error 2022-01-28 15:33:11: Exiting...
Zigbee2MQTT:error 2022-01-28 15:33:12: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:102:27)
at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:123:29)
at Zigbee.start (/app/lib/zigbee.ts:58:27)
at Controller.start (/app/lib/controller.ts:100:27)
at start (/app/index.js:97:5)
[15:33:12] INFO: Handing over control to Zigbee2mqtt Core ...
zigbee2mqtt@1.22.2 start
node index.js
I read somewhere I had to add the following to the configuration file : adapter: deconz
but obviousy this does not solve the issue
What are you using as your zigbee co-ordinator? The hardware I mean. I don't think you will be able to run deconz and zigbee2mqtt at thesame time. Though I don't know much about deconz, but if it takes over the co-ordinator then I don't think you will be able to run them both.
You cannot use deconz and zigbee2mqtt with conbee2 at the same time. I use my conbee2 with zigbee Adapter in iobroker which is based on the same technology as zigbee2mqtt.
Now i can acces the web ui to start adding devices. Next I'll get back to the original issue of this post and try to use mqtt in red-node (but i may not post here before a few days now)