This integration will extract your alarm data from any Google Home device: https://github.com/leikoilja/ha-google-home#hacs-installation
by using sensor.nest_hub_next_alarm as timestamp it will work.
I’ve just installed this and I’m finding if I turn the light off during the automation it just turns back on again the next time it changes brightness. Been trying to see why this is happening but new to HA and having difficulty.
Also I think a nice feature would be to not run the automation if the light is already on.
Would it be possible to limit the maximum color temperature at the end of the “sunrise” letting it appear a bit warmer? Integrated as a slider, same as “min_mired” for the starting color temperature?
Hi, I am running into errors and I’m not sure what I have done wrong. Any help would be greatly appreciated.
Here is the error from the log:
Logger: homeassistant.components.automation.wake_up_light_alarm_with_sunrise_effect_erik
Source: components/automation/__init__.py:416
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 8:34:00 AM (20 occurrences)
Last logged: 8:53:00 AM
Error while executing automation automation.wake_up_light_alarm_with_sunrise_effect_erik: In 'template' condition: TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Logger: homeassistant.components.automation.wake_up_light_alarm_with_sunrise_effect_erik
Source: helpers/script.py:1156
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 8:34:00 AM (20 occurrences)
Last logged: 8:53:00 AM
Wake-up light alarm with sunrise effect - Erik: Error executing script. Error for wait_template at pos 2: In 'template' condition: TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Here is the extract of my automation:
- id: '1616874084139'
alias: Wake-up light alarm with sunrise effect - Erik
description: ''
use_blueprint:
path: sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
input:
manual_time: '8:35:00'
end_brightness: 50
pre_sunrise_actions: []
light_entity: light.office_lamp
sunrise_duration: 5
Here is the time sensor:
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
Is it possible to somehow pass the mired value to a light bulb - in my case Ikea Bulb- that only supports color_xy ?
Could you share all the sensor and automations you’re using? I’ve been struggling trying to get this working for months
Is there a way to disable the manual time?
I am using these sensors:
Time sensor: (make sure you are including the “date_time_iso” sensor, because the Google Home integration reports the alarm in the ISO format)
sensor:
- platform: time_date
display_options:
- 'date_time'
- 'time'
- 'date'
- 'date_time'
- 'date_time_utc'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
- 'beat'
Alarm sensor: (provided by this integration GitHub - leikoilja/ha-google-home: Home Assistant Google Home custom component)
should like this:
Then the automation is as follow: (notice I added something to turn on my radio after the alarm and the morning routines of the nest hub)
alias: Wake-up light alarm with sunrise effect
description: Nest hub wekker
use_blueprint:
path: sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
input:
manual_time: '7:00:00'
light_entity: light.slaapkamer
timestamp_sensor: sensor.nest_hub_alarms
sunrise_duration: 20
start_brightness: 1
min_mired: 155
post_sunrise_actions:
- delay:
hours: 0
minutes: 2
seconds: 30
milliseconds: 0
- service: media_player.volume_set
target:
entity_id: media_player.slaapkamer_speaker
data:
volume_level: 0.17
- service: media_player.select_source
data:
source: Qmusic
target:
entity_id: media_player.slaapkamer_speaker
pre_sunrise_actions: []
end_brightness: 222
For some reason the last 2 days the wake up light doesn’t work anymore. I get the following message in the log:
2021-04-21 06:30:01 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: {{0 < as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(states('sensor.date_time_iso')) <= float(seconds) and states(check_entity) in ['unknown', 'on', 'home']}}
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 376, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1327, in _render_with_context
return template.render(**kwargs)
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
What is there going wrong?
Hi, I get the same error as Deadpool. Did someone figure this out yet?
Update: I forgot to enable the date_time sensor as specified in the top post.
Hi,
I adapted the blueprint a bit to work with RGB lights (with only color mode hs_color). Perhaps you would like to incorporate that option? Basically it will fade the saturation from 100% to a set value in some color you can set.
blueprint:
name: Wake-up light alarm RGB
description: 'A wake-up light alarm with a brightness and color sat sunrise
effect. Note: Requires date_time_iso sensor in configuration, not manually executable!'
domain: automation
input:
light_entity:
name: Wake-up light entity
description: The light to control. Turning it off during the sunrise will keep
it off. Color temperature range is auto-detected.
selector:
entity:
domain: light
timestamp_sensor:
name: Alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
device_class: timestamp
manual_time:
name: Manual alarm time
description: Time to trigger alarm every day if timestamp sensor is not set.
Settings at or shortly after midnight will not work as expected!
default: '7:00:00'
selector:
time: {}
check_entity:
name: Additional entity to check before sunrise is triggered
description: If set, checks if entity is 'on' or 'home' before triggering. Use
e.g. a (workday) sensor, device_tracker or person entity.
default: none
selector:
entity: {}
sunrise_duration:
name: Sunrise duration
description: The sunrise will start the configured number of minutes before
the timestamp.
default: 25
selector:
number:
min: 5.0
max: 60.0
step: 5.0
unit_of_measurement: min
mode: slider
start_brightness:
name: Minimum brightness
description: The brightness to start with. Some lights ignore very low values
and may turn on with full brightness instead!
default: 1
selector:
number:
min: 1.0
max: 255.0
step: 1.0
mode: slider
end_brightness:
name: Maximum brightness
description: The brightness will be transitioned from the minimum to the configured
value.
default: 254
selector:
number:
min: 5.0
max: 255.0
step: 1.0
mode: slider
hue:
name: Color to use
description: The color for RGB light
value.
default: 60
selector:
number:
min: 0
max: 360
step: 1.0
mode: slider
sat:
name: Color Saturation
description: The saturation will be transitioned from the maximum to the configured
value.
default: 100
selector:
number:
min: 0
max: 100
step: 1.0
mode: slider
pre_sunrise_actions:
name: Pre-sunrise actions
description: Optional actions to run before sunrise starts.
default: []
selector:
action: {}
post_sunrise_actions:
name: Post-sunrise actions
description: Optional actions to run after sunrise ends (around the alarm time).
default: []
selector:
action: {}
source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d#file-wake-up-light-alarm-with-sunrise-effect-yaml
variables:
light_entity: !input 'light_entity'
sensor: !input 'timestamp_sensor'
sunrise_duration: !input 'sunrise_duration'
start_brightness: !input 'start_brightness'
end_brightness: !input 'end_brightness'
range_brightness: '{{float(end_brightness)-float(start_brightness)}}'
manual_time: !input 'manual_time'
seconds: '{{float(sunrise_duration) * 60}}'
hue: !input 'hue'
sat: !input 'sat'
tick_time: '{{float(seconds) / float(range_brightness)}}'
check_entity: !input 'check_entity'
trigger:
- platform: time_pattern
minutes: '*'
condition: []
action:
- wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) <= float(seconds)
and states(check_entity) in [''unknown'', ''on'', ''home'']}}'
- choose: []
default: !input 'pre_sunrise_actions'
- condition: template
value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- condition: template
value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds) and states(check_entity)
in [''unknown'', ''on'', ''home'']}}'
- choose:
- conditions:
- '{{state_attr(light_entity, ''brightness'') != None}}'
sequence:
- service: light.turn_on
data:
brightness: '{{start_brightness}}'
hs_color:
- '{{ hue | int}}'
- '{{ 100 | int}}'
entity_id: !input 'light_entity'
default:
- service: light.turn_on
data:
brightness: '{{start_brightness}}'
entity_id: !input 'light_entity'
- repeat:
while:
- '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}'
sequence:
- delay: '{{tick_time}}'
- choose:
- conditions:
- '{{0 < state_attr(light_entity, ''brightness'') | int < end_brightness |
int}}'
- '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}'
sequence:
- choose:
- conditions:
- '{{state_attr(light_entity, ''brightness'') != None}}'
sequence:
- service: light.turn_on
data:
brightness: '{{(float(end_brightness) - (float(range_brightness) *
(as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds)))
| int}}'
hs_color:
- '{{hue | int}}'
- '{{((float(100) - (float(100) - sat)) + ((float(100) - sat) *
(as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds)))
| int}}'
entity_id: !input 'light_entity'
default:
- service: light.turn_on
data:
brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor)
if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time)
- as_timestamp(now())) / float(seconds))) | int}}'
entity_id: !input 'light_entity'
- choose: []
default: !input 'post_sunrise_actions'
mode: single
max_exceeded: silent
Regards.
masteriiz
Hi I had the same issue so made something for lights that are only RGB. Somewhere down in this topic.
I’ve added this to my HA and it seems to work perfectly, however I have an improvement to request/suggest.
Since OP seems to no longer be maintaining this, could someone knowledgeable please add an option to automatically set the brightness to the max configured value, if the alarm on the phone is dismissed after the automation started, but before the alarm itself has triggered?
Hey! could you share some more information please, the link does not work and on icloudI did not find the information I needed
Error while executing automation automation.wake_up_light_alarm_with_sunrise_effect: In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
Hi, I was getting the “TypeError” error while using a manual alarm time. What fixed it for me was directly editing the automations.yaml file directly (I am using hassos and the Visual Studio Code addon to edit in the browser)
I think my issue was my automations.yaml had bad whitespacing (vscode fixed it for me) and the time picker for “Manual alarm time” chose the wrong hour for am/pm.
in my example, this is an exerpt of my automations.yaml
- id: "1622310155441"
alias: Wake-up light alarm with sunrise effect
description: ""
use_blueprint:
path: sbyx/wake-up-light-alarm-with-sunrise-effect.yaml
input:
light_entity: light.martians_floor_lamp
manual_time: "5:15:00"
check_entity: calendar.work_work_schedule
sunrise_duration: 15
timestamp_sensor: none
I manually edited the time to 0515am, and “timestamp_sensor: none”.
the schedule for my alarm is a caldav integration to my apple id (using an app-specific password).
with the caldav integration, when I use the “custom_calendars” option, it lets me use a calendar as a binary sensor.
here’s an excerpt of my configuration.yaml
calendar:
- platform: caldav
url: https://caldav.icloud.com
username: "appleid"
password: "---"
custom_calendars:
- name: "work schedule"
calendar: "work"
search: "work"
my use case is I am a nurse with 12 hour shifts, who’s work schedule changes often. I made a calendar with my schedule and I am hoping with your blueprint I can have a “smart alarm” to use with my hue bulbs. Thank you Sbyx!
Hi All, I was struggling to get the blueprint working, struggling with the purpose with various lines of code, and it wasn’t exactly what I wanted. So, I’ve made some changes - refer to the bottom of this post. Note that you will need at least one input_datetime and one input_boolean for this to work.
Please be gentle - I’m just throwning this code out there because there seemed to be a few who were having issues. The code hasn’t been cleaned of commented out lines and I’ve not stress tested it. I don’t know if manual times work or if what fields are optional (noting the optional text) etc. And I’m running on the ragged edge of my coding skills!
My config:
input_datetime.yaml
alarm_monday:
name: Monday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_tuesday:
name: Tuesday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_wednesday:
name: Wednesday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_thursday:
name: Thursday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_friday:
name: Friday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_saturday:
name: Saturday Alarm
has_date: false
has_time: true
icon: mdi:alarm
alarm_sunday:
name: Sunday Alarm
has_date: false
has_time: true
icon: mdi:alarm
input_boolean.yaml
alarm_monday:
name: Monday Alarm
icon: mdi:alarm
alarm_tuesday:
name: Tuesday Alarm
icon: mdi:alarm
alarm_wednesday:
name: Wednesday Alarm
icon: mdi:alarm
alarm_thursday:
name: Thursday Alarm
icon: mdi:alarm
alarm_friday:
name: Friday Alarm
icon: mdi:alarm
alarm_saturday:
name: Saturday Alarm
icon: mdi:alarm
alarm_sunday:
name: Sunday Alarm
icon: mdi:alarm
automation.yaml
- id: '###'
alias: Wake-up light alarm with sunrise effect
description: ''
use_blueprint:
path: homeassistant/wake-up-light-alarm-with-sunrise-effect_modified-2.yaml
input:
light_entity: light.lights_bedroom
timestamp_sensor_monday: input_datetime.alarm_monday
timestamp_sensor_tuesday: input_datetime.alarm_tuesday
timestamp_sensor_wednesday: input_datetime.alarm_wednesday
timestamp_sensor_thursday: input_datetime.alarm_thursday
timestamp_sensor_friday: input_datetime.alarm_friday
timestamp_sensor_saturday: input_datetime.alarm_saturday
timestamp_sensor_sunday: input_datetime.alarm_sunday
sunday_alarm: input_boolean.alarm_sunday
monday_alarm: input_boolean.alarm_monday
tuesday_alarm: input_boolean.alarm_tuesday
wednesday_alarm: input_boolean.alarm_wednesday
thursday_alarm: input_boolean.alarm_thursday
friday_alarm: input_boolean.alarm_friday
saturday_alarm: input_boolean.alarm_saturday
check_entity: person.me
pre_sunrise_actions:
- service: switch.turn_on
target:
entity_id: switch.bedroom_electric_blanket_outlet
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_adaptive_bedroom
post_sunrise_actions:
- delay:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
- service: switch.turn_on
target:
entity_id: switch.adaptive_lighting_adaptive_bedroom
sunrise_duration: 25
max_mired: 450
blueprint:
name: Wake-up light alarm with sunrise effect
description: 'A wake-up light alarm with a brightness and color temperature sunrise
effect. Note: Requires date_time_iso sensor in configuration, not manually executable!
Changes to original source_url:
- added maximum mired
- changed the light entity selector domain to be a input_datetime
- added one input_datetime for each day of the week
- added input_booleans for each day of the week. Able to turn on and off the alarm.
Original source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d'
domain: automation
input:
light_entity:
name: Wake-up light entity
description: The light to control. Turning it off during the sunrise will keep
it off. Color temperature range is auto-detected.
selector:
entity:
domain: light
timestamp_sensor_monday:
name: Monday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_tuesday:
name: Tuesday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_wednesday:
name: Wednesday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_thursday:
name: Thursday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_friday:
name: Friday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_saturday:
name: Saturday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
timestamp_sensor_sunday:
name: Sunday alarm timestamp sensor
description: 'Sensor with timestamp of next alarm with device_class: timestamp
(set to ''none'' for manual alarm time)'
default: none
selector:
entity:
domain: input_datetime
monday_alarm:
name: Set alarm for Monday (Optional)
description: Choose on for to turn alarm on for Monday
default: 'off'
selector:
entity:
domain: input_boolean
tuesday_alarm:
name: Set alarm for Tuesday (Optional)
description: Choose on for to turn alarm on for Tuesday
default: 'off'
selector:
entity:
domain: input_boolean
wednesday_alarm:
name: Set alarm for Wednesday (Optional)
description: Choose on for to turn alarm on for Wednesday
default: 'off'
selector:
entity:
domain: input_boolean
thursday_alarm:
name: Set alarm for Thursday (Optional)
description: Choose on for to turn alarm on for Thursday
default: 'off'
selector:
entity:
domain: input_boolean
friday_alarm:
name: Set alarm for Friday (Optional)
description: Choose on for to turn alarm on for Friday
default: 'off'
selector:
entity:
domain: input_boolean
saturday_alarm:
name: Set alarm for Saturday (Optional)
description: Choose on for to turn alarm on for Saturday
default: 'off'
selector:
entity:
domain: input_boolean
sunday_alarm:
name: Set alarm for Sunday (Optional)
description: Choose on for to turn alarm on for Sunday
default: 'off'
selector:
entity:
domain: input_boolean
check_entity:
name: Additional entity to check before sunrise is triggered
description: If set, checks if entity is 'on' or 'home' before triggering. Use
e.g. a (workday) sensor, device_tracker or person entity.
default: none
selector:
entity: {}
sunrise_duration:
name: Sunrise duration
description: The sunrise will start the configured number of minutes before
the timestamp.
default: 25
selector:
number:
min: 5.0
max: 60.0
step: 5.0
unit_of_measurement: min
mode: slider
start_brightness:
name: Minimum brightness
description: The brightness to start with. Some lights ignore very low values
and may turn on with full brightness instead!
default: 1
selector:
number:
min: 1.0
max: 255.0
step: 1.0
mode: slider
end_brightness:
name: Maximum brightness
description: The brightness will be transitioned from the minimum to the configured
value.
default: 254
selector:
number:
min: 5.0
max: 255.0
step: 1.0
mode: slider
max_mired:
name: Maximum color temperature
description: 'The maximum color temperature to use. Start temperature - higher mired = warmer'
default: 450
selector:
number:
min: 5.0
max: 500.0
step: 5.0
mode: slider
unit_of_measurement: mired
min_mired:
name: Minimum color temperature
description: 'The minimum color temperature to use. End temperature - lower mired = cooler'
default: 0
selector:
number:
min: 0.0
max: 500.0
step: 5.0
mode: slider
unit_of_measurement: mired
pre_sunrise_actions:
name: Pre-sunrise actions
description: Optional actions to run before sunrise starts.
default: []
selector:
action: {}
post_sunrise_actions:
name: Post-sunrise actions
description: Optional actions to run after sunrise ends (around the alarm time).
default: []
selector:
action: {}
# original source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d
variables:
light_entity: !input 'light_entity'
sunrise_duration: !input 'sunrise_duration'
start_brightness: !input 'start_brightness'
end_brightness: !input 'end_brightness'
range_brightness: '{{float(end_brightness)-float(start_brightness)}}'
sensor_monday: !input 'timestamp_sensor_monday'
sensor_tuesday: !input 'timestamp_sensor_tuesday'
sensor_wednesday: !input 'timestamp_sensor_wednesday'
sensor_thursday: !input 'timestamp_sensor_thursday'
sensor_friday: !input 'timestamp_sensor_friday'
sensor_saturday: !input 'timestamp_sensor_saturday'
sensor_sunday: !input 'timestamp_sensor_sunday'
sunday_alarm: !input 'sunday_alarm'
monday_alarm: !input 'monday_alarm'
tuesday_alarm: !input 'tuesday_alarm'
wednesday_alarm: !input 'wednesday_alarm'
thursday_alarm: !input 'thursday_alarm'
friday_alarm: !input 'friday_alarm'
saturday_alarm: !input 'saturday_alarm'
sensor: "{% if (as_timestamp(now()) | timestamp_custom('%a') == 'Sun') and states(sunday_alarm) == 'on' %}\n\
\ {{ sensor_sunday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Mon') and states(monday_alarm) == 'on' %}\n\
\ {{ sensor_monday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Tue') and states(tuesday_alarm) == 'on' %}\n\
\ {{ sensor_tuesday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Wed') and states(wednesday_alarm) == 'on' %}\n\
\ {{ sensor_wednesday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Thu') and states(thursday_alarm) == 'on' %}\n\
\ {{ sensor_thursday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Fri') and states(friday_alarm) == 'on' %}\n\
\ {{ sensor_friday }}\n\
\ {% elif (as_timestamp(now()) | timestamp_custom('%a') == 'Sat') and states(saturday_alarm) == 'on' %}\n\
\ {{ sensor_saturday }}\n\
\ {% else %}\n\
\ {{ 'no_alarm' }}\n\
\ {% endif %}"
# manual_time: !input 'manual_time'
seconds: '{{float(sunrise_duration) * 60}}'
min_mired: !input 'min_mired'
max_mired: !input 'max_mired'
start_mired: '{{[state_attr(light_entity, ''max_mireds'')|int, max_mired|int]|min}}'
end_mired: '{{[state_attr(light_entity, ''min_mireds'')|int, min_mired|int]|max}}'
tick_time: '{{float(seconds) / float(range_brightness)}}'
check_entity: !input 'check_entity'
# test: '{{ as_timestamp(states(sensor)) }}'
# test2: '{{ states(sensor) }}'
# test3: '{{ state_attr(sensor,''timestamp'') }}'
# test4: '{{ sensor }}'
# teset5: '{{ (state_attr(sensor,''timestamp'') + as_timestamp(states(''sensor.date''))) - as_timestamp(states(''sensor.date_time_iso'')) }}'
trigger:
- platform: time_pattern
minutes: '*'
condition:
- condition: template
value_template: '{{ sensor != ''no_alarm'' }}'
action:
# - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- wait_template: '{{0 < as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now()) <= float(seconds)
and states(check_entity) in [''unknown'', ''on'', ''home'']}}'
- choose: []
default: !input 'pre_sunrise_actions'
# - condition: template
# value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
# - condition: template
# value_template: '{{0 < as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now()) <= float(seconds)
# and states(check_entity) in [''unknown'', ''on'', ''home'']}}'
- choose:
- conditions:
- '{{state_attr(light_entity, ''min_mireds'') != None}}'
sequence:
- service: light.turn_on
data:
brightness: '{{start_brightness}}'
color_temp: '{{start_mired}}'
entity_id: !input 'light_entity'
default:
- service: light.turn_on
data:
brightness: '{{start_brightness}}'
entity_id: !input 'light_entity'
- repeat:
while:
# - '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
- '{{0 < as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now()) <= float(seconds)}}'
sequence:
- delay: '{{tick_time}}'
- choose:
- conditions:
- '{{0 < state_attr(light_entity, ''brightness'') | int < end_brightness | int}}'
# - '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}'
# - '{{0 < as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now()) <= float(seconds)}}'
sequence:
- choose:
- conditions:
- '{{state_attr(light_entity, ''min_mireds'') != None}}'
sequence:
- service: light.turn_on
data:
brightness: '{{(float(end_brightness) - (float(range_brightness) *
(as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now())) / float(seconds)))
| int}}'
color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired))
* ((as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor)) - as_timestamp(now())) / float(seconds)))
| int}}'
entity_id: !input 'light_entity'
default:
- service: light.turn_on
data:
brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(''sensor.date'') ~ '' '' ~ states(sensor))
- as_timestamp(now())) / float(seconds))) | int}}'
entity_id: !input 'light_entity'
- choose: []
default: !input 'post_sunrise_actions'
mode: single
max_exceeded: silent
@erik.pretorius: I have exactly the same issue. Is there any solution for the error “Error executing script. Error for wait_template at pos 2: In ‘template’ condition: TypeError: unsupported operand type(s) for -: ‘float’ and ‘NoneType’” available?
Hi, no nothing yet.
I got a similar, but not the same error immediately after importing the Blueprint and creating an automation. I just assigned a Hue-Lamp connected via ConbeeII.
Error executing script. Error for wait_template at pos 2: In ‘template’ condition: TypeError: unsupported operand type(s) for -: ‘NoneType’ and ‘NoneType’
have you bee nable to solve your issue?