I have an ambient light for which I made automation that turns this on when:
- My computer is active
- And connected to the relevant AP (BSSID)
- The sun is down
- The light is currently off
The light is set to 100% if off for >=2h, otherwise it leaves the current brightness setting.
I also have automation that turns the light off when:
- My computer is no longer active
- If the light is on
This way, when I open up my macbook first time in the evening, the ambient light comes on at 100%. Later I might watch movies so I set the light to 25%. If I’d take a potty break, the light goes off and comes back on when I wake the computer, leaving the 25% setting since I got back within 2h.
Now to the problem. The automation to turn on the light triggers not only when the computer is first started, but occasionally throughout the evening while the computer is active (why?). The “light is currently off” condition fixes this somewhat, but if I turn the light off, it will soon come back on. If I turn it off, I don’t want it to automatically come on again due to this automation for the rest of that evening. If I however, just take a potty break (automation turns it off) I still want it to turn on.
Any ideas on beat solution?
My automation looks like this:
alias: Studio ambient light auto
description: >-
Turn on the ambient light when the sun is down while the macbook is active and
connected to studio ap
trigger:
- platform: state
entity_id: sensor.kristians_macbook_pro_bssid
to: fc:ec:da:a8:1d:53
- platform: state
entity_id: binary_sensor.kristians_macbook_pro_active
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: state
entity_id: binary_sensor.kristians_macbook_pro_active
state: 'on'
- condition: state
entity_id: sensor.kristians_macbook_pro_bssid
state: fc:ec:da:a8:1d:53
- condition: state
entity_id: light.studio_ambient_light
state: 'off'
action:
- choose:
- conditions:
- condition: device
type: is_off
device_id: ba3605a768d5397f35acc6530575b3d2
entity_id: light.studio_ambient_light
domain: light
for:
hours: 2
minutes: 0
seconds: 0
sequence:
- type: turn_on
device_id: ba3605a768d5397f35acc6530575b3d2
entity_id: light.studio_ambient_light
domain: light
brightness_pct: 100
default:
- type: turn_on
device_id: ba3605a768d5397f35acc6530575b3d2
entity_id: light.studio_ambient_light
domain: light
mode: single