Wake-up light alarm with sunrise effect

Hey All, so I have everything set up and all other integrations work (mostly as intended). For whatever reason, no matter what I set the start value at on a few different brands of lights the lowest I can get one of them is 54% brightness. The light that I want to use starts at 100% no matter what.

Does anyone have any ideas on what might be causing the high start value?

Soo. One a bit more complicated problem. I have this Automation and I transferred it to a Automation w/o all the blueprint stuff. Now the time stuff is working, like starting 10 Minutes before the alarm and also the pre and post sunrise effect action are getting fired. Now just the brightness is the problem. It starts at 1 brightness then nothing happens(Like not getting brighter) for ~8:45 minutes and then it turns off. Also the trace is not longer available after that. Not sure what’s really happening with that.

###############################################################################
#                _                        _   _
#     /\        | |                      | | (_)
#    /  \  _   _| |_ ___  _ __ ___   __ _| |_ _  ___  _ __  ___
#   / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
#  / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
# /_/    \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
#
###############################################################################

automation:

###############################################################################
# Alarm clock - Light with sunrise
###############################################################################

  - alias: Alarm Clock - Light with sunrise
    variables:
      light_entity: group.schlafzimmer
      sensor: sensor.sm_g998b_next_alarm
      sunrise_duration: 10
      start_brightness: 1
      end_brightness: 254
      range_brightness: '{{float(end_brightness)-float(start_brightness)}}'
      manual_time: 07:00:00
      seconds: '{{float(sunrise_duration) * 60}}'
      min_mired: 0
      start_mired: '{{state_attr(light_entity, ''max_mireds'')}}'
      end_mired: '{{[state_attr(light_entity, ''min_mireds'')|int(0), min_mired|int(0)]|max}}'
      tick_time: '{{float(seconds) / float(range_brightness)}}'
      check_entity: device_tracker.sm_g998b
    trigger:
    - platform: time_pattern
      minutes: '*'
    condition: []
    action:
    - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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:
        - service: script.toggle
          target:
            entity_id: script.pre_sunrise_actions
    - condition: template
      value_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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, ''min_mireds'') != None}}'
        sequence:
        - service: light.turn_on
          data:
            brightness: '{{start_brightness}}'
            color_temp: '{{start_mired}}'
          entity_id: group.schlafzimmer
      default:
      - service: light.turn_on
        data:
          brightness: '{{start_brightness}}'
        entity_id: group.schlafzimmer
    - repeat:
        while:
        - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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(0) < end_brightness |
              int}}'
            - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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, ''min_mireds'') != 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(0)}}'
                    color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired))
                      * ((as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'')
                      ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds)))
                      | int(0)}}'
                  entity_id: group.schlafzimmer
              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(0)}}'
                entity_id: group.schlafzimmer
    - choose: []
      default:
        - service: script.toggle
          target:
            entity_id: script.post_sunrise_actions
    mode: single
    max_exceeded: silent


########################################################################
#  ____                  _           _         
# / ___|    ___   _ __  (_)  _ __   | |_   ___ 
# \___ \   / __| | '__| | | | '_ \  | __| / __|
#  ___) | | (__  | |    | | | |_) | | |_  \__ \
# |____/   \___| |_|    |_| | .__/   \__| |___/
#                           |_|                
########################################################################

script:

  pre_sunrise_actions:
    sequence:

      - service: switch.turn_on
        target:
          entity_id:
          - switch.touch1_flur
          - switch.touch2_schlafzimmer
          - switch.touch4_kuche
          - switch.touch5_wohnzimmer
          - switch.touch6_badezimmer
      - delay: 00:00:10
      - service: light.turn_off
        target:
          entity_id:
          - light.badezimmer_lampe_1
          - light.badezimmer_lampe_2
          - light.flur_lampe_1
          - light.flur_lampe_2
          - light.kuche_lampe_1
          - light.kuche_lampe_2
          - light.wohnzimmer_lampe_1
          - light.wohnzimmer_lampe_2
      - service: input_boolean.turn_on
        entity_id: 
          - input_boolean.alarm_clock_running

  post_sunrise_actions:
    sequence:
      - service: media_player.play_media
        data:
          media_content_id: startmyday
          media_content_type: routine
        target:
          entity_id: media_player.echo_dot_schlafzimmer
      - delay: 00:02:10
      - service: media_player.volume_set
        target:
          entity_id: media_player.uberall
        data:
          volume_level: 0.25
      - service: media_player.play_media
        data:
          media_content_id: Radio Hamburg in überall
          media_content_type: TUNEIN
        target:
          entity_id: media_player.echo_dot_wohnzimmer
      - service: input_boolean.turn_off
        entity_id: 
          - input_boolean.alarm_clock_running

Hi there, hope there’s someone knowledgeable that can help me with this. I’m a day 1 newbie and although borderline illiterate with code, most of the time I can about figure out how to botch together what I need.

I can’t get the automation to activate. When checking the Trace Timeline I’m getting the following message. Does anyone know how to resolve this?

Triggered by the time pattern at 28 December 2021, 18:45:00

Wait for a template to render true

Wait for a template to render true

Stopped because an error was encountered at 28 December 2021, 18:45:00 (runtime: 0.03 seconds)

In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'


This is the accompanying message from the error log:

Logger: homeassistant.components.automation.wake_up_light_alarm_with_sunrise_effect
Source: components/automation/__init__.py:512
Integration: Automation (documentation, issues)
First occurred: 18:12:00 (47 occurrences)
Last logged: 18:56:00

Error while executing automation automation.wake_up_light_alarm_with_sunrise_effect: In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

Thanks in advance guys!

I have the same issue. Is there any solution for it?

Looks like automations created with this blueprint are throwing some errors:

2021-12-29 15:40:00 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'as_timestamp' got invalid input 'unavailable' when rendering 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']}}' but no default was specified. Currently 'as_timestamp' will return 'None', however this template will fail to render in Home Assistant core 2022.1

You can try to change all “none”'s in the template to “None”. That’s work for me, but after this change I get the same error as @vitek and @vajdum

Edit: At first use of this blueprint I get this TypeError, but after playing around and type again “none” everything works fine. Maybe you have to type it in, even when the fild contains “none” already?!

The Error “Stopped because only a single execution is allowed at …” seems to be okay, you have to look at the first trace were the automation is “still running” (HA prevent to restart a new run in single-mode, see Automation Modes).

New to HA and wanted to say thanks for this blueprint, it provided a great base for the functionality I wanted.
I’ve added support to add a speaker that slowly increases the volume in combination with the light. This is tested with a Sonos speaker (IKEA Symfonisk). I’m using IKEA Trådfri bulbs so I also had to do some minor changes to how brightness is set. I’ve also added the possibility to lock the color temperature to the set value (incase you want to only increase brightness) and fixed some minor issues with the timestamps.

The issue with the timestamps came from that sensor.time_date_time_iso doesn’t include the timezone information while now() does. So when converted to timestamps, they give different times.

{{states('sensor.date_time_iso')}} = 2022-01-08T20:05:00
{{now()}} = 2022-01-08 20:05:00.004820+01:00

When converted, these should give the same time but

{{as_timestamp(states('sensor.date_time_iso'))}} = 1641672300.0
{{as_timestamp(now())}} = 1641668700.004835

This problem also applies when setting the time manually as

states(''sensor.date'') ~ '' '' ~ manual_time)

also lacks information about the timezone.

Below is my full code with the added functionality and fixes incase it’s useful for someone.
EDIT: I fell victim for the “never post anything until fully tested”. Fixed the code below.

