As the Original Poster (OP) you are the thread owner and get notifications of all posts to this thread.
Unless I subscribe to such a thread … I don’t
I came across the fact that you had posted by accident (don’t rely on accidents)
If you reply ‘to me’ (i.e. use the reply box in the lower right corner of one of my posts) I get a notification.
You could also ‘tag’ me e.g. @Mutt but be careful doing that especially if that person is a dev or someone like Paulus as it’s often considered ‘rude’ unless you have a relationship with that person in an ongoing discussion.
This is a bit of an open ended question but I’ll give you some examples : -
(This is old code and I keep saying I shall ‘optimise this’ to use some recent changes in the code base, especially template updates to make this process more efficient (but … don’t put off till tomorrow, something that you can put off till next week (I’m lazy and it works so …))
I have an automation that monitors relevant conditions and calls a script that updates an input number
automation:
#name: Heat Temperature Set Value
- alias: au_heat_temperature_set_value
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.bs_occupied
- platform: state
entity_id: binary_sensor.bs_heat_door_open
- platform: state
entity_id: sensor.s_heat_day_segment
- platform: state
entity_id: binary_sensor.bs_occupancy_heat
action:
- service: script.sc_heat_reset_value
automation:
## resets temperature following any pattern change
sc_heat_reset_value:
alias: Heating Reset Value
mode: single
max_exceeded: silent
sequence:
- service: input_number.set_value
data_template:
entity_id: input_number.in_heat_temp_control_val
value: >
{% if is_state('binary_sensor.bs_heat_door_open', 'on') %}
{{ '6' | float }}
{% elif not states('binary_sensor.bs_occupancy_heat') %}
{{ states('input_number.in_heat_temp_away_val') | float }}
{% elif is_state('sensor.s_heat_day_segment', 'Night') %}
{{ states('input_number.in_heat_temp_night_val') | float }}
{% elif is_state('sensor.s_heat_day_segment', 'Day') %}
{{ states('input_number.in_heat_temp_day_val') | float }}
{% else %}
{{ states('input_number.in_heat_temp_evening_val') | float }}
{% endif %}
So this changes the number
I also have an automation that when the number changes, loads it into the climate component
# name: Heat Temperature Set
- alias: au_heat_temperature_set
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: input_number.in_heat_temp_control_val
action:
- service: climate.set_temperature
data_template:
entity_id: climate.house_heat
temperature: "{{ states('input_number.in_heat_temp_control_val') | float }}"
To futher outline my original example (for the motion sensor case, note this is NOT best practice, use for: instead (I use it like this because I have multiple situations to bring on this light))
This principle is that you have a motion sensor and when you see motion (and the other lights in the room aren’t on, and it’s dark outside) it switches the light on. And while there’s motion you want the light to remain on. Only when motion stops do you want a timer to start, which when complete switches the light off.
So my motion sensor is ‘on’ for a minimum of 30 secs (set in hardware at the device) rather than change the parameter (extending to another time limit) i extend the ‘time’ between 30 secs and 10 minutes by changing an input number (0.5 to 10)
I do this in a binary sensor : -
binary_sensor:
- platform: template
sensors:
## kitchen motion (with delay)
bs_light_kitchen_motion:
value_template: "{{ is_state('binary_sensor.fib_mosen_kit_motion_sensor', 'on') }}"
friendly_name: Kitchen Motion With Delay
delay_off: "00:00:{{ (states('input_number.in_light_kitchenled_mosen_timer') | float) * 60 - 30 }}"
device_class: motion
So just by canging the value of input_number.in_light_kitchenled_mosen_timer (which sits in a card in my UI) I can change how long you can stand around before the light goes off before you have to dance around to bring it back on again.
Does that answer your question ? Does it give you an example of what you wanted to achieve ?