Great, I am glad that it works for you
Ah, sorry for that. I shouldâve just edited the post.
I was having a problem with the light always turning on to 100%.
But I quickly remembered it was Adaptive lighting integration that was controlling it when turning from off to on. Now it works as intended!
My ZooZ motion measures illuminance in percent (0 - 100%), as does the Zooz dimmer. Iâm not quite sure how to adjust your code. I am assuming max_illuminance: 580
is for a unit that measures in integers?
The final code for my setup was
alias: Adjust brightness on the office bulb (faster)
description: ââ
trigger:
- platform: time_pattern
seconds: /15
condition: - condition: state
entity_id: timer.office_occupancy
state: active
for:
hours: 0
minutes: 0
seconds: 1
action: - choose:
- conditions:
- condition: template
value_template: >-
{{ states(âsensor.officelightlevelâ)|float <
states(âinput_number.office_light_targetâ)|float - range/2 }}
sequence: - service: light.turn_on
target:
entity_id: light.office_bulb
data:
brightness_step: â{{ my_brightness_step }}â
- condition: template
- conditions:
- condition: template
value_template: >-
{{ states(âsensor.officelightlevelâ)|float >
states(âinput_number.office_light_targetâ)|float + range/2 }}
sequence: - service: light.turn_on
target:
entity_id: light.office_bulb
data:
brightness_step: â{{ -1 * my_brightness_step }}â
default: []
mode: single
variables:
range: 5
my_brightness_step: 18
- condition: template
- conditions:
Looking at what youâre saying I would look at altering the range and my_brightness_step until you get the desired result.
@daknightuk What do you use for a illuminance sensor? The Zooz is reallllly slow.
Iâll try your final code and see if that works a bit better. Whatâs happening now is the dimmer starts out low, and just marches all the way up to 100% which is not what I want
@itcsburnett So my setup is an ESP8266 module with a light dependant resistor circuit and it uses ESP home.
I just remembered I had to use a âhelperâ to set the office_light_target value
Thanks @daknightuk That works now, although I need a better sensor. the ZooZ doesnât update fast enough or constantly. I have a aqura on order- will see how that works
I am using the Xiaomi Mi light sensor and it is great, quick and reliable.
Great to hear. I ordered a few of them myself from AliExpress