blueprint:
  name: Wake-up light and music alarm with sunrise effect and increasing volume
  description: 'A wake-up light and music alarm with a brightness and color temperature sunrise effect and increasing volume.
    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
    speaker_entity:
      name: Wake-up speaker entity
      description: The speaker to control. Turning it off during the wake-up will keep
        it off.
      selector:
        entity:
          domain: media_player
    music_source:
      name: Sound source
      description: What the speaker should play
      selector:
        select:
          options:
            - Radio Nova
            - Radio SuomiPop
    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 wake-up 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: {}
    wakeup_duration:
      name: Wake-up duration
      description: The wake-up 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 in percentage
      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: 100.0
          step: 1.0
          mode: slider
    end_brightness:
      name: Maximum brightness in percentage
      description: The brightness will be transitioned from the minimum to the configured
        value.
      default: 100
      selector:
        number:
          min: 5.0
          max: 100.0
          step: 1.0
          mode: slider
    min_mired:
      name: Minimum color temperature
      description: 'The minimum color temperature to use. (0: lowest supported)'
      default: 0
      selector:
        number:
          min: 0.0
          max: 500.0
          step: 5.0
          mode: slider
          unit_of_measurement: mired
    lock_mired:
      name: Lock color temperature
      description: Lock the color temperature to the selected minimum temperature
      default: false
      selector:
        boolean:
    start_volume:
      name: Minimum volume
      description: The volume to start with
      default: 1
      selector:
        number:
          min: 1.0
          max: 100.0
          step: 1.0
          mode: slider
    end_volume:
      name: Maximum volume
      description: The volume will be transitioned from the minimum to the configured
        value.
      default: 20
      selector:
        number:
          min: 5.0
          max: 100.0
          step: 1.0
          mode: slider
    pre_wakeup_actions:
      name: Pre-wakeup actions
      description: Optional actions to run before wake-up starts.
      default: []
      selector:
        action: {}
    post_wakeup_actions:
      name: Post-wakeup actions
      description: Optional actions to run after wake-up ends (around the alarm time).
      default: []
      selector:
        action: {}
variables:
  light_entity: !input 'light_entity'
  speaker_entity: !input 'speaker_entity'
  music_source: !input 'music_source'
  sensor: !input 'timestamp_sensor'
  wakeup_duration: !input 'wakeup_duration'
  start_brightness: !input 'start_brightness'
  end_brightness: !input 'end_brightness'
  range_brightness: '{{float(end_brightness) - float(start_brightness)}}'
  min_mired: !input 'min_mired'
  lock_mired: !input 'lock_mired'
  start_mired: '{{state_attr(light_entity, ''max_mireds'')}}'
  end_mired: '{{[state_attr(light_entity, ''min_mireds'') | int(0), min_mired | int(0)] | max}}'
  range_mired: '{{float(start_mired) - float(end_mired)}}'
  start_volume: !input 'start_volume'
  end_volume: !input 'end_volume'
  range_volume: '{{float(end_volume) - float(start_volume)}}'
  manual_time: !input 'manual_time'
  seconds: '{{float(wakeup_duration) * 60}}'
  tick_time: '{{float(seconds) / float(range_brightness)}}'
  check_entity: !input 'check_entity'
trigger:
- platform: time_pattern
  minutes: '*'
action:
- wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}'
- wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
  - as_timestamp(now()) <= float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}'
- choose: []
  default: !input 'pre_wakeup_actions'
- condition: template
  value_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}'
- condition: template
  value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
    - 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_pct: '{{start_brightness}}'
        color_temp: '{{end_mired + 1 if lock_mired else start_mired}}'
      entity_id: !input 'light_entity'
  default:
  - service: light.turn_on
    data:
      brightness_pct: '{{start_brightness}}'
    entity_id: !input 'light_entity'
- service: media_player.volume_set
  data:
    volume_level: '{{float(start_volume / 100)}}'
    entity_id: !input 'speaker_entity'
- service: media_player.select_source
  data:
    source: !input 'music_source'
    entity_id: !input 'speaker_entity'
