I need to increase the brightness of some lights when the environment is dark.
Considering that my brightness sensor registers me a maximum brightness of 300 lux, I created this automation:
automation:
- alias: “Auto regolazione punto luce”
trigger:- platform: state
entity_id: sensor.luminosita, light.cucina
condition: - condition: and
conditions:- condition: state
entity_id: group.famiglia
state: ‘home’ - condition: or
conditions:- condition: template
value_template: “{{ (trigger.entity_id == ‘light.cucina’) and (trigger.from_state.state == ‘off’) }}” - condition: template
value_template: “{{ (trigger.entity_id == ‘sensor.luminosita’) and (states.light.cucina.state == ‘on’) }}”
action:
service: light.turn_on
data_template:
entity_id: light.cucina
brightness_pct: “{{ (((((states.sensor.luminosita.state * (100/300)) - 100)-((states.sensor.luminosita.state * (100/300)) - 100)|abs)/2)+100)|int }}”
- condition: template
- condition: state
- platform: state
I get this error: TypeError: can't multiply sequence by non-int of type 'float'
.
Can you help me understand the problem or find alternative solutions? Thank you