I have a basic HASS setup which is connected to my Philips Hue set up - v2 bridge with some white only bulbs.
I have set up some automation as per the HASS example to power on my lights an hour before sunset. This works fine.
automation:
alias: Turn on light when sun sets
trigger:
platform: sun
event: sunset
offset: ā-01:00:00ā
action:
service: light.turn_on
entity_id: group.living_room
data:
# 900 seconds = 10 minutes
transition: 600
I have added the example code line to add a transition time to on but this does not work - the lights come on to full brightness straight away. I have tried changing this to various times with no change in result.
I have tested the transition using the following JSON:
The problem is that light.turn_on automatically takes it to the last state when it was on. Just like if you had switched it on in the Hue app.
One workaround would be to create a script that turns the light on at minimum brightness and than transitions to the desired value. You would then call the script with script.turn_on in your automation. It would look something like this:
script:
wakeup:
alias: sunset on
sequence:
- alias: Living Room Lights On
service: light.turn_on
data:
entity_id: group.livingroom
brightness: 1
- alias: Living Room Light Transition
service: light.turn_on
data:
entity_id: group.livingroom
brightness: 200
transition: 600
If the lights are off, does it transition from off to those scenes? My experience has been that transition only works if they are already on and you want to transition to another state.
The explanation that Hue revertst o the last used brightness seems to apply to me as if I set the brightness at 50% via the Hue app and then test my automation it switches the ligths straight on to 50% brightness.
Let me have a play with a script when I get some time and I will report backā¦
IĀ“m not quiet sure since iĀ“ve been tinkering around with this a while ago. IĀ“m using the scene above to slowly turn on my light every evening. To be honestā¦ IĀ“m not quiet sure if it actually use the transition. IĀ“ll check this later
So I finally found some time to play with this and added a script as below. Sadly, this has the same behaviour - lights come on an hour before sunset, but at the last set brightness with no transition to full brightness.
I also tested FallenLeaves config where I added a specific brightness to my previous config and that also did not work for the transition.
My current configuration looks as follows, any further ideas would be appreciated.
Thanks!
script:
wakeup:
alias: sunset on
sequence:
- alias: Living Room Lights On
service: light.turn_on
data:
entity_id: group.living_room
brightness: 1
- alias: Living Room Light Transition
service: light.turn_on
data:
entity_id: group.living_room
brightness: 200
transition: 600
automation:
alias: Turn on light when sun sets
trigger:
platform: sun
event: sunset
offset: "-01:00:00"
action:
service: script.turn_on
entity_id: script.wakeup
THe lights are turned on via the hue api, so please check the settings for each bulb in the offical hue app, there you can change the amount of brightness each bulb should have when turned on. Try to put that low, and use transition in your action.
Thanks again. I had checked that and tried setting that at various levels, but the automation always then brings the lights straight on to that level of brightness ignoring the transition. If my script is correct that should force the brightness to level 1 and then fade up over time.
Iāll park this for now until I have some more time to check. I now have a bigger issue in that I upgraded my all-in-one pi Hass today and now canāt confirm it is running or access the front end!
Just checking back to say I managed to resolve this by using a scene setting that has the required transition and then calling that as part of the automation.
My config looks a little like this:
scene:
- name: Livingroom fadeon
entities:
light.Living_Floor_Lamp:
state: on
transition: 300
brightness: 255
light.Living_Room_Unit:
state: on
transition: 300
brightness: 255
automation:
alias: Turn on light when sun sets
trigger:
platform: sun
event: sunset
offset: "-01:00:00"
action:
service: scene.turn_on
entity_id: scene.livingroom_fadeon
Hope this might help someone else in the futureā¦