Advertisement
Guest User

Nodered Homeassistant alarm clock radio 2 of 2

a guest
Jan 23rd, 2020
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.88 KB | None | 0 0
  1. [{"id":"58bd9b9d.569eb4","type":"tab","label":"Alarm Clock Radio","disabled":false,"info":""},{"id":"22fa09b5.a99b56","type":"comment","z":"58bd9b9d.569eb4","name":"TRIGGER ALARM CLOCK","info":"","x":130,"y":40,"wires":[]},{"id":"ef5e0652.d288c8","type":"comment","z":"58bd9b9d.569eb4","name":"START ALARM CLOCK SEQUENCE","info":"","x":170,"y":280,"wires":[]},{"id":"3fbdca8a.ee6e56","type":"comment","z":"58bd9b9d.569eb4","name":"Set Initial Flow Variables","info":"","x":550,"y":340,"wires":[]},{"id":"4d63d13b.b3876","type":"api-current-state","z":"58bd9b9d.569eb4","name":"Radio?","server":"cfa79f02.db9d4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.house_alarmclock_radio","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":480,"y":600,"wires":[["46fd992b.102f58"],[]]},{"id":"6c47083d.c60ed8","type":"comment","z":"58bd9b9d.569eb4","name":"LOOP LOGIC ","info":"","x":110,"y":640,"wires":[]},{"id":"3b60d435.4cda9c","type":"comment","z":"58bd9b9d.569eb4","name":"Snooze Button Actions","info":"","x":820,"y":900,"wires":[]},{"id":"e8dcff80.0d34d","type":"comment","z":"58bd9b9d.569eb4","name":"Finish Alarm Sequence","info":"","x":1100,"y":820,"wires":[]},{"id":"36af63ca.ef935c","type":"comment","z":"58bd9b9d.569eb4","name":"Snooze Timer","info":"","x":510,"y":980,"wires":[]},{"id":"357eaa68.890786","type":"change","z":"58bd9b9d.569eb4","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"snooze","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":820,"wires":[["24c8281e.d590b8"]]},{"id":"c5b7a54e.0bc508","type":"server-state-changed","z":"58bd9b9d.569eb4","name":"Snooze On","server":"cfa79f02.db9d4","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.house_alarmclock_snooze","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"x":300,"y":940,"wires":[[],["357eaa68.890786","ff160951.5b3798","34393da4.0d8d02"]]},{"id":"1a8fa524.ff3adb","type":"link in","z":"58bd9b9d.569eb4","name":"","links":["c0f9e29b.61e3c"],"x":395,"y":820,"wires":[["357eaa68.890786"]]},{"id":"ff160951.5b3798","type":"function","z":"58bd9b9d.569eb4","name":"Reset to Volume","func":"flow.set(\"volume\",0.2);\nnewmsg = {\"payload\":\"true\"}\nreturn newmsg;","outputs":1,"noerr":0,"x":800,"y":940,"wires":[["ed1eaf88.f9174"]]},{"id":"34393da4.0d8d02","type":"delay","z":"58bd9b9d.569eb4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":1020,"wires":[["e4cf4ed2.6c4aa"]]},{"id":"9f089470.219798","type":"change","z":"58bd9b9d.569eb4","name":"Start","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":700,"wires":[["24c8281e.d590b8"]]},{"id":"e4cf4ed2.6c4aa","type":"api-call-service","z":"58bd9b9d.569eb4","name":"Snooze Off (Restart Loop)","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"turn_off","entityId":"input_boolean.house_alarmclock_snooze","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":830,"y":1020,"wires":[["bf34ce7b.b4fc2"]]},{"id":"3754c2ce.da58ae","type":"switch","z":"58bd9b9d.569eb4","name":"Is it Time?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Waking Up","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":230,"y":480,"wires":[["9f089470.219798","8c121456.efdb78","4d63d13b.b3876","d9f45537.d91588"]]},{"id":"609f61e2.07955","type":"server-state-changed","z":"58bd9b9d.569eb4","name":"Snooze Off","server":"cfa79f02.db9d4","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.house_alarmclock_snooze","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"x":100,"y":780,"wires":[[],["9f089470.219798"]]},{"id":"a4c52d8f.bcfdc","type":"server-state-changed","z":"58bd9b9d.569eb4","name":"Wake Up House","server":"cfa79f02.db9d4","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"variable.radio_state","entityidfiltertype":"substring","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"x":100,"y":340,"wires":[["3754c2ce.da58ae"]]},{"id":"8c121456.efdb78","type":"function","z":"58bd9b9d.569eb4","name":"Initialize Volume to 0","func":"flow.set(\"volume\", 0);\n\nnewmsg = {\"payload\":\"true\"}\nreturn newmsg;","outputs":1,"noerr":0,"x":540,"y":380,"wires":[[]]},{"id":"4d9f5ccb.434354","type":"switch","z":"58bd9b9d.569eb4","name":"Is Loop Done?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"done","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1420,"y":820,"wires":[["c0f9e29b.61e3c"]]},{"id":"c0f79603.3484f8","type":"inject","z":"58bd9b9d.569eb4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":810,"y":440,"wires":[["8c121456.efdb78"]]},{"id":"c0f9e29b.61e3c","type":"link out","z":"58bd9b9d.569eb4","name":"FINISH ALARM SEQUENCE!","links":["1a8fa524.ff3adb","45deb28f.3cb32c"],"x":1255,"y":820,"wires":[]},{"id":"24c8281e.d590b8","type":"traffic","z":"58bd9b9d.569eb4","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":700,"y":756,"wires":[["c9159e4c.22ae9"]]},{"id":"c828220c.91157","type":"inject","z":"58bd9b9d.569eb4","name":"Volume ---->","topic":"","payload":"volume","payloadType":"flow","repeat":"10","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":756,"wires":[["5298fc48.4229a4"]]},{"id":"c9159e4c.22ae9","type":"function","z":"58bd9b9d.569eb4","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":910,"y":756,"wires":[["9eb1c93f.7a39d8"]]},{"id":"9eb1c93f.7a39d8","type":"api-call-service","z":"58bd9b9d.569eb4","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":1170,"y":756,"wires":[["4ee03233.39bd2c"]]},{"id":"4ee03233.39bd2c","type":"function","z":"58bd9b9d.569eb4","name":"Increment Volume","func":"var volume = flow.get('volume')||0.0;\n\nif (volume < 0.55) {\n volume = volume + 0.05;\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":1430,"y":756,"wires":[["4d9f5ccb.434354"]]},{"id":"7d9a3b0.08878c4","type":"comment","z":"58bd9b9d.569eb4","name":"SNOOZE!","info":"","x":100,"y":900,"wires":[]},{"id":"f01c3f72.5af8a","type":"comment","z":"58bd9b9d.569eb4","name":"VOLUME","info":"","x":920,"y":716,"wires":[]},{"id":"814e9aed.95ad38","type":"comment","z":"58bd9b9d.569eb4","name":"Turn on Radio","info":"","x":490,"y":560,"wires":[]},{"id":"5298fc48.4229a4","type":"api-current-state","z":"58bd9b9d.569eb4","name":"Radio?","server":"cfa79f02.db9d4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"input_boolean.house_alarmclock_radio","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":520,"y":756,"wires":[["24c8281e.d590b8"],[]]},{"id":"46fd992b.102f58","type":"api-call-service","z":"58bd9b9d.569eb4","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":640,"y":600,"wires":[["6f9038f8.7b1f38"]]},{"id":"6f9038f8.7b1f38","type":"change","z":"58bd9b9d.569eb4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":600,"wires":[["454b8572.5cb24c"]]},{"id":"ed1eaf88.f9174","type":"api-call-service","z":"58bd9b9d.569eb4","name":"Pause Radio","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"media_player","service":"media_pause","entityId":"media_player.bedroom_speaker","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1110,"y":940,"wires":[["df491dbc.801be"]]},{"id":"bf34ce7b.b4fc2","type":"change","z":"58bd9b9d.569eb4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":1080,"wires":[["be5261d9.31ffc"]]},{"id":"be5261d9.31ffc","type":"api-call-service","z":"58bd9b9d.569eb4","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":1090,"y":1080,"wires":[[]]},{"id":"df491dbc.801be","type":"change","z":"58bd9b9d.569eb4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1250,"y":940,"wires":[["c799434d.3c85e"]]},{"id":"c799434d.3c85e","type":"api-call-service","z":"58bd9b9d.569eb4","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":1420,"y":940,"wires":[[]]},{"id":"e2a66df5.09d84","type":"api-current-state","z":"58bd9b9d.569eb4","name":"Waking Up?","server":"cfa79f02.db9d4","version":1,"outputs":2,"halt_if":"Waking Up","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"entity_id":"variable.radio_state","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":770,"y":1160,"wires":[["493306d8.cf4278"],[]]},{"id":"493306d8.cf4278","type":"api-call-service","z":"58bd9b9d.569eb4","name":"Snooze On","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.house_alarmclock_snooze","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":990,"y":1160,"wires":[[]]},{"id":"f5aea6bc.8181e8","type":"comment","z":"58bd9b9d.569eb4","name":"Snooze Button","info":"","x":240,"y":1120,"wires":[]},{"id":"64900db0.b75734","type":"change","z":"58bd9b9d.569eb4","name":"Delete","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":600,"wires":[["3fd9ab5e.8eb7f4"]]},{"id":"3fd9ab5e.8eb7f4","type":"api-call-service","z":"58bd9b9d.569eb4","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":1320,"y":600,"wires":[[]]},{"id":"454b8572.5cb24c","type":"cast-to-client","z":"58bd9b9d.569eb4","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":970,"y":600,"wires":[["64900db0.b75734"]]},{"id":"3ac03357.1b1e4c","type":"server-events","z":"58bd9b9d.569eb4","name":"Events","server":"cfa79f02.db9d4","event_type":"deconz_event","x":210,"y":1180,"wires":[["fbb86508.6c2158"]]},{"id":"fbb86508.6c2158","type":"switch","z":"58bd9b9d.569eb4","name":"Master Snooze","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"master_snooze","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":1180,"wires":[["b6a68ef0.06c9d"]]},{"id":"b6a68ef0.06c9d","type":"switch","z":"58bd9b9d.569eb4","name":"Click Type","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"1002","vt":"str"},{"t":"eq","v":"1001","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":1180,"wires":[["e2a66df5.09d84"],[]]},{"id":"d9f45537.d91588","type":"api-call-service","z":"58bd9b9d.569eb4","name":"","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_hasskit_pixel_4","entityId":"","data":"{\"title\":\"Good Morning - The alarm clock Has gone off\",\"message\":\"Are you up yet lazy?\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":480,"wires":[[]]},{"id":"409398f.70e2568","type":"api-call-service","z":"58bd9b9d.569eb4","name":"","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_iphone6","entityId":"","data":"{\"title\":\"Good Morning - The alarm clock Has gone off\",\"message\":\"Are you up yet lazy?\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":580,"y":520,"wires":[[]]},{"id":"1cde251d.30fc4b","type":"function","z":"58bd9b9d.569eb4","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":300,"y":80,"wires":[["1a5279ac.39ca36"]]},{"id":"1a5279ac.39ca36","type":"schedex","z":"58bd9b9d.569eb4","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":true,"sun":true,"x":470,"y":80,"wires":[["2366ce4c.b1bca2"]]},{"id":"2366ce4c.b1bca2","type":"api-current-state","z":"58bd9b9d.569eb4","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_alarmclock_radio","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":750,"y":80,"wires":[["d5ed31d9.dd482","17aed693.8b5179"],[]]},{"id":"d5ed31d9.dd482","type":"change","z":"58bd9b9d.569eb4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"True","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":80,"wires":[["4a7e917a.9faca"]]},{"id":"4a7e917a.9faca","type":"api-call-service","z":"58bd9b9d.569eb4","name":"House State - Waking Up","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"variable","service":"set_variable","entityId":"","data":"{\"variable\":\"radio_state\",\"value\":\"Waking Up\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1250,"y":80,"wires":[[]]},{"id":"cbf0aca8.fa96f","type":"trigger-state","z":"58bd9b9d.569eb4","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":90,"y":80,"wires":[["1cde251d.30fc4b","e4e78b6d.bc7ae8"],[]]},{"id":"596da359.10a75c","type":"inject","z":"58bd9b9d.569eb4","name":"","topic":"","payload":"1002","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":330,"y":1400,"wires":[["e2a66df5.09d84"]]},{"id":"17aed693.8b5179","type":"change","z":"58bd9b9d.569eb4","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"on","fromt":"str","to":"Waking Up","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":120,"wires":[["3754c2ce.da58ae"]]},{"id":"e4e78b6d.bc7ae8","type":"api-call-service","z":"58bd9b9d.569eb4","name":"House State - Awake","server":"cfa79f02.db9d4","version":1,"debugenabled":false,"service_domain":"variable","service":"set_variable","entityId":"","data":"{\"variable\":\"house_state\",\"value\":\"Awake\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":280,"y":160,"wires":[[]]},{"id":"374f32e3.4092ce","type":"inject","z":"58bd9b9d.569eb4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"0 0-2 * * *","once":true,"onceDelay":"30","x":110,"y":220,"wires":[["e4e78b6d.bc7ae8"]]},{"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}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement