Node red skipping steps?

I have a NR flow in Home Assistant, its triggered by the outside LUX level and turns on our living room lights at a certain colour temperature - different for AM and PM.

It seems to miss the variable reading functions and turns them on at the last used setting instead, not every time though?

PM option


AM option

The levels are held in HA helpers - sliders in this instance

Your var statements to get globals I think it is wrong, I use

var value = global.get('homeassistant.homeAssistant.states["person.mike_fila"].state');

Thanks, its similar but will go that way as its clearer as well - will test later

No difference between the two

Thats what i thought, i have changed to the one-line version as it is a little easier to read.

Can’t think of any way that the function can be ignored or skipped though, but it does happen. I do know that the bulbs used will turn on in the state last used if no other controlling factors appear, but the command uses the colour temp command to set the tone.

Not really sure what you mean by skipping but you can insert the state of the entities directly in the call-service node.

{
  "color_temp": $entities("input_number.rgb_white_tone_am").state,
  "brightness_pct": $entities("input_number.lr_rgb_default_am").state,
}

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/call-service.html

1 Like

When i try that code, i get an “Unexpected ‘$’” error in the editor ??

last comma in the last line maybe?

Nope, same error

Are you sure you are following the docs?
Call Service Tips and Tricks | node-red-contrib-home-assistant-websocket (zachowj.github.io)

image

Thanks, that got it a step further but the final working option needed $number casting, and that final comma removing…

{
  "color_temp": $number($entities("input_number.rgb_white_tone_am").state),
  "brightness_pct": $number($entities("input_number.lr_rgb_default_am").state)
}

It still randomly just turns the lights on and misses the colour/brightness data part of the message - this results in the lights turning on at their previous state instead.