Nommu
(Nommu)
June 23, 2023, 10:31am
21
I‘got this Info from Zigbee2MQTT, didn‘t know where to get the info from HA.
"brightness": 127,
"color": {
"h": 0,
"hue": 0,
"s": 100,
"saturation": 100,
"x": 0.7,
"y": 0.299
},
"color_mode": "xy",
"color_temp": 160,
It‘s a Philips Hue light.
hugo-leij
(Hugo Leij)
August 10, 2023, 9:45pm
22
Hey @ChreeceGR
Are you still active?
I found your script, I’m looking for a while for something like this. Somehow it does not work for me
Some info
description: ""
trigger:
- platform: time
at: "23:37:00"
condition: []
action:
- service: script.1691702997070
data:
duration: 10
target:
- light.slaapkamer_ledstrip
brightness: 100
mode: single
Light:
Slaapkamer - Ledstrip
supported_color_modes: rgbw
friendly_name: Slaapkamer - Ledstrip
supported_features: 32
color_mode: rgbw
brightness: 657
hs_color: 122.133, 88.235
rgb_color: 30, 255, 38
rgbw_color: 30, 255, 38, 0
xy_color: 0.178, 0.723
ChreeceGR
(Chreece)
August 12, 2023, 12:27pm
23
I have edited the script, should also work for you
ChreeceGR
(Chreece)
August 12, 2023, 12:30pm
24
Sorry for the late reply, could you test the edited script from the 1st post?
hugo-leij
(Hugo Leij)
August 21, 2023, 3:26pm
25
I was on vacation @ChreeceGR
New code doesn’t give errors, but it doesn’t work. It stays on 1%
Action:
duration: 1
target:
- light.slaapkamer_ledstrip
brightness: 99
ChreeceGR
(Chreece)
August 22, 2023, 7:41am
26
Can you please post the steps executed from the loop on the right? (You posted the left loop)
*also changed the script a bit, please check the new code
hugo-leij
(Hugo Leij)
August 22, 2023, 9:39am
27
If i copy the script i get a redline. After looking what was changed i removed the tab at ‘maxbri: |’. After that i can’t save the new script:
Message malformed: extra keys not allowed @ data['temp']
ChreeceGR
(Chreece)
August 22, 2023, 11:00am
28
Sorry for that, that’s why one shouldn’t edit code on phone… Please try again with the edited code (just put 2 spaces in front of temp: |
line)
hugo-leij
(Hugo Leij)
August 22, 2023, 3:20pm
29
Thnx! No more errors in the script but its stays on 1%
Logs:
ChreeceGR
(Chreece)
August 23, 2023, 5:23am
30
Can you please post how did you call the script and what are the trace steps in the repeat action? ( the last two orange circles, down right.)
Are there any related errors in the logs?
Wow found the bug sorry for that… please check the updated script. Have fun!
hugo-leij
(Hugo Leij)
August 23, 2023, 5:57am
31
Yeah, no more error and its going well (from distance)! If i’m at home tonight i will test it in the dark
One question and one feature request
It looks like it is not possible to turn off the lamp if the script is running, is that correct?
Is creating a sunset script an option? Then i can go to sleep and wake up with it
Thnx for all your help, I’m pleased with it!
ChreeceGR
(Chreece)
August 23, 2023, 11:07am
32
If you turn off the lamp after the lamp turns on from the script ( repeat.index 1) the script will just stop as it did before I changed the code.
Creating a sunset script is not something I’m interested.
Wouldn’t be much change on the code to try. Just need to reverse the procedure
Hello, thanks a lot for the script. I implemented it and it works well and does everything that it is supposed to. However, I found another small bug that prevents the set duration from taking effect and I thought it might be usefull for everyone to share how I fixed it.
I can’t claim that im very good with code like this so I don’t know if I broke something else but its definetly working for me now.
Basically what happend was, that the script always defaultet to the 10 minutes duration, no matter what I specified in the data when calling the script.
Replacing the line: {{ ( ( ( states('input_number.sunrise_sim_time') | int(10) * 60) / maxbri ) * 1000) | int }}
in the first section specifying the first delay with: {{ ( ( ( dur * 60) / maxbri ) * 1000 ) | int }}
seems to have fixed it.
ChreeceGR
(Chreece)
September 6, 2023, 8:41pm
34
Indeed, that was a helper that I’m using and forgot to change.
Thank you very much, I have updated the script
The script turned all lights on, not the light specified.i had the entity name right.
And manual turning off didn’t interrupt.
ChreeceGR
(Chreece)
September 28, 2023, 12:25pm
38
Can you please post the trace from the script, showing the “Changed Variables” tab.
ChreeceGR
(Chreece)
September 28, 2023, 12:30pm
39
If the light is in unavailable or unknown state, or the entity doesn’t exist, all the lights will turn on by default. That could be changed by removing the lines:
{% else %}
{% set res.r = res.r + states.light
| rejectattr('state','in', ['unavailable', 'unknown', None])
| selectattr('entity_id', 'in', area_entities(t))
| map(attribute='entity_id')
| list %}
The kitchen lights entity is a group, not sure if that makes a difference.
ChreeceGR
(Chreece)
September 29, 2023, 6:54am
41
Hmmm I’m not sure if group light entities are included in the state.lights object. What is the state of the light.kitchen_lights?
Can you please check in the template editor what results do you get with:
{{ states.light
| selectattr('entity_id', 'eq', 'light.kitchen_lights')
| list }}