Read attribute of light in Node-Red

I am trying to create an light-alaram-clock.
So what I want is that at a certain time of the day, my lights turn on at 1%.
Then 5 minutes later it should increase to 5%, an other 5 minutes later to 10%
But if I get up and manually change the light to be off again f.e. or to 100%, the automation should stop.
So I thought I just read the status of the light using a current state node, but this will only tell me it if’s on or off, but not the brightness level.
Can anybody tell me how this is done?

Oh… and while I am here… I guess I’ll use the Big-Timer for the time-based event? But I cant set an exact time there. Only in increments of 15minutes. And I also have to define an off time?
Isn’t there something simpler?
I also found a light-scheduler-node but there it’s also only in 15 minutes increments (but with nicer UI to configure)

So but the main question is… how can I get the current brightness-level of a light from home-assistant into node-red?

1 Like

When you consult a ha entity light state, attributes are displayed in the msg also. Just grab a current state node put you light entity, put an inject node in the input and debug node (complete msg object) in the output and you will see when you press the inject button.

For accessing then the brightness attribute in a switch node you use the js dot notation

msg.data.attributes.brightness

4 Likes

Very cool! Didn’t see that… Thank you very much!

well, when tried with climate thermostat i do not get attributes at all. Any special thing I shoud pay attention to?

climate.living_room_wall_thermostat : msg : Object
object
_msgid: "391de8f7.5b0ce8"
topic: "climate.living_room_wall_thermostat"
data: object
timeSinceChangedMs: NaN

If you click data, does it drop down ?

If you have a debug-node make sure to check the Output. Make sure it says complete msg object.
I didn’t see that before, but if it’s set like this you should be able to see all properties.

I did try what you pointed out and many other things but no luck.
Gave up and moved to mqtt. Works fine so far.