My Fade in Alarm Clock with Snooze

I have had an alarm clock that fades in the lights & morning radio for a while, but wanted to overhaul it to be a little smarter with a snooze function in Node-Red so here it is.

Import the whole flow: https://pastebin.com/DVjrMEkt
More notes and images:

I created a couple of entities in HA to track the state of alarm clock and input the time:

input_boolean:
  # Switch to Enable Alarm Clock
  house_option_alarmclock:
    name: Alarm Clock
    initial: off
    icon: mdi:alarm
  # Used by Automation to enable Snooze
  house_alarmclock_snooze:
    name: Snoozing
    initial: off
    icon: mdi:alarm-snooze
  # Used by Automation to track if alarm clock is running
  house_alarmclock_active:
    name: Snoozing
    initial: off
    icon: mdi:alarm-snooze
  # Optional: Enable radio for sequence
  house_alarmclock_radio:
    name: Alarm Radio
    initial: on
    icon: mdi:radio

input_datetime:
  # The Alarm Time input by the User
  alarmclock_time:
    name: Alarm Time
    has_date: false
    has_time: true

I want the lights and local public radio to fade slowly over 10 minutes, ending at my alarm time. So first I use the moment node to subtract 10 minutes and compare to the current time, and then start the rest of the automation.

I start the flow by initializing some flow variables for the volume and brightness to 0. Then start the coffee :).

Then the fade-in is accomplished by injecting the flow variables at regular intervals into a traffic light. The alarm clock and the snooze control the traffic lights. When a message makes it through the appropriate service call is made, and the flow variable is incremented for the next injection.

I use a simple Z-wave button for a snooze. If the snooze is hit while the alarm clock is running, it closes the traffic lights and resets the flow variables to 30% (so when the sequence starts again, it runs for 7 mins vs. the full 10).

When the lights hit 100% brightness, I turn the alarm clock off and then run the rest of my script - make weather announcement via Alexa TTS, Set Scene for the rest of the house, etc.

Hope someone else finds this useful :slight_smile:

8 Likes

I really enjoy reading your blog, it’s been very helpful to me !
This looks very nice, I’ll definitly try it .

Cheers

1 Like

How do you make the weather announcement? Is there a script you are calling?

I’m using the media_player.alexa_tts service from this component:. I just send the template to it for speech.

Just wanted to say thanks for posting this. I adapted it to my own setup, and it works well! Only issue is the alarm doesn’t go off if you forget to set it lol

1 Like

Great write up on this!

I’m having a go at integrating this into my setup, but I want to make a few changes.

Is there a way of delaying the radio so that this only comes on at the actual alarm clock time?

So I made a few changed to this alarm clock. One of which was to simplify (in my eyes) the trigger part of the flow: Basically, as soon as you set the time it passes this time to the schedex node.

The next part complicates things though as I wanted the lights to brighten over 10 mins, then the radio to start playing (whilst also fading up).

To do this I added a seconf variable in Homeassistant (radio_state). And then made a second flow which is similar to the first, but this one controls the radio.