- repeat:
    while:
    - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}'
    - '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
      - as_timestamp(now()) <= float(seconds)}}'
    sequence:
    - delay: '{{tick_time}}'
    - choose:
      - conditions:
        - '{{0 < state_attr(light_entity, ''brightness'') | int(0) < float(end_brightness) / 100 * 255 | int(0)}}'
        sequence:
        - choose:
          - conditions:
            - '{{state_attr(light_entity, ''min_mireds'') != None}}'
            sequence:
            - service: light.turn_on
              data:
                brightness_pct: '{{float(end_brightness) - ([0, float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
                  - as_timestamp(now())) / seconds, float(end_brightness)]|sort)[1] | round(0)}}'
                color_temp: '{{end_mired if lock_mired else
                  float(end_mired) + ([0, float(range_mired) * (as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
                  - as_timestamp(now())) / seconds, float(start_mired)]|sort)[1] | round(0)}}'
              entity_id: !input 'light_entity'
          default:
          - service: light.turn_on
            data:
              brightness_pct: '{{float(end_brightness) - ([0, float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
              - as_timestamp(now())) / seconds, float(end_brightness)]|sort)[1] | round(0)}}'
            entity_id: !input 'light_entity'
    - choose:
      - conditions:
        - '{{0 < state_attr(speaker_entity, ''volume_level'') * 100 | round(0) < float(end_volume) - ([0, float(range_volume) * (as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
          - as_timestamp(now())) / seconds, float(end_volume)]|sort)[1] | round(0) <= float(end_volume)}}'
        sequence:
        - service: media_player.volume_set
          data:
            volume_level: '{{(float(end_volume) - ([0, float(range_volume) * (as_timestamp(states(sensor) if sensor != ''none'' else (states(''sensor.date'') ~ '' '' ~ manual_time) | as_datetime() | as_local())
              - as_timestamp(now())) / seconds, float(end_volume)]|sort)[1]) / 100 | round(2)}}'
          entity_id: !input 'speaker_entity'
- choose: []
  default: !input 'post_wakeup_actions'
mode: single
max_exceeded: silent
2 Likes

Hello, did you manage to fix the issue? I have the exact same problem. If i try to trigger the action manually it stops with the following error.

In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

This is my automation config:

variables:
  light_entity: light.0x842e14fffe0ea4b1
  sensor: none
  sunrise_duration: 25
  start_brightness: 1
  end_brightness: 254
  range_brightness: '{{float(end_brightness)-float(start_brightness)}}'
  manual_time: '18:50:00'
  seconds: '{{float(sunrise_duration) * 60}}'
  min_mired: 0
  start_mired: '{{state_attr(light_entity, ''max_mireds'')}}'
  end_mired: '{{[state_attr(light_entity, ''min_mireds'')|int(0), min_mired|int(0)]|max}}'
  tick_time: '{{float(seconds) / float(range_brightness)}}'
  check_entity: none
trigger:
  - platform: time_pattern
    minutes: '*'
condition: []
action:
  - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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:
      - service: switch.turn_off
        target:
          entity_id: switch.circadian_lighting_circadian_lighting
  - condition: template
    value_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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, ''min_mireds'') != None}}'
        sequence:
          - service: light.turn_on
            data:
              brightness: '{{start_brightness}}'
              color_temp: '{{start_mired}}'
            entity_id: light.0x842e14fffe0ea4b1
    default:
      - service: light.turn_on
        data:
          brightness: '{{start_brightness}}'
        entity_id: light.0x842e14fffe0ea4b1
  - repeat:
      while:
        - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != 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(0) <
                  end_brightness | int}}
                - >-
                  {{sensor == 'none' or as_timestamp(states(sensor), None) !=
                  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, ''min_mireds'') != 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(0)}}
                            color_temp: >-
                              {{(float(end_mired) + (float(start_mired) -
                              float(end_mired)) * ((as_timestamp(states(sensor)
                              if sensor != 'none' else states('sensor.date') ~ '
                              ' ~ manual_time) - as_timestamp(now())) /
                              float(seconds))) | int(0)}}
                          entity_id: light.0x842e14fffe0ea4b1
                  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(0)}}
                      entity_id: light.0x842e14fffe0ea4b1
  - choose: []
    default:
      - service: mqtt.publish
        data:
          qos: '2'
          topic: shellies/shellyswitch25-BCDDC277A609/roller/0/command/pos
          payload: '100'
      - service: switch.turn_on
        target:
          entity_id: switch.circadian_lighting_circadian_lighting
mode: single
max_exceeded: silent
id: '1641938484000'
alias: Wake-up light alarm with sunrise effect
description: ''

and this is my blueprint config

id: '1641938484000'
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.0x842e14fffe0ea4b1
    pre_sunrise_actions:
      - service: switch.turn_off
        target:
          entity_id: switch.circadian_lighting_circadian_lighting
    post_sunrise_actions:
      - service: mqtt.publish
        data:
          qos: '2'
          topic: shellies/shellyswitch25-BCDDC277A609/roller/0/command/pos
          payload: '100'
      - service: switch.turn_on
        target:
          entity_id: switch.circadian_lighting_circadian_lighting
    manual_time: '18:50:00'

