That’s just your wrong assumption and bias…
which part?
And who are you to judge what is correct or wrong? Aren’t you biased?
It usually means they have no idea how to use a template. I do have a bias towards not adding unnecessary extra components for no gain.
When your only tool is a hammer everything looks like a nail and the pat ‘node red’ answer for everything even a simple template doesnt server anyone well.
…which is integral part of yaml automation in HA, making it even harded to grasp.
I ussually would say the same.
But NR isn’t extra component once you are using it for more complex things. And because for some people yaml is not comfortable or even capable to achieve some goals (while NodeRed is), it makes NR the default tool. Nothing extra.
And at this point why should I suggest or advice to use yaml while I’m more confident/skilled with NR?
alias: Daylight
description: Set Daylight Level
trigger:
- platform: time_pattern
minutes: /2
condition: []
action:
- service: input_number.set_value
target:
entity_id: input_number.daylight_colour_temperature
data_template:
value: >-
{% set steps = (as_timestamp(now()) -
as_timestamp(states.sensor.date.state + ' 08:30:00')) / 60 %}{% set
level_now = 50 + (steps * 0.8)|int %} {% if level_now > 498 %}{% set
level_now = 498 %}{% elif level_now < 0 %}{% set level_now =
states('input_number.daylight_colour_temperature')|int %}{% endif %}{{
level_now }}
mode: single
Job done - this sets an input slider to the mired colour between 8:30am and approximately 8:30pm.
alias: 'LUX: Set Master Brightness'
description: ''
trigger:
- platform: state
entity_id: sensor.sma_lux
condition:
- condition: numeric_state
entity_id: sensor.sma_lux
below: '8000'
action:
- service: input_number.set_value
target:
entity_id: input_number.master_brightness_based_on_lux
data:
value: >-
{% set val = trigger.to_state.state|int %} {% set min_in = 1 %} {% set
max_in = 3000 %} {% set max_out = 100 %} {% set min_out = 1 %} {% set
out = (101 - (max_out + (min_out - max_out) * (1 - ((val - min_in) /
(max_in - min_in))))) %} {% if out < min_out %}{% set out = min_out %}{%
endif %} {% if out > max_out %} {% set out = max_out %}{% endif %} {{
out|int }}
mode: single
This sets a master brightness slider based on the actual Lux level being reported by an outdoor Zigbee sensor. Each room that needs to, then updates it’s own brightness level relative to the master brightness.
alias: 'Slider: Master Brightness'
description: ''
trigger:
- platform: state
entity_id: input_number.master_brightness_based_on_lux
condition:
- condition: state
entity_id: input_boolean.house_in_night_mode
state: 'off'
action:
- service: input_number.set_value
target:
entity_id: input_number.livingroom_light
data_template:
value: ' {% set min = 15 %} {% set max = 82 %} {% set b = (trigger.to_state.state|int) -(100 - max) %} {% if b <= min %} {% set v = min %} {% elif b >= max %} {% set v = max %} {% else %} {% set v = b %} {% endif %} {{ v }}'
- service: input_number.set_value
target:
entity_id: input_number.hall_brightness
data_template:
value: ' {% set min = 10 %} {% set max = 75 %} {% set b = (trigger.to_state.state|int) -(100 - max) %} {% if b <= min %} {% set v = min %} {% elif b >= max %} {% set v = max %} {% else %} {% set v = b %} {% endif %} {{ v }}'
- service: input_number.set_value
target:
entity_id: input_number.greenroom_brightness
data_template:
value: ' {% set min = 15 %} {% set max = 90 %} {% set b = (trigger.to_state.state|int) -(100 - max) %} {% if b <= min %} {% set v = min %} {% elif b >= max %} {% set b = max %} {% else %} {% set v = b %} {% endif %} {{ v }}'
- service: input_number.set_value
target:
entity_id: input_number.store_room_brightness
data_template:
value: ' {% set min = 15 %} {% set max = 80 %} {% set b = (trigger.to_state.state|int) -(100 - max) %} {% if b <= min %} {% set v = min %} {% elif b >= max %} {% set v = max %} {% else %} {% set v = b %} {% endif %} {{ v }}'
- service: input_number.set_value
target:
entity_id: input_number.bedroom_brightness
data_template:
value: ' {% set min = 8 %} {% set max = 40 %} {% set b = (trigger.to_state.state|int) -(100 - max) %} {% if b <= min %} {% set v = min %} {% elif b >= max %} {% set v = max %} {% else %} {% set v = b %} {% endif %} {{ v }}'
mode: single
It’s really not hard.
And Yes - I did initially have it all in NodeRed and it was a mammoth task to create it, debug it, keep tweaking it. But the final point for me came (and it’s not the first time I have encountered this) - when deploying a flow, corrupted flows.json and NodeRed was basically dead. No it’s not on a Pi, no it’s not on a SD card.
I said complex
have you seen this (just take a look at screenshots alone)
Why bother creating all that in Node Red when there is a HA component to do all the hard work for you? (Adaptive Lighting, which works perfectly)
Because I found the way it works doesn’t reflect reality nor daily life needs (and is not configurable in this regard). The biggest flaw I found was increasing brightnes since midnight, almost 8 hours before sunrise. This is how it started.
I described it with details in Motivation section of my article.
I don’t understand who (or why) someone wants their lights to be bright during the daytime and dimmer at night, I want lights to be dim during the day - except when it is dark outside - which is why I am reacting to a Lux sensor instead of the sun position.
Your project looks nice, but is useless for anyone who suffers from SAD or wants to maintain a healthy mental health state. You need a minimum amount of “daylight” every day, the reason we get depressed in the winter is because there is not enough daylight. Basing your rhythm on the sun - doesn’t fix this, it just mirrors it indoors.
That’s why my implementation simulates daylight for the same fixed period of time every day, regardless of what nature is doing.
Fair enough. I understand that. Different needs - different solutions.
Well my lights don’t come on during the day because they only come on if the light level in that part of the house is low enough to warrant it, using lux sensors.
…but all this is off topic.
People calm down. This is a thread that has become about preferences. Those preferences are personal. Personal choices don’t need to be criticised or even entirely justified. If people like NR, let them. If people prefer HA, let them. Just stop bloody bickering.
That’s not complex…
This has all become so off topic that I make no apologies…
What sensors do you use? I’m hoping based on previous contributions that you use something cheap and non-proprietary (which I can copy )
I’m not the one you asked, but I can highly recommend the Xiaomi Lux sensors together with a zigbee stick.
No…
One function node and one call service node, that is all.
One function node can get all the states in HA at once
Show me the template to read the .storage folder and output the learned remote commands.
What is not possible with Node red?
Reload xy after you changed something in configuration.yaml, what this topic originally was about before it became about node-red being the best thing since sliced bread…
Why would you need to reload configuration?
That was the whole point of Node red, you don’t need to reload anything, just deploy on the same screen view as you were just working on and everything updates.
You don’t need to open configuration and server controls and so on.
So I don’t get it…