I also use a xiaomi button which snoozes the alarm, and a long press of the button resets the alarm (stops the radio and freezes the lights whilst stopping any more brightening and volume adjustments.

I have added all the node red code below for the two flows. I’m sure that they could be made much more slick, but my skills are rather hackey!

Alarm clock:
https://pastebin.com/C5Mj4H9p

Radio part:
https://pastebin.com/KRV7xi1c

Hi.
I want to thank for the integration.
Now im starting to move in to Node-Red and I immediately had a question with the variable “Home Assistant - Variable” - there is no Variable integration in the Home Assitant. Is this a custom addition?
Thank’s

Thanks so much, I’ve beenlooking for something like this. I pretty much have it up and running. Where I’m having tyrouble is with the xiaomi button. Could you explain how you have that setup. Total noob with node red so a noobish answer would be most helpful

Thanks in advance

You have to add that variable into home assistant (Yaml).

This is how I grab a button press from a Xiaomi button (using deconz).

Screenshot 2020-02-10 at 06.59.37

[{"id":"a293466e.fd47c8","type":"server-events","z":"bfd4c3fe.fc7c","name":"","server":"cfa79f02.db9d4","event_type":"deconz_event","x":140,"y":1120,"wires":[["c4e82e7c.397fd"]]},{"id":"c4e82e7c.397fd","type":"switch","z":"bfd4c3fe.fc7c","name":"Dimmer Kitchen","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"dimmer_kitchen","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":140,"y":1180,"wires":[["9ef9f19d.5c56b"]]},{"id":"9ef9f19d.5c56b","type":"switch","z":"bfd4c3fe.fc7c","name":"Button press?","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1002","vt":"str"},{"t":"eq","v":"2002","vt":"str"},{"t":"eq","v":"3002","vt":"str"},{"t":"eq","v":"4002","vt":"str"},{"t":"eq","v":"4001","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":420,"y":1177,"wires":[["21e9ea47.76ab76","2b6ebd9c.0f4fe2","dd677ea3.a2324","38cad135.f9113e","b1f96fa3.2b8c5"],["a3392925.5c8f78","71b81fc9.04342","340ea05c.02e09","b1f96fa3.2b8c5"],["710af407.a32c9c","d2bf76b2.ecff78","c9821978.e2f858","83f450ef.56575","d9f1efa9.672a5","b7d287b9.3ef3f8","b1f96fa3.2b8c5"],["d6b1be21.b3e2","b1f96fa3.2b8c5"],["95bfe478.996218","b1f96fa3.2b8c5"]]},{"id":"cfa79f02.db9d4","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

This alarm clock was failing quite regularly for me, so I have simplified it even more (than my other simplification post above) using a node called lullaby that is a light dimmer / brightener node. See the code…

The only additions in YAML that you need are an input datetime for the time input, and and input boolean which sets the alarm to come on at weekends too:

input_datetime:
  alarmclock_time:
    name: Alarm Time
    has_date: false
    has_time: true
alarm_clock_weekend:
  name: Alarm Clock Weekend?
  initial: off
[{"id":"7342fdca.164ea4","type":"tab","label":"Alarm Clock","disabled":false,"info":""},{"id":"62de93c4.49444c","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":150,"y":40,"wires":[]},{"id":"c4c471e7.851ff","type":"comment","z":"7342fdca.164ea4","name":"Snooze","info":"","x":90,"y":440,"wires":[]},{"id":"d2bad75.095dd28","type":"trigger-state","z":"7342fdca.164ea4","name":"alarm time","server":"cfa79f02.db9d4","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_datetime.alarmclock_time","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":130,"y":100,"wires":[["4719f95.75ab108"],[]]},{"id":"4719f95.75ab108","type":"function","z":"7342fdca.164ea4","name":"set time - offset","func":"varAlarmTime = msg.payload;\nmsg.payload = {};\nmsg.payload.ontime = varAlarmTime\nmsg.payload.offtime = varAlarmTime\nmsg.payload.onoffset = -10\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":100,"wires":[["d96d39ad.ed5278"]]},{"id":"17905c3e.7d4484","type":"api-current-state","z":"7342fdca.164ea4","name":"alarm set?","server":"cfa79f02.db9d4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.house_option_alarmclock","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":870,"y":100,"wires":[["b4516dd2.ce5ee","89749a12.b85598"],[]]},{"id":"2293775.967dc88","type":"function","z":"7342fdca.164ea4","name":"set day","func":"varAlarmDay = msg.payload;\nmsg.payload = {};\nmsg.payload.sat = varAlarmDay\nmsg.payload.sun = varAlarmDay\n\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":200,"wires":[["d96d39ad.ed5278"]]},{"id":"cc6a712c.05a1d","type":"trigger-state","z":"7342fdca.164ea4","name":"alarm day","server":"cfa79f02.db9d4","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_boolean.alarm_clock_weekend","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":120,"y":160,"wires":[["c3e410a8.84a9e"],[]]},{"id":"c3e410a8.84a9e","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"true","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":160,"wires":[["2293775.967dc88"]]},{"id":"d96d39ad.ed5278","type":"schedex","z":"7342fdca.164ea4","name":"alarm radio","suspended":false,"lat":"","lon":"","ontime":"07:00","ontopic":"","onpayload":"on","onoffset":0,"onrandomoffset":0,"offtime":"07:01","offtopic":"","offpayload":"","offoffset":"","offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":false,"sun":false,"x":590,"y":100,"wires":[["17905c3e.7d4484"]]},{"id":"b4516dd2.ce5ee","type":"afya-lullaby","z":"7342fdca.164ea4","name":"","dimmingTime":"360","startValue":"0","stopValue":"100","step":1,"x":870,"y":560,"wires":[["ddf724f4.cf0078"]]},{"id":"c10baed7.f6061","type":"api-call-service","z":"7342fdca.164ea4","name":"Increase light","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.masterbedmorning, light.tall_black_lamp, light.ensuite_1","data":"{\"brightness_pct\":\"{{ payload.value }}\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1270,"y":560,"wires":[[]]},{"id":"23788a93.5b26f6","type":"api-call-service","z":"7342fdca.164ea4","name":"Turn Off Bedroom Lights","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.masterbedmorning, light.tall_black_lamp, light.ensuite_1","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":650,"y":480,"wires":[[]]},{"id":"628be703.cdb0b8","type":"trigger","z":"7342fdca.164ea4","op1":"kill","op2":"on","op1type":"str","op2type":"str","duration":"1","extend":false,"units":"min","reset":"","bytopic":"all","name":"","x":610,"y":560,"wires":[["b4516dd2.ce5ee"]]},{"id":"1932faa7.a7ec45","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"kill","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":640,"wires":[["b4516dd2.ce5ee","ddf724f4.cf0078"]]},{"id":"ddf724f4.cf0078","type":"traffic","z":"7342fdca.164ea4","name":"","property_allow":"payload","filter_allow":"run","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"kill","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":1090,"y":560,"wires":[["c10baed7.f6061"]]},{"id":"89749a12.b85598","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"run","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":100,"wires":[["ddf724f4.cf0078"]]},{"id":"8faebb6b.8753a8","type":"afya-lullaby","z":"7342fdca.164ea4","name":"","dimmingTime":"60","startValue":"0","stopValue":"50","step":1,"x":860,"y":700,"wires":[["a594cb87.065ae8"]]},{"id":"a594cb87.065ae8","type":"api-call-service","z":"7342fdca.164ea4","name":"Increase light","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.masterbedside1","data":"{\"brightness_pct\":\"{{ payload.value }}\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1270,"y":700,"wires":[[]]},{"id":"fd4ce25e.cd939","type":"inject","z":"7342fdca.164ea4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"*/1 0 * * *","once":false,"onceDelay":0.1,"x":130,"y":240,"wires":[["d2bad75.095dd28","cc6a712c.05a1d"]]},{"id":"cfe5e54a.ba8238","type":"server-events","z":"7342fdca.164ea4","name":"Events","server":"cfa79f02.db9d4","event_type":"deconz_event","x":90,"y":600,"wires":[["babf2e8c.35d65"]]},{"id":"babf2e8c.35d65","type":"switch","z":"7342fdca.164ea4","name":"Master Snooze","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"master_snooze","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":260,"y":600,"wires":[["10f7ae9.aa07d51","f8a5b539.09ee68"]]},{"id":"10f7ae9.aa07d51","type":"switch","z":"7342fdca.164ea4","name":"Press","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1002","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":560,"wires":[["628be703.cdb0b8","23788a93.5b26f6"]]},{"id":"f8a5b539.09ee68","type":"switch","z":"7342fdca.164ea4","name":"Hold","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":640,"wires":[["1932faa7.a7ec45","6f1e9a3b.809c24"]]},{"id":"6f1e9a3b.809c24","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":700,"wires":[["8faebb6b.8753a8","abfaaada.3a0528"]]},{"id":"e2a6787d.77df98","type":"inject","z":"7342fdca.164ea4","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["17905c3e.7d4484"]]},{"id":"abfaaada.3a0528","type":"api-call-service","z":"7342fdca.164ea4","name":"Security Disarm","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"alarm_control_panel","service":"alarm_disarm","entityId":"alarm_control_panel.ha_alarm","data":"{\"code\":7780}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1280,"y":760,"wires":[[]]},{"id":"3a245d.e7e64ba4","type":"server-events","z":"7342fdca.164ea4","name":"Events","server":"cfa79f02.db9d4","event_type":"deconz_event","x":90,"y":820,"wires":[["2fa919e6.026df6"]]},{"id":"2fa919e6.026df6","type":"switch","z":"7342fdca.164ea4","name":"Master Snooze","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"dimmer_bedside","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":260,"y":820,"wires":[["2209dbc1.cb41f4"]]},{"id":"2209dbc1.cb41f4","type":"switch","z":"7342fdca.164ea4","name":"Press","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"3001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":820,"wires":[["a16c66dd.0b8048"]]},{"id":"a16c66dd.0b8048","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"kill","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":820,"wires":[["b4516dd2.ce5ee","8faebb6b.8753a8","23788a93.5b26f6"]]},{"id":"8730158a.2f7388","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":110,"y":920,"wires":[]},{"id":"3266332a.f334ac","type":"comment","z":"7342fdca.164ea4","name":"START ALARM CLOCK SEQUENCE","info":"","x":210,"y":1200,"wires":[]},{"id":"5209e7cf.6d2da8","type":"comment","z":"7342fdca.164ea4","name":"Set Initial Flow Variables","info":"","x":550,"y":1220,"wires":[]},{"id":"df803f80.00373","type":"comment","z":"7342fdca.164ea4","name":"LOOP LOGIC ","info":"","x":150,"y":1480,"wires":[]},{"id":"2bf9094d.b53506","type":"comment","z":"7342fdca.164ea4","name":"Snooze Button Actions","info":"","x":880,"y":1740,"wires":[]},{"id":"9592e0c4.41c6a","type":"comment","z":"7342fdca.164ea4","name":"Finish Alarm Sequence","info":"","x":1040,"y":1640,"wires":[]},{"id":"e8adb6ad.a352a8","type":"comment","z":"7342fdca.164ea4","name":"Snooze Timer","info":"","x":850,"y":1860,"wires":[]},{"id":"70d5801c.64fc2","type":"change","z":"7342fdca.164ea4","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"snooze","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":1660,"wires":[["1bca15b9.8cf09a"]]},{"id":"69d887e3.d82258","type":"link in","z":"7342fdca.164ea4","name":"","links":["84277412.105e18","6f31c450.2bbaac"],"x":315,"y":1660,"wires":[["70d5801c.64fc2"]]},{"id":"8b7d1725.54bb68","type":"function","z":"7342fdca.164ea4","name":"Reset to Volume","func":"flow.set(\"volume\",0.2);\nnewmsg = {\"payload\":\"true\"}\nreturn newmsg;","outputs":1,"noerr":0,"x":860,"y":1780,"wires":[["4f07dccb.6d7a94"]]},{"id":"202c8f85.f2afd","type":"delay","z":"7342fdca.164ea4","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":840,"y":1920,"wires":[["799dbb50.466654","f34105e4.e144b8"]]},{"id":"c96a2ec4.ae5d5","type":"change","z":"7342fdca.164ea4","name":"Start","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":1480,"wires":[["1bca15b9.8cf09a"]]},{"id":"1c7e29eb.557a46","type":"switch","z":"7342fdca.164ea4","name":"Is it Time?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Waking Up","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":1260,"wires":[["c96a2ec4.ae5d5","6e5fab.f3f5b054","bb23825e.05857"]]},{"id":"6e5fab.f3f5b054","type":"function","z":"7342fdca.164ea4","name":"Initialize Volume to 0","func":"flow.set(\"volume\", 0);\n\nnewmsg = {\"payload\":\"true\"}\nreturn newmsg;","outputs":1,"noerr":0,"x":540,"y":1260,"wires":[[]]},{"id":"cf542fa6.b95ba","type":"switch","z":"7342fdca.164ea4","name":"Is Loop Done?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"done","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1360,"y":1640,"wires":[["84277412.105e18"]]},{"id":"43b95f19.c2d81","type":"inject","z":"7342fdca.164ea4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":1320,"wires":[["6e5fab.f3f5b054"]]},{"id":"84277412.105e18","type":"link out","z":"7342fdca.164ea4","name":"FINISH ALARM SEQUENCE!","links":["69d887e3.d82258","45deb28f.3cb32c"],"x":1195,"y":1640,"wires":[]},{"id":"1bca15b9.8cf09a","type":"traffic","z":"7342fdca.164ea4","name":"Turn Up Volume","property_allow":"payload","filter_allow":"start","ignore_case_allow":true,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"snooze","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":640,"y":1580,"wires":[["ba649753.1c77e8"]]},{"id":"8c5e52f.48d0fb","type":"inject","z":"7342fdca.164ea4","name":"Volume ---->","topic":"","payload":"volume","payloadType":"flow","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":1580,"wires":[["1bca15b9.8cf09a"]]},{"id":"ba649753.1c77e8","type":"function","z":"7342fdca.164ea4","name":"Set Volume","func":"newmsg = {};\nvar volume = flow.get(\"volume\");\n\nnewmsg.payload = { data: { \"volume_level\":volume} }\n\nreturn newmsg;","outputs":1,"noerr":0,"x":850,"y":1580,"wires":[["8cc15c7d.342d9"]]},{"id":"8cc15c7d.342d9","type":"api-call-service","z":"7342fdca.164ea4","name":"Bedroom Speaker","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.bedroom_speaker","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1110,"y":1580,"wires":[["b893351c.b53748"]]},{"id":"b893351c.b53748","type":"function","z":"7342fdca.164ea4","name":"Increment Volume","func":"var volume = flow.get('volume')||0.0;\n\nif (volume < 0.25) {\n    volume = volume + 0.01;\n    flow.set(\"volume\", volume);\n    \n    newmsg = {\"payload\":\"looping\"}\n    return newmsg;\n}\nelse {\n    newmsg = {\"payload\":\"done\"};\n    return newmsg;\n}","outputs":1,"noerr":0,"x":1370,"y":1580,"wires":[["cf542fa6.b95ba"]]},{"id":"3eb39e16.852742","type":"comment","z":"7342fdca.164ea4","name":"SNOOZE!","info":"","x":140,"y":1720,"wires":[]},{"id":"ed721df3.7a99d","type":"comment","z":"7342fdca.164ea4","name":"VOLUME","info":"","x":620,"y":1540,"wires":[]},{"id":"78b1812d.fa222","type":"comment","z":"7342fdca.164ea4","name":"Turn on Radio","info":"","x":610,"y":1340,"wires":[]},{"id":"bb23825e.05857","type":"api-call-service","z":"7342fdca.164ea4","name":"Volume","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.bedroom_speaker","data":"{\"volume_level\":0}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":600,"y":1380,"wires":[["917a0aa6.3f5658"]]},{"id":"917a0aa6.3f5658","type":"change","z":"7342fdca.164ea4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":1380,"wires":[["c7b3dd86.23299"]]},{"id":"4f07dccb.6d7a94","type":"api-call-service","z":"7342fdca.164ea4","name":"Pause Radio","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"media_play_pause","entityId":"media_player.bedroom_speaker","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1170,"y":1780,"wires":[["b4854ef6.80d96"]]},{"id":"799dbb50.466654","type":"change","z":"7342fdca.164ea4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":1920,"wires":[["b6023d01.7a816"]]},{"id":"b6023d01.7a816","type":"api-call-service","z":"7342fdca.164ea4","name":"Play","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"media_play","entityId":"media_player.bedroom_speaker","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1270,"y":1920,"wires":[[]]},{"id":"b4854ef6.80d96","type":"change","z":"7342fdca.164ea4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1310,"y":1780,"wires":[["d442d3ad.b6ff9"]]},{"id":"d442d3ad.b6ff9","type":"api-call-service","z":"7342fdca.164ea4","name":"Volume","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.bedroom_speaker","data":"{\"volume_level\":0.1}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1480,"y":1780,"wires":[[]]},{"id":"44f77a49.1cb704","type":"comment","z":"7342fdca.164ea4","name":"Snooze Button","info":"","x":160,"y":1900,"wires":[]},{"id":"1f5b1320.be8a4d","type":"change","z":"7342fdca.164ea4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1190,"y":1380,"wires":[["1a1da284.49ae5d"]]},{"id":"1a1da284.49ae5d","type":"api-call-service","z":"7342fdca.164ea4","name":"Volume","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.bedroom_speaker","data":"{\"volume_level\":0}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1340,"y":1380,"wires":[[]]},{"id":"c7b3dd86.23299","type":"cast-to-client","z":"7342fdca.164ea4","name":"","url":"http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p","contentType":"audio/basic","message":"","language":"en","ip":"192.168.1.14","port":"8009","volume":"","x":1010,"y":1380,"wires":[["1f5b1320.be8a4d"]]},{"id":"a4b45af2.8fe1c8","type":"server-events","z":"7342fdca.164ea4","name":"Events","server":"cfa79f02.db9d4","event_type":"deconz_event","x":130,"y":1960,"wires":[["d0df6f67.e0d4"]]},{"id":"d0df6f67.e0d4","type":"switch","z":"7342fdca.164ea4","name":"Master Snooze","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"master_snooze","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":300,"y":1960,"wires":[["9acc15dd.b36878","336b159c.c16b4a"]]},{"id":"9acc15dd.b36878","type":"switch","z":"7342fdca.164ea4","name":"press","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1002","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":1920,"wires":[["5829f591.2e0e3c","6f31c450.2bbaac"]]},{"id":"98ae7ba5.e199e8","type":"function","z":"7342fdca.164ea4","name":"set time - actual","func":"varAlarmTime = msg.payload;\nmsg.payload = {};\nmsg.payload.ontime = varAlarmTime\nmsg.payload.offtime = varAlarmTime\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":1000,"wires":[["d65a45a8.99fb38"]]},{"id":"d65a45a8.99fb38","type":"schedex","z":"7342fdca.164ea4","name":"alarm radio","suspended":false,"lat":"","lon":"","ontime":"07:00","ontopic":"","onpayload":"on","onoffset":0,"onrandomoffset":0,"offtime":"07:01","offtopic":"","offpayload":"","offoffset":"","offrandomoffset":0,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":false,"sun":false,"x":510,"y":1000,"wires":[["9cde0fa4.b74fb"]]},{"id":"9cde0fa4.b74fb","type":"api-current-state","z":"7342fdca.164ea4","name":"alarm set?","server":"cfa79f02.db9d4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.house_option_alarmclock","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":790,"y":1000,"wires":[["5fdf753.68ced8c"],[]]},{"id":"3014c8f5.f13a68","type":"trigger-state","z":"7342fdca.164ea4","name":"alarm time","server":"cfa79f02.db9d4","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_datetime.alarmclock_time","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":130,"y":1000,"wires":[["98ae7ba5.e199e8"],[]]},{"id":"5fdf753.68ced8c","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"Waking Up","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":1000,"wires":[["1c7e29eb.557a46"]]},{"id":"46fd8ee6.e259d","type":"function","z":"7342fdca.164ea4","name":"set day","func":"varAlarmDay = msg.payload;\nmsg.payload = {};\nmsg.payload.sat = varAlarmDay\nmsg.payload.sun = varAlarmDay\n\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":1060,"wires":[["d65a45a8.99fb38"]]},{"id":"ea7b6d53.0bef7","type":"trigger-state","z":"7342fdca.164ea4","name":"alarm day","server":"cfa79f02.db9d4","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"input_boolean.alarm_clock_weekend","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":120,"y":1060,"wires":[["5d90b5e2.ce6f9c"],[]]},{"id":"5d90b5e2.ce6f9c","type":"change","z":"7342fdca.164ea4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"true","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":1120,"wires":[["46fd8ee6.e259d"]]},{"id":"a301b42a.316d38","type":"comment","z":"7342fdca.164ea4","name":"Bedside Dimmer Kill switch","info":"","x":200,"y":2040,"wires":[]},{"id":"336b159c.c16b4a","type":"switch","z":"7342fdca.164ea4","name":"Hold","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":2000,"wires":[["fbb7b321.ef158","6f31c450.2bbaac"]]},{"id":"5829f591.2e0e3c","type":"change","z":"7342fdca.164ea4","name":"snooze","rules":[{"t":"set","p":"payload","pt":"msg","to":"snooze","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":1920,"wires":[["202c8f85.f2afd","8b7d1725.54bb68"]]},{"id":"fbb7b321.ef158","type":"change","z":"7342fdca.164ea4","name":"snooze","rules":[{"t":"set","p":"payload","pt":"msg","to":"snooze","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":2000,"wires":[["a95e3262.5cafb"]]},{"id":"63eacb81.85ceb4","type":"api-call-service","z":"7342fdca.164ea4","name":"Stop","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"media_stop","entityId":"media_player.bedroom_speaker","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1270,"y":2000,"wires":[[]]},{"id":"a95e3262.5cafb","type":"change","z":"7342fdca.164ea4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":2000,"wires":[["63eacb81.85ceb4"]]},{"id":"e1a2a456.4aced8","type":"inject","z":"7342fdca.164ea4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"*/1 0 * * *","once":false,"onceDelay":0.1,"x":390,"y":1120,"wires":[["3014c8f5.f13a68","ea7b6d53.0bef7"]]},{"id":"6f31c450.2bbaac","type":"link out","z":"7342fdca.164ea4","name":"FINISH ALARM SEQUENCE!","links":["69d887e3.d82258","45deb28f.3cb32c"],"x":555,"y":1960,"wires":[]},{"id":"6e1a83c1.a52e8c","type":"link in","z":"7342fdca.164ea4","name":"","links":["f34105e4.e144b8"],"x":295,"y":1480,"wires":[["c96a2ec4.ae5d5"]]},{"id":"f34105e4.e144b8","type":"link out","z":"7342fdca.164ea4","name":"FINISH ALARM SEQUENCE!","links":["45deb28f.3cb32c","6e1a83c1.a52e8c"],"x":975,"y":1900,"wires":[]},{"id":"3054a35a.ee832c","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":330,"y":920,"wires":[]},{"id":"e87c3456.eb6a98","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":550,"y":920,"wires":[]},{"id":"19e6ad84.82c692","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":770,"y":920,"wires":[]},{"id":"89a3d6f0.e8cbf8","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":990,"y":920,"wires":[]},{"id":"82bfb426.724ee8","type":"comment","z":"7342fdca.164ea4","name":"TRIGGER ALARM CLOCK","info":"","x":1210,"y":920,"wires":[]},{"id":"cfa79f02.db9d4","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]

@oakbrad & @Martin_Granger Thanks for your work! I managed to make the flow even simpler, by using deCONZ nodes. They have a build-in timer which is really useful for gradually increasing the light’s brightness.

Anyway, I can’t get the the gradual increase of the radio volume to work. When I trigger start and open the traffic light, the inject node is allowed to pass through and increase the radio’s volume. However, in stead of gradually increasing it by 0.01, it immediately goes up from 0.0 to 0.25.

Does any of you have an idea why this happens?

I want to thank for the integration.
Now im starting to move in to Node-Red and I immediately had a question with the variable “Home Assistant - Variable” - there is no Variable integration in the Home Assitant. Is this a custom addition?
Thank’s