afya-lyllaby && afya-panic-button example (+Deconz - Zigbee)
This flow shows how to use:
node-red-contrib-afya-lullaby
and
node-red-contrib-afya-panic-button
Assumptions here. I have a remote: Ikea Tradfri/Philips Hue connected to Home Asisstant by Deconz. The Remote are also (here) called: pilot_dol_ikea and pilot_gora_ikea
If we press quickly (within 10 seconds) 3x the ">" button on the remote control we will activate the event: flashing of selected bulbs at 100%, 0% and again at 100% - confirmation of switching on "lullaby" Slowly turning off the light begins so that the children can fall asleep peacefully with the light.
A similar event can be programmed for waking up (you need to reverse the set values in the "lullaby"), as well as, e.g. mute the sound in audio equipment ... and dim it, e.g. when you turn on the radio (internet radio)
[{"id":"741aa903.d99c88","type":"tab","label":"Światło dieci","disabled":false,"info":""},{"id":"b16dd88e.9486c8","type":"server-events","z":"741aa903.d99c88","name":"HomeAssistantDom - Deconz","server":"7f19534.e3bb1ac","event_type":"deconz_event","x":220,"y":100,"wires":[["3d4de7e3.9ab958"]]},{"id":"3d4de7e3.9ab958","type":"switch","z":"741aa903.d99c88","name":"Kids Remote","property":"payload.event.id","propertyType":"msg","rules":[{"t":"eq","v":"pilot_dol_ikea","vt":"str"},{"t":"eq","v":"pilot_gora_ikea","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":100,"wires":[["8389b42f.909e18"],["8389b42f.909e18"]]},{"id":"8389b42f.909e18","type":"switch","z":"741aa903.d99c88","name":"Button >>","property":"payload.event.event","propertyType":"msg","rules":[{"t":"eq","v":"5002","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":700,"y":100,"wires":[["ca5e6c76.51ab8"]]},{"id":"ca5e6c76.51ab8","type":"afya-panic-button","z":"741aa903.d99c88","name":"","variableName":"AFYA_xt2r8898","timeToClick":10,"howManyTimesToClick":"3","answerPanic":"panic","answerDontPanic":"dont_panic","x":920,"y":100,"wires":[["a2d67637.a18958"]]},{"id":"70be2728.aa3628","type":"afya-lullaby","z":"741aa903.d99c88","name":"","dimmingTime":"1200","startValue":100,"stopValue":0,"step":"1","x":1250,"y":540,"wires":[["562415ce.cf7e5c","a21ec9c7.52d2c8"]]},{"id":"562415ce.cf7e5c","type":"api-call-service","z":"741aa903.d99c88","name":"Max","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.maks_ksiezyc","data":"{\"brightness_pct\":{{payload.value}},\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1450,"y":480,"wires":[[]]},{"id":"a21ec9c7.52d2c8","type":"api-call-service","z":"741aa903.d99c88","name":"Franuś","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.franio_ksiezyc","data":"{\"brightness_pct\":{{payload.value}},\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1450,"y":540,"wires":[[]]},{"id":"a2d67637.a18958","type":"switch","z":"741aa903.d99c88","name":"trigger panic?","property":"payload.state","propertyType":"msg","rules":[{"t":"eq","v":"panic","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":960,"y":200,"wires":[["c4224192.c667e","8e919401.ea1708"]]},{"id":"c4224192.c667e","type":"api-call-service","z":"741aa903.d99c88","name":"Max's Light on 100","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.maks_ksiezyc","data":"{\"brightness_pct\":100,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":590,"y":400,"wires":[["4c803c67.652834"]]},{"id":"8e919401.ea1708","type":"api-call-service","z":"741aa903.d99c88","name":"Franio's lamp on 100","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.franio_ksiezyc","data":"{\"brightness_pct\":100,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":560,"y":460,"wires":[["4c803c67.652834"]]},{"id":"ead8e940.eb5a68","type":"api-call-service","z":"741aa903.d99c88","name":"Max 0","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.maks_ksiezyc","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":870,"y":540,"wires":[["599fe21f.fbde7c"]]},{"id":"54f74862.271728","type":"api-call-service","z":"741aa903.d99c88","name":"Franio 0","server":"7f19534.e3bb1ac","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.franio_ksiezyc","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":860,"y":460,"wires":[[]]},{"id":"4c803c67.652834","type":"delay","z":"741aa903.d99c88","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":560,"wires":[["ead8e940.eb5a68","54f74862.271728"]]},{"id":"599fe21f.fbde7c","type":"delay","z":"741aa903.d99c88","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1020,"y":540,"wires":[["70be2728.aa3628"]]},{"id":"7f19534.e3bb1ac","type":"server","z":"","name":"Home Assistant - Przyjaźni","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]