Same error for me. The automation doesn’t work :frowning:

In case it helps anyone else, I hacked (it’s gross) my version of this blueprint to accomodate what I assume are issues related to this breaking change as mentioned in the release notes of 2021.12: Add datetime object as valid StateType by frenck · Pull Request #52671 · home-assistant/core · GitHub

I deleted the timestamp device class from my sensor, so now it just reads:

sensors:
  - platform: template
      alarm_time_with_date:
        friendly_name: "Alarm Time with Date"
        value_template: "{{states('sensor.date')~' '~states('input_datetime.alarm')}}"

I then modified my local version of /config/blueprints/automation/Sbyx/wake-up-light-alarm-with-sunrise-effect.yaml and changed line 21 to just specify the domain as a sensor instead of device_class as timestamp. I will probably pay for these sins later.

    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:
          domain: sensor

This allowed me to then select my sensor.alarm_time_with_date as my alarm timestamp sensor. It seems to be working based on one test, but I’ll go to bed now and see how it goes in a few hours. :slight_smile:

2 Likes

this worked for me as well!
However, is this breaking change not addressed in the updated version by @sbyx from nov '21?

1 Like

hey,
I love this blueprint and it’s really awesome,
but I do want to ask a small question…
regarding for creating a timestamp and using it, i"m a bit of a noob, so i apologize in advance
i scanned the thread and found 2 mentions for how to create a time stamp, i used that, and i can see in the blueprint the newly created time stamp,
but what I fail to do, is to assign a time for that sensor… i searched google for examples, but I did not understand those examples that i found…

help would be appreciated :slight_smile:

Hi there,

First I would like to thank you for your contribution. It’s a really nice blueprint you made.
But I just created an automation from your blueprint and encountered an error. Let me give you some details:

  • Running home assistant on Docker
  • Version: Home Assistant 2021.12.10
  • Automation setup: just trigger based on time. No additional conditions set up.
  • Error Message: Stopped because an error was encountered at 30 January 2022, 09:04:00 (runtime: 0.01 seconds) In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

Hope this helps you troubleshoot the problem.

Cheers,
Amer

1 Like

Hi, nice blueprint.

Small suggestion:
replace states(''sensor.date'') with now().date() and as_timestamp(states(''sensor.date_time_iso'')) with as_timestamp(now()).

Then it is no longer required to use the time_date integration for the sensors, which makes it easier to integrate this blueprint.

Hi @TheFes, have you implemented your suggestion? I tried it, but it breaks the automation completely for me. I’m super confused, since I’ve double-checked that now().date gives the same value as states(''sensor.date''), and as_timestamp(now()) is very close to as_timestamp(states(''sensor.date_time_iso'')).

Both replacements result in errors. If I replace only as_timestamp(states(''sensor.date_time_iso'')), I get the following error:
sunrise test: Error executing script. Error for wait_template at pos 2: In 'template' condition: AttributeError: 'datetime.datetime' object has no attribute 'lower'

If I replace states(''sensor.date'') or both, I get:
sunrise test: Error executing script. Error for wait_template at pos 2: In 'template' condition: TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'

I wonder if something needs to be typecasted to a different form. Any ideas?

Sorry, no, not properly.
I guess I better not posted it, as I don’t use this myself, I just stumbled upon it.

Might be better to leave it as it is.

Is there a way that I can debug each step of the blueprint? The best way where a file for each day which can be checked with diff.

I use these from Monday to Thursday to wake me up and I works fine, except on Tuesday.I use only one setting with the template with 1- 4 isoweekday. Why the behavior on Tuesday is different is not understandable for me, so I would look to catch this.

I have the same issue as aaljovic with

How do we fix this???

In ‘template’ condition: TypeError: unsupported operand type(s) for -: ‘NoneType’ and 'NoneType

1 Like

Same here!
Let’s try to find a common point in setups with and without the issue.

version: core-2022.2.2
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.4.0-1047-raspi
arch: aarch64
timezone: Europe/Lisbon

Same here, also got this error message:

In ‘template’ condition: TypeError: unsupported operand type(s) for -: ‘float’ and ‘NoneType’

Then I figured out just RTFM !!! This fixed the error’s. Will test the automation now.

Cheers, Daniel