I have found a script (https://github.com/MRobi1/Home-Assistant/blob/main/nightlight_script.yaml) that I would like to use in Home Assistant. How do I go about bringing it into Home Assistant?
Thanks.
I have found a script (https://github.com/MRobi1/Home-Assistant/blob/main/nightlight_script.yaml) that I would like to use in Home Assistant. How do I go about bringing it into Home Assistant?
Thanks.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
|
|
Thanks, didnt see the edit in yaml part.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
Having composed my script, how do I save it? I don't see a Save option anywhere, just a Copy to Clipboard one.
Thanks.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
The Save Script button should appear in the bottom right when you made changes - I think I have seen there is a bug in the latest version which can cause this not to show, but if you change to YAML mode it should appear - you can always add some text into the Description field so it registers a "change" and it should appear?

Tauranga
Quic Fibre (use R213449EPZJ3R for free setup)
No button there sadly, even after making a change.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
So here are the steps I am taking.
Scripts-Add Script Click button
Create New Script. Save Button is at lower right of screen.
Change to Edit in Yaml
Paste in saved script and select Save Script, RENAME window appears
Change script name and click Rename.
At this point the Save Script button disappears.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
The problem I am seeing is yes, the script is saved but when I open it and select Edit in Yaml again, all I see is this...
alias: Light On at Sunset
sequence: []
description: ""
As opposed to the actual script which starts...
alias: Light On at Sunset
sequence:
- variables:
# starting light brightness. 0-255. (255=100%)
start_brightness: 0
# end light brightness. 0-255
end_brightness: 200
# increment to change brightness by... ie: when set to 5 it will go 255->250->245
brightness_increments: 5
# duration in minutes to dim light
duration_mins: 20
etc
I am obviously doing something wrong but it has me beat.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
Does your script window have red down the lefthand side like below? If so that means there is an error in the script.

I could replicate this by creating a script and saving it calling it "New Script" then I copied in your text. The reason the red bar down the left appears is because the script syntax is not correct - in this case alias and sequence are in the script twice.
If this not the case, can you at least post a screenshot so we're not guessing so much?
Tauranga
Quic Fibre (use R213449EPZJ3R for free setup)
This is the full script i am pasting in.
alias: Light On at Sunset
sequence:
- variables:
# starting light brightness. 0-255. (255=100%)
start_brightness: 0
# end light brightness. 0-255
end_brightness: 200
# increment to change brightness by... ie: when set to 5 it will go 255->250->245
brightness_increments: 5
# duration in minutes to dim light
duration_mins: 20
# use this variables when dimming lights down
# repeat_count: "{{ ((start_brightness - end_brightness) / brightness_increments) }}"
# uncomment and use this variables when increasing light brightness
repeat_count: "{{ ((end_brightness - start_brightness) / brightness_increments) }}"
repeat_delay: "{{ ((duration_mins * 60) / repeat_count) }}"
- service: light.turn_on
data:
brightness: "{{ start_brightness }}"
target:
entity_id: light.diningroom_light
- delay:
hours: 0
minutes: 0
seconds: "{{ repeat_delay | int }} "
milliseconds: 0
- repeat:
while:
- condition: template
# use this when dimming the lights down
# value_template: >-
# {{ (state_attr('light.night_light_group', 'brightness') >
end_brightness) }}
# Uncomment and use this formula to increase the brightness of the lights (IE: For a wake-up light routine)
value_template: >-
{{ (state_attr('light.diningroom_light', 'brightness') <
end_brightness) }}
sequence:
- service: light.turn_on
data:
# Use this formula when dimming lights down
# brightness: >-
# {{ state_attr('light.night_light_group', 'brightness') | int -
# brightness_increments }}
# Uncomment and use this formula when increasing light brightness
brightness: >-
{{ state_attr('light.diningroom_light', 'brightness') | int +
brightness_increments }}
entity_id:
- light.diningroom_light
- delay:
hours: 0
minutes: 0
seconds: "{{ repeat_delay | int }} "
milliseconds: 0
mode: restart
icon: mdi:lightbulb
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
There is a line about halfway down that looks like it should be commented out (#) - line number 33:
end_brightness) }}
As soon as you comment out that line (or attach it to the line above) then the red bar disappears for me and save is successful.
Tauranga
Quic Fibre (use R213449EPZJ3R for free setup)
Thank you, thank you, thank you! All working now.
I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.
|
|