Creating a alarm clock

that is one way to do it. but triggering the automation every minutes (even though stop by the condition) is something I’m not comfortable with. I feel it is putting unnecessary stress on my little Pi.

Masterkenobi,

I get your point. May you share your config?

i’m not sure what would be the worst, the trick you used using the time sensor actually checks the value_template to see if it’s being triggered every minute as well because the state of the time sensor changes every minute triggering a state_change which in turn triggers a check on the trigger template’s value_template because the state of your time sensor changed and it’s used in value_template

So not sure if using the time sensor with trigger template or a trigger that fires every minute makes a lot of diffrence … If you check the code you can see that template sensors only check the value_template if one of the states of the entities used in the value_template change.

My method doesn’t trigger the automation every minutes. Yes, it checks for the state change every minute but it didn’t actually trigger the automation and have to be stop by an additional condition.

There is no right or wrong. I guess it just a matter of preference.

Is it possible to repost the full code just like list time MasterKenobi? It is super helpful and I use that every iteration! Thanks!

I have put it up in Github for easier to manage.

4 Likes

Hi masterkenobi, thanks for your work. I really appreciate it. However, after implementing your files into my HA I can only see the alarmclock in my dashboard, all the other devices are gone. Which files do I need to modify to fix this? Thanks in advance.

Don’t copy exactly. The files are just for example. You can learn more about groups at https://home-assistant.io/components/group/

Thanks for the fast reply. Yeah, I figured that I can just edit the groups file and uncomment the default_view line. Now I see entities ony my dashboard that I actually don’t need to see but I guess that can be streamlined later.

I am not that good with all this yaml, so i decided to make a clock alarm in python instead. I’d post it on github: https://github.com/nvanggaard/clockalarm

At the moment it only works with philips hue, but i believe that it is fairly easy to modify and make it work with other stuff.

I might one day, make it generic such that it works with everything.

1 Like

If you understand HA, you can use my sample to create all kinds of automations using components that are already supported by HA, not just Hue.

I don’t know python but you know and you can create custom components. I’m sure it is easy for you to learn HA.

I know It can be done using YAML in HA but I think making a custom_component is a better way.

And yes, it can be made for all kinds of components, I just haven’t figured out which method is the best yet :slight_smile:

Good job masterkenobi (and thanks for the code!)! Works excellent with my system!

Implementing it gave me good reason for cleaning up my sensors/automations :slight_smile:

Hi,

I just want to go further the processus to create an alarm on a specific time. I want to get an alarm on weekend day at a specific time only if weather outside is OK to go running / biking or skiing :slight_smile:

Do I need to create another alarm or modify this to get a more complex automation script ?

Thanks :slight_smile:

you can duplicate the existing alarm clock and add new condition in the automation. for example…

  - condition: state
    entity_id: sensor.owm_rain
    state: 'not raining'

Hello!

This topic inspired me to my first HA project. I’m new to YAML but not really to coding in general and I can’t get my natural wakeup to work. My light cannot use “transition” so I decided to make a script out of it.

My setup in the dashboard looks like this (don’t mind 23:01, it’s for testing :grin: ):

I want to be able to choose for how long the light will transition into full brightness!
I’m going to do it in 10 steps with 10% brightness, 20% brightness etc… so the script has to fetch from the slider, how long time the delay between every increment is.

The script right now looks like this and are being called succesfully from the trigger. For the purpose of testing, I’m putting the value of the slider directly as the delay time:

script:
  wakeuplight_script_fade:
    alias: Wakeup Light Fading
    sequence:
      - alias: Wakeup Light 10
        service: light.turn_on
        entity_id: light.light1
        data:
          brightness: 40
      - delay:
          minutes: '{{ states.input_slider.wakeuplight_fade.state | int }}'
      [and then repeat the brightness increment]

The “wakeuplight_fade” is the fading time slider shown in the dashboard.
This script runs through without problem if I use an integer instead of the slider state.

Why can’t delay understand the slider state?

Best regards

2 Likes

After digging around some more I actually found out how to do it!

- delay: '00:{{ states.input_slider.wakeuplight_fade.state | int }}:00'

That’s the key! :slight_smile:

Thanks @masterkenobi . I kind of used your codes by a shameless copy into my system ; working great so far :smile:

could u post your whole code? nice functio with fade.:eyes:

Please post your finished code, I’m a zombie in the morning :slight_smile: