Hello everyone,
I’m trying to automate the screen brightness of my lenovo smart clock.
I have acess to the embeded ambiant light sensor value : sensor.my_wall_panel_light
and also the possibility to change the brightness of my clcok via aninput_number.smart_clock_brightness
I would like to automate it based on a formula found on the internet here
Bassicaly its this formula:
I’ve created the following automation but I am not capable of passing the value throuh the template:
alias: Automatic brightness control
trigger:
platform: state
entity_id: sensor.my_wall_panel_light
action:
- service: input_number.set_value
data_template:
value: >-
{% set x = states('sensor.my_wall_panel_light') | float %}
{% if x < 1254 %}
{{ ((9.9323* log(x)) + 27.059) | round(0) }}
{% elif x >= 1254 %}
{{ 100 }}
{% else %}
{{ 50 }}
{% endif %}
target:
entity_id: input_number.smart_clock_brightness
Can anyone help??