Handle Android Notification clicked
So this is a continuation on the functionality to have actionable notifications with node red and Android.
This flow is triggered when a notification response is ticked (this posts it to a webservice) and it checks (via switch nodes) what the content of the callback was.
Currently this implements 'bedtime confirmation' and a 'light scene choice'. Check out this flow: https://flows.nodered.org/flow/0fe7b2ea05d30e802658368dc0fb150a
[{"id":"843ebd5f.85b96","type":"subflow","name":"Shutdown Kodi en power","info":"","category":"","in":[{"x":50,"y":30,"wires":[{"id":"f0c04c8e.3ad4a"}]}],"out":[]},{"id":"f0c04c8e.3ad4a","type":"http request","z":"843ebd5f.85b96","name":"shutdown kodi gracefuly","method":"GET","ret":"txt","url":"http://192.168.1.9:8080/jsonrpc?request={\"jsonrpc\":%20\"2.0\",%20\"id\":%201,%20\"method\":\"Application.Quit\"}","tls":"","x":310,"y":80,"wires":[["d806ff68.0662b"]]},{"id":"6ccdd8f5.9af888","type":"api-call-service","z":"843ebd5f.85b96","name":"turn off hs100","server":"181266bf.748f49","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.hs100\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":700,"y":80,"wires":[[]]},{"id":"d806ff68.0662b","type":"delay","z":"843ebd5f.85b96","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":510,"y":80,"wires":[["6ccdd8f5.9af888"]]},{"id":"e018b158.1ac7","type":"tab","label":"Inputs","disabled":false,"info":"Handling van callbacks en andere inputs"},{"id":"d944d17e.06eed","type":"server-events","z":"e018b158.1ac7","name":"fcm_android_notications.clicked","server":"181266bf.748f49","event_type":"fcm_android_notifications.clicked","x":170,"y":380,"wires":[["cd3969ce.6f0c08"]]},{"id":"c17b11ba.afbde","type":"switch","z":"e018b158.1ac7","name":"Bedtime ?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"ConfirmBedtime","vt":"str"},{"t":"cont","v":"RejectBedtime","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":540,"y":300,"wires":[["c1fa1de.b1b51e","d58bdcf4.696d3"],["dc6da7ff.454808","1dca1a3.6ff94e6"]]},{"id":"c1e80422.eb5788","type":"switch","z":"e018b158.1ac7","name":"Brightness scene command?","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"SceneTv","vt":"str"},{"t":"cont","v":"SceneMiddle","vt":"str"},{"t":"cont","v":"SceneBright","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":600,"y":540,"wires":[["79b54340.3f715c","b833d4b6.2fafa8"],["79b54340.3f715c","1a13cbd7.dfc164"],["79b54340.3f715c","aea662f7.1d8b6"]]},{"id":"1f0196fb.133c49","type":"comment","z":"e018b158.1ac7","name":"callbacks handlen met switches","info":"","x":170,"y":300,"wires":[]},{"id":"c1fa1de.b1b51e","type":"subflow:843ebd5f.85b96","z":"e018b158.1ac7","name":"Shutdown Kodi","x":880,"y":220,"wires":[]},{"id":"9d203145.7a0df","type":"delay","z":"e018b158.1ac7","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1040,"y":360,"wires":[["47b80829.055f68"]]},{"id":"cd3969ce.6f0c08","type":"json","z":"e018b158.1ac7","name":"","property":"payload","action":"str","pretty":false,"x":370,"y":380,"wires":[["c17b11ba.afbde","c1e80422.eb5788"]]},{"id":"c61252fe.0e798","type":"comment","z":"e018b158.1ac7","name":"Bedtime antwoord callback","info":"","x":570,"y":240,"wires":[]},{"id":"d937e9d4.e113d8","type":"comment","z":"e018b158.1ac7","name":"Lichting antwoord callback","info":"","x":570,"y":480,"wires":[]},{"id":"2c3f24fe.c40d8c","type":"comment","z":"e018b158.1ac7","name":"disable heating for some period","info":"","x":910,"y":300,"wires":[]},{"id":"d58bdcf4.696d3","type":"function","z":"e018b158.1ac7","name":"set BedtimeConfirmedDate ","func":"global.set('BedtimeConfirmedDate', new Date());\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":180,"wires":[["eeb6095d.45afa8"]]},{"id":"dc6da7ff.454808","type":"function","z":"e018b158.1ac7","name":"set BedtimeConfirmedDate null","func":"global.set('BedtimeConfirmedDate', null);\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":440,"wires":[[]]},{"id":"eeb6095d.45afa8","type":"delay","z":"e018b158.1ac7","name":"","pauseType":"delay","timeout":"8","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1120,"y":180,"wires":[["f7240a16.97b058"]]},{"id":"c7092806.803fd8","type":"comment","z":"e018b158.1ac7","name":"Set bedtime confirmed for 8 hours","info":"","x":920,"y":140,"wires":[]},{"id":"f7240a16.97b058","type":"function","z":"e018b158.1ac7","name":"set bedtime null","func":"global.set('Bedtime', null);\nreturn msg;","outputs":1,"noerr":0,"x":1320,"y":180,"wires":[[]]},{"id":"1dca1a3.6ff94e6","type":"tado","z":"e018b158.1ac7","configName":"cb6ba78c.bbcfe8","apiCall":"setZoneOverlay","homeId":"000000","deviceId":"","zoneId":"1","power":"off","temperature":"18","terminationType":"manual","terminationTimeout":900,"name":"heating off","x":870,"y":360,"wires":[["9d203145.7a0df"]]},{"id":"47b80829.055f68","type":"tado","z":"e018b158.1ac7","configName":"cb6ba78c.bbcfe8","apiCall":"setZoneOverlay","homeId":"000000","deviceId":"","zoneId":"1","power":"on","temperature":"17","terminationType":"timer","terminationTimeout":"1","name":"clear overlay","x":1210,"y":360,"wires":[[]]},{"id":"38a9d6dd.cd96ba","type":"inject","z":"e018b158.1ac7","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"6","x":1170,"y":440,"wires":[[]]},{"id":"79b54340.3f715c","type":"change","z":"e018b158.1ac7","name":"","rules":[{"t":"set","p":"lightSceneKeuze","pt":"global","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":740,"wires":[[]]},{"id":"12303cbc.eb6823","type":"hue-switch","z":"e018b158.1ac7","name":"Living room switch","bridge":"bf11b8cf.a82b28","sensorid":"4","x":130,"y":120,"wires":[["77a31d47.fd8554"]]},{"id":"77a31d47.fd8554","type":"debug","z":"e018b158.1ac7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":350,"y":120,"wires":[]},{"id":"c89a29fd.ae8358","type":"comment","z":"e018b158.1ac7","name":"Input controls","info":"","x":110,"y":60,"wires":[]},{"id":"b833d4b6.2fafa8","type":"hue-scene","z":"e018b158.1ac7","name":"Scene TV","bridge":"bf11b8cf.a82b28","sceneid":"OCQ5McOkBcEwBuq","x":840,"y":540,"wires":[[]]},{"id":"1a13cbd7.dfc164","type":"hue-scene","z":"e018b158.1ac7","name":"Scene Middel","bridge":"bf11b8cf.a82b28","sceneid":"xyEWLmx1r0bjXv2","x":860,"y":580,"wires":[[]]},{"id":"aea662f7.1d8b6","type":"hue-scene","z":"e018b158.1ac7","name":"Scene Bright","bridge":"bf11b8cf.a82b28","sceneid":"bdf9VSgRmWyUtyU","x":850,"y":620,"wires":[[]]},{"id":"181266bf.748f49","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"},{"id":"cb6ba78c.bbcfe8","type":"tado-config","z":"","name":"tado"},{"id":"bf11b8cf.a82b28","type":"hue-bridge","z":"","name":"Hue bridge","bridge":"192.168.1.241","key":"gxBjAUshfT3Kzn0qWxo8MxPfQcbrnFF8UAdNDCGo","interval":"3000"}]