Hi! I can’t find a solution to my issue anywhere.
Here is the deal.
I want some lights to start at 10% every morning at 10. Then they shall fade in up to about 70-80% and the timespan shall be about two hours before hitting max.
After a couple of hours it shall do the opposite down 10 10% and then shut down. From 0% to 0% should be about eight hours.
Also i want a temperature control, if a tempsensor hits x the lights should turn of instantly.
I use a shelly dimmer 2
here is a fading system I’ve just been working on. I takes a couple of different automations to get everything to work right and it might be able to be made more compact but it seems to be working for me right now.
The only issue is that if the automation is running to fade up (or down) the lights and HA is restarted then the fade automation will stop and the lights won’t be at full values. So that’s why you need two sets of automations - one set to start the fade up and the other to complete it if you restart HA before it finishes. And your case you will also need 4 automations to do the fade down too. So you will need a total of 8 automations.
And you will have to work out the delays and step intervals you want to achieve the total transition time. Right now it takes my light about 8.5 minutes to fade all the way from 0 to full brightness (255).
- alias: LC Deck Light On at Dusk
trigger:
- platform: state
entity_id: sensor.dark_outside
to: 'true'
- platform: sun
event: sunset
offset: "+00:15:00"
action:
- service: automation.turn_on
entity_id: automation.lc_deck_light_fade_on_at_dusk
- alias: LC Deck Light Fade On at Dusk
initial_state: 'off'
trigger:
- platform: time_pattern
seconds: "/1"
action:
- service: light.turn_on
data:
entity_id: light.deck_light_0a4c
brightness: 5
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.deck_light_0a4c
brightness: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int + 1 }}"
- delay: 2
until:
- condition: template
value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int >= 254 }}"
- service: automation.turn_off
entity_id: automation.lc_deck_light_fade_on_at_dusk
- alias: LC Deck Light Resume On at HA Restart
trigger:
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: sensor.dark_outside
state: 'true'
- condition: sun
after: sunset
after_offset: "+00:15:00"
- condition: state
entity_id: light.deck_light_0a4c
state: 'on'
- condition: template
value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int < 254 }}"
action:
- service: automation.turn_on
entity_id: automation.lc_deck_light_resume_fade_on_at_dusk
- alias: LC Deck Light Resume Fade On at Dusk
initial_state: 'off'
trigger:
- platform: time_pattern
seconds: "/1"
action:
- repeat:
sequence:
- service: light.turn_on
data:
entity_id: light.deck_light_0a4c
brightness: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int + 1 }}"
- delay: 2
until:
- condition: template
value_template: "{{ state_attr('light.deck_light_0a4c', 'brightness') | int >= 254 }}"
- service: automation.turn_off
entity_id: automation.lc_deck_light_fade_on_at_dusk
hopefully it helps.
I’m not sure how you would add in the “instant off” feature tho.
Thanks mate!
This was far more advanced than i could imagine.
I will try to figure it out. But i think this is over my league