Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smcnab1/home-assistant-config
Your shortcut to seamless Home Assistant setups. Elevate your smart living experience effortlessly. 🏡✨
https://github.com/smcnab1/home-assistant-config
automation hass hassio home-assistant home-assistant-config home-automation homeassistant homeautomation internet-of-things internetofthings iot
Last synced: 5 days ago
JSON representation
Your shortcut to seamless Home Assistant setups. Elevate your smart living experience effortlessly. 🏡✨
- Host: GitHub
- URL: https://github.com/smcnab1/home-assistant-config
- Owner: smcnab1
- License: mit
- Created: 2022-08-25T23:34:12.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-15T10:58:38.000Z (5 months ago)
- Last Synced: 2024-06-16T09:36:57.755Z (5 months ago)
- Topics: automation, hass, hassio, home-assistant, home-assistant-config, home-automation, homeassistant, homeautomation, internet-of-things, internetofthings, iot
- Language: Shell
- Homepage: https://smcnab1.github.io/home-assistant-config/
- Size: 154 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![Kofi][kofi-badge]][kofi-url]
Home Assistant Config
Your shortcut to seamless Home Assistant setups. Elevate your smart living experience effortlessly. 🏡✨
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
View Contents
_Last Updated June 2024_
- [About The Project](#about-the-project)
- [Devices](#devices)
- [Add-Ons](#addons)
- [Automations](#automations)
- [Back Matter](#back-matter)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)
## About The Project
This is my **first** repo on GitHub and first time utilising Home Assistant to it's fullest potential. I began with a few sensors and just playing but got bitten by the HA bug and have created a full smart home system.This repo will be updated regularly and I am keen to make it an open & learning venture. Looking for feature suggestions and advice to increase the **wife-approval level**😎.
## Devices _(as at Oct 22)_
This is a list of the devices I **currently** use as part of my Home Assistant setup. Any suggestions drop them as a feature request.
View all Devices
Switches 🎚
Qty (#)
Price per unit (£)
Price (£)
TP-Link Tapo P100
9
9.49
85.41
Xiaomi Aqara Single Button
4
17.99
71.96
SONOFF Micro USB Smart Adapter
2
11.99
23.98
SwitchBot Smart Switch
2
29.99
59.98
Total
241.33
Sensors 🌡
Units (#)
Price per unit (£)
Price (£)
Xiaomi Aqara Door Sensor
2
16.99
33.98
Xiaomi Aqara Temperature Sensor
5
19.99
99.95
Xiaomi Aqara Motion Sensor
5
19.99
99.95
Xiaomi Aqara Vibration Sensor
2
19.99
39.98
Xiaomi Aqara Magic Cube
1
19.99
19.99
ESP32 Boards
6
7.00
42.00
ESP32 Cases
6
8.00
48.00
Bed Pressure Mats
4
11.79
47.16
Total
431.04
Media player 📺🔈
Units (#)
Price per unit (£)
Price (£)
Samsung Q60AA
1
559.00
559.00
BLAUPUNKT 32"
1
139.95
139.95
SONOS Play 1
1
164.99
164.99
Google Nest Hub Mini
2
27.99
55.98
Lenovo M10 Tablet with Ethernet Connection
1
79.99
79.99
XBOX One Console
1
164.97
164.97
Apple Mac Mini
1
629.97
629.97
MacBook Air
2
949.00
1898.00
Total
3,692.85
Lights 💡
Units (#)
Price per unit (£)
Price (£)
Lepro GU10 LED RGB Bulb
10
9.00
90.00
Lepro E14 LED Dimmable Bulb
2
8.50
17.00
Lepro LED Strip RGB 5m
10
15.99
159.90
Govee DreamView T1 Immersion LED Kit
1
56.09
56.09
Mathmos Astro Lava Lamp
1
82.00
82.00
Total
404.99
Hubs 🌎
Units (#)
Price per unit (£)
Price (£)
ConBee II
1
37.42
37.42
Aqara M2 Hub
1
54.99
54.99
Tuya Zigbee 3.0 Mini Signal Repeater
1
14.15
14.15
SwitchBot Hub
1
35.00
35.00
Total
141.56
Server & Network 🖥
Units (#)
Price per unit (£)
Price (£)
Raspberry Pi 4 Model B, 8GB RAM
2
75.50
151.00
Raspberry Pi 4 IceBerry Cooling Case
2
16.00
32.00
250GB SSD in Case
2
35.00
70.00
TP-Link TL-SG1005D, 5 Port Gigabit Ethernet Network Switch
1
10.49
10.49
Coral USB Accelerator
1
120.00
120.00
TP-Link TL-PA4010KIT Nano AV600 Powerline Adapter
3
23.41
70.23
Total
453.72
Device tracker 🔍
Units (#)
Price per unit (£)
Price (£)
iPhone 13 Pro Max with Companion App
1
1049.00
1049.00
iPhone 11 with Companion App
1
429.00
429.00
Apple Watch Series 8 45mm
1
449.00
449.00
Total
1,927.00
Total of Smart Home Devices (excl Media/Device Tracker)
[as at Sept 22 (UK)]
£1,672.64
Total of All Devices (incl Media/Device Tracker)
[as at Sept 22 (UK)]
😳£7,282.49😳
## Add-Ons _(as at Oct 22)_
This is a list of all of my add-ons within my setup. These also include the HACS integrations I currently use.
Standard Add-Ons
- [ESPHome](https://github.com/esphome/esphome) version 2022.9.2 by @esphome
- [Frigate NVR](https://github.com/blakeblackshear/frigate) version 0.11.0 by @blakeblackshear
- [Home Assistant Google Drive Backup](https://github.com/sabeechen/hassio-google-drive-backup) version 0.108.4 by @sabeechen
- [Mosquitto Broker](https://github.com/home-assistant/addons/tree/master/mosquitto) version 6.1.3 by @hassio-addons
- [Node-RED](https://github.com/hassio-addons/addon-node-red) version 13.4.0 by @hassio-addons
- [Samba Share](https://github.com/home-assistant/addons/tree/master/samba) version 10.0.0 by @hassio-addons
- [InfluxDB](https://github.com/hassio-addons/addon-influxdb) version 4.5.0 by @hassio-addons
- [Studio Code Server](https://github.com/hassio-addons/addon-vscode) version 5.4.0 by @hassio-addons
- [Terminal & SSH](https://github.com/hassio-addons/addon-ssh) version 9.6.1 by @hassio-addonsHACS Integrations (as at Oct 22)
- [HACS](https://github.com/hacs) version 1.27.1 by @ludeeus
- [Spotcast](https://github.com/fondberg/spotcast) version 3.6.30 by @fondberg
- [MeteoAlarm](https://github.com/kodi1/meteoalarm) version 294bc3a by @kodi1
- [Car Wash](https://github.com/Limych/ha-car_wash) version 1.5.4 by @Limych
- [SamsungTV Smart Component](https://github.com/ollo69/ha-samsungtv-smart) version 0.7.6 by @jaruba
- [Browser Mod](https://github.com/thomasloven/hass-browser_mod) version 2.1.3 by @thomasloven
- [Node-RED Companion](https://github.com/zachowj/hass-node-red) version 1.0.9 by @zachowj
- [Sonoff LAN](https://github.com/AlexxIT/SonoffLAN) version 3.2.0 by @AlexxIT
- [Google Home](https://github.com/leikoilja/ha-google-home) version 1.9.15 by @leikoilja
- [GOVEE](https://github.com/LaggAt/hacs-govee) version 0.2.2 by @LaggAt
- [Frigate](https://github.com/blakeblackshear/frigate-hass-integration) version 2.3 by @blakeblackshear
- [Tapo Controller](https://github.com/petretiandrea/home-assistant-tapo-p100) version 1.2.15 by @petretinandrea
- [UI Lovelace Minimalist](https://github.com/UI-Lovelace-Minimalist/UI) version 1.1.2 by @stokkie90
- [Watchman](https://github.com/dummylabs/thewatchman#configuration) version 0.6.0 by @dummylabs
- [LondonTfL](https://github.com/morosanmihail/HA-LondonTfL) version 0.3.1 by @morosanmihail
- [Music Assistant](https://github.com/music-assistant/hass-music-assistant) version 2022.8.4 by @marcelveldt
- [Mail and Packages](https://github.com/moralmunky/Home-Assistant-Mail-And-Packages) version 0.3.4 by @firstof9HACS Frontend (as at Oct 22)
- [Swipe Card](https://github.com/bramkragten/swipe-card) version 4.0.0 by @bramkragten
- [Button Card](https://github.com/custom-cards/button-card) version 3.5.0 by @RomRider
- [Decluttering Card](https://github.com/custom-cards/decluttering-card) version 0.6.3 @RomRider
- [HASL Departure Card](https://github.com/hasl-sensor/lovelace-hasl-departure-card) version 2.5.0 by @hasl-sensor
- [Restriction Card](https://github.com/iantrich/restriction-card) version 1.2.7 by @iantrich
- [Mini Media Player](https://github.com/kalkih/mini-media-player) version 1.16.4 by @kalkih
- [Light Entity Card](https://github.com/ljmerza/light-entity-card) version 5.0.0 by @ljmerza
- [TV Remote Card](https://github.com/marrobHD/tv-card) version 0.2.0 by @marrobHD
- [Card Mod](https://github.com/thomasloven/lovelace-card-mod) version 3.1.5 by @thomasloven
- [Layout Card](https://github.com/thomasloven/lovelace-layout-card) version 2.4.2 by @thomasloven
- [Apex Charts Card](https://github.com/RomRider/apexcharts-card) version 2.0.1 by @RomRider
- [Notify Card](https://github.com/bernikr/lovelace-notify-card) version f0b8b1f
- [Mini Graph Card](https://github.com/kalkih/mini-graph-card) version 0.11.0 by @kalkih
- [Frigate Card](https://github.com/dermotduffy/frigate-hass-card) version 3.0.0 by @dermotduffy
- [Atomic Calendar Revive](https://github.com/totaldebug/atomic-calendar-revive) version 7.0.1 by @totaldebug
- [Mushroom UI](https://github.com/piitaya/lovelace-mushroom) version 2.1.3 by @piitaya
- [Mushroom Themes](https://github.com/piitaya/lovelace-mushroom-themes) version 0.0.2 by @piitaya
- [Weather Radar Card](https://github.com/Makin-Things/weather-radar-card) version 2.0.6 by @Makin-Things
- [Slider Button Card](https://github.com/custom-cards/slider-button-card) version 1.10.9 by @mattieha
- [Kiosk Mode](https://github.com/NemesisRE/kiosk-mode) version 1.7.3 by @NemesisRE
- [My Cards Bundle](https://github.com/AnthonMS/my-cards) version 1.0.2 by @AnthonMS
- [Auto Entities](https://github.com/thomasloven/lovelace-auto-entities) version 1.11.0 by @thomasloven
- [Spotify Lovelace Card](https://github.com/custom-cards/spotify-card) version 2.4.0 by @fondberg
## All Automations _(as at Sept 22)_
Security 👮🚨 Automations (10 automations)
Alarm Arm Notifiction Reminder
Remind everyone to arm the alarm when leaving the house. Only if alarm hasn't already been set._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/entities/alarm.yaml)
- [zone.home](https://github.com/smcnab1/home-assistant-config/blob/master/entities/zone.yaml)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Alarm Arm Notifiction Actions
This automation arms the alarm and sends notifications to everyone to confirm it is now armed._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [zone.home](https://github.com/smcnab1/home-assistant-config/blob/master/entities/zone.yaml)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Alarm Disarm Nofification
Automation to disarm the alarm and notify everyone that it has been disarmed following the alarm triggering._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Alarm Overnight Living Room
Automation to send notification and camera screenshot to bedroom TV if motion detected in Living Room when everyone is asleep._which uses:_
- [input_boolean.sleeping](https://github.com/smcnab1/home-assistant-config/blob/master/entities/input_boolean/all_sleeping.yaml)
- [MQTT Add-On](https://github.com/home-assistant/addons/tree/master/mosquitto)
- [Frigate Add-On](https://github.com/blakeblackshear/frigate)
- [Android TV Notifications Integration](https://www.home-assistant.io/integrations/nfandroidtv/)
- [Android TV Integration](https://www.home-assistant.io/integrations/androidtv/)
Alarm Trigger
Automation to trigger the alarm if motion is detected within the house when set to armed away and nobody home._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
Alarm Trigger Lighting
Automation to trigger the lighting sequence if alarm is triggered when set to armed away and nobody home._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
Alarm Trigger Sound
Automation to trigger the sound sequence if alarm is triggered when set to armed away and nobody home. Includes audible siren and TTS._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
Alarm Trigger Notify
Automation to notify everyone when the alarm is triggered when set to armed away and nobody home._which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Alarm Disarm Tag
NFC Tag used to easily disarm the alarm system_which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [HA NFC Tag Integration](https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/)
Alarm Arm Tag
NFC Tag used to easily arm the alarm system_which uses:_
- [alarm_control_panel.home_alarm](https://github.com/smcnab1/home-assistant-config/blob/master/automations/alarm/arm_notify_reminder.yaml)
- [HA NFC Tag Integration](https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/)
Lighting 🌄🌇 Automations (42 automations)Bathroom Motion Automation
Automation which works with motion sensors to activate and de-activate lighting. Also depends on time of day.![Node-Red Flow](https://i.imgur.com/EY4Z9MB.png)
Node-Red Code
[{"id":"3fe087dd9290cd30","type":"subflow","name":"Lights Motion Control","info":"","category":"home_assistant","in":[{"x":57,"y":162,"wires":[{"id":"ef28eae7ed719fef"}]}],"out":[{"x":470,"y":375,"wires":[{"id":"7979d0139dcbb40b","port":0}]},{"x":560,"y":390,"wires":[{"id":"7979d0139dcbb40b","port":1}]},{"x":650,"y":75,"wires":[{"id":"41569ba311d53f87","port":0}]},{"x":890,"y":105,"wires":[{"id":"dc014e6fd4f7b01b","port":0}]}],"env":[{"name":"timeOffAfter","type":"num","value":"120"},{"name":"manualCooldown","type":"num","value":"30"},{"name":"brightness","type":"num","value":"100","ui":{"type":"input","opts":{"types":["num","bool","json","bin"]}}},{"name":"transitionOn","type":"num","value":"2"},{"name":"transitionOff","type":"num","value":"2"},{"name":"pause","type":"str","value":"5"},{"name":"controlLights","type":"str","value":""},{"name":"manualLight","type":"bool","value":"false"}],"meta":{},"color":"#52C0F2","icon":"font-awesome/fa-lightbulb-o","status":{"x":1027,"y":157,"wires":[{"id":"67740cc1abae3f4d","port":0}]}},{"id":"69b69fb47d2e171c","type":"change","z":"3fe087dd9290cd30","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":544,"y":178,"wires":[["dc014e6fd4f7b01b"]]},{"id":"dc014e6fd4f7b01b","type":"state-machine","z":"3fe087dd9290cd30","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":741,"y":157,"wires":[["7979d0139dcbb40b","67740cc1abae3f4d"]]},{"id":"c0ac9957e8074a3a","type":"change","z":"3fe087dd9290cd30","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":541,"y":223,"wires":[["dc014e6fd4f7b01b"]]},{"id":"b808c7939e262898","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":630,"wires":[["5436a3c1b895bd12"]]},{"id":"529401309069e7e5","type":"inject","z":"3fe087dd9290cd30","name":"Initial State","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","x":665,"y":570,"wires":[["4060d565fc3941d1","f4e6ddd8960529f3"]]},{"id":"18d112236dd3f2c6","type":"link in","z":"3fe087dd9290cd30","name":"","links":["774c661db65310b7","f95e514e2b0be219"],"x":592,"y":120,"wires":[["dc014e6fd4f7b01b"]]},{"id":"774c661db65310b7","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":1020,"y":570,"wires":[]},{"id":"7979d0139dcbb40b","type":"switch","z":"3fe087dd9290cd30","name":"State Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"},{"t":"eq","v":"motion-off","vt":"str"},{"t":"eq","v":"motion-on","vt":"str"},{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":230,"y":465,"wires":[["83884d0cb7a1e2a8","f9350e6c9e6be889"],["ab49cdb37a246459"],["d826541759debe8b"],["b808c7939e262898","ae931f01824e1cbc"]]},{"id":"ece9daf5e1c3fe6c","type":"rbe","z":"3fe087dd9290cd30","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":369,"y":223,"wires":[["c0ac9957e8074a3a"]]},{"id":"ef28eae7ed719fef","type":"switch","z":"3fe087dd9290cd30","name":"Topic Route","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"^config\\b","vt":"str","case":false},{"t":"regex","v":"^reset\\b","vt":"str","case":false},{"t":"eq","v":"light_state","vt":"str"},{"t":"cont","v":"sensor.","vt":"str"},{"t":"regex","v":"^(light|switch)\\.","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":5,"x":175,"y":162,"wires":[["41569ba311d53f87"],["6b80334d2b0bd4ab"],["dc014e6fd4f7b01b"],["5855ad1b303c6bc1"],["ece9daf5e1c3fe6c","8ffe714a5901d07d"]]},{"id":"41569ba311d53f87","type":"function","z":"3fe087dd9290cd30","name":"Update Configuration","func":"// Init our Lights state while we're here\nlet lights = flow.get('lights')\n// Is this our start-up initialisation? (If so, reset config!)\nlet init = msg.init || false\nif (!lights)\n flow.set('lights', { state: { }, ids: [], ids_csv: '' })\n\n// Merge new Payload with existing config and defaults\nlet cfg = Object.assign(\n // Existing Config\n init?flow.get('cfg')||{}:{}, // 'cfg.'+id\n // Updated Config\n msg.payload)\n\n// Make sure Light IDs are initted.\n// if (!cfg.lights) cfg.lights = []\nif (!cfg.brightness)\n cfg.brightness = env.get('brightness') || 100\n\nif (!cfg.transitionOn && cfg.transitionOn !== 0)\n cfg.transitionOn = env.get('transitionOn') || 2\n \nif (!cfg.transitionOff && cfg.transitionOff !== 0)\n cfg.transitionOff = env.get('transitionOff') || 2\n\nif (!cfg.lights && env.get('controlLights') && env.get('controlLights').length>0)\n cfg.lights = env.get('controlLights').split(/\\s*,\\s*/)\n\nflow.set('cfg', cfg)\n\nreturn { topic: 'config', payload: cfg, lights }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":505,"y":75,"wires":[[]]},{"id":"5855ad1b303c6bc1","type":"switch","z":"3fe087dd9290cd30","name":"motion on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375,"y":178,"wires":[["69b69fb47d2e171c"]]},{"id":"8ffe714a5901d07d","type":"function","z":"3fe087dd9290cd30","name":"Track Lights","func":"// Keep a record of all the light entity_ids coming in, for later switching\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\n\nlet [all, id] = msg.topic.match(/^light\\.(.*)/)\nlet update = false\n\nif (id) {\n lights.state[id] = msg.data.new_state\n if (!lights.ids.includes(id)) {\n lights.ids.push(id)\n update = true\n }\n lights.ids_csv = lights.ids.join(',')\n}\n\nflow.set('lights', lights)\n\nreturn {update}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":389,"y":268,"wires":[["31b931f6b9df7e2e"]]},{"id":"83884d0cb7a1e2a8","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light On. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n brightness: Math.floor(cfg.brightness/100*255),\n transition: cfg.transitionOn,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":330,"wires":[["412fe93b1c4add94","3803e8ecf7384d2b"]]},{"id":"ab49cdb37a246459","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light Off. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n transition: cfg.transitionOff,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":435,"wires":[["ed01207d5f3679e4","63c85b090efb1c5c"]]},{"id":"1ec81804eca7f722","type":"inject","z":"3fe087dd9290cd30","name":"Default Configuration","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"init","v":"true","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"config","payload":"{}","payloadType":"json","x":235,"y":75,"wires":[["41569ba311d53f87"]]},{"id":"2dfcf7ed6c713ca9","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn on light","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":285,"wires":[[]]},{"id":"015672de6c534fb2","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn off light","server":"f43d015e.4b29","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":435,"wires":[[]]},{"id":"4060d565fc3941d1","type":"function","z":"3fe087dd9290cd30","name":"Check State","func":"// Fetch light state from our \"Track Lights\" data\n// - no need for a HA State node\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\nlet cfg = flow.get('cfg')|| {}\n\n// Return \"on\" if any one light is \"on\"\nreturn {\n topic: 'light.'+lights.ids_csv,\n payload: lights.ids.map(id => lights.state[id].state).includes('on') ? 'on' : 'off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":525,"wires":[["774c661db65310b7"]]},{"id":"4b0205094e835fcc","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":880,"y":285,"wires":[["2dfcf7ed6c713ca9"]]},{"id":"88c1ddf9130a3f60","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":875,"y":435,"wires":[["015672de6c534fb2"]]},{"id":"01dd313513cd6bbc","type":"function","z":"3fe087dd9290cd30","name":"motion-on","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-on'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":885,"y":330,"wires":[["f95e514e2b0be219"]]},{"id":"e13e288088919cdf","type":"function","z":"3fe087dd9290cd30","name":"motion-off","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":615,"wires":[["774c661db65310b7"]]},{"id":"f9350e6c9e6be889","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[["63c85b090efb1c5c"]]},{"id":"67740cc1abae3f4d","type":"function","z":"3fe087dd9290cd30","name":"status","func":"\nmsg.payload = {\n text: msg.payload, \n shape: msg.payload.match(/on/) ? 'ring' : 'dot',\n fill: msg.payload == 'switch' ? 'red' : 'green'\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":157,"wires":[[]]},{"id":"412fe93b1c4add94","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":285,"wires":[[],["4b0205094e835fcc"]]},{"id":"ed01207d5f3679e4","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":435,"wires":[[],["88c1ddf9130a3f60"]]},{"id":"f95e514e2b0be219","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":990,"y":330,"wires":[]},{"id":"6b80334d2b0bd4ab","type":"function","z":"3fe087dd9290cd30","name":"Reset","func":"flow.set('lights', null)\nflow.set('cfg', null)\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":365,"y":135,"wires":[["41569ba311d53f87"]]},{"id":"31b931f6b9df7e2e","type":"switch","z":"3fe087dd9290cd30","name":"Updated?","property":"update","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":270,"wires":[["41569ba311d53f87"]]},{"id":"3803e8ecf7384d2b","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":330,"wires":[["01dd313513cd6bbc"]]},{"id":"63c85b090efb1c5c","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":480,"wires":[["4060d565fc3941d1"]]},{"id":"f4e6ddd8960529f3","type":"trigger","z":"3fe087dd9290cd30","name":"Back to Auto","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":715,"y":525,"wires":[["4060d565fc3941d1"]]},{"id":"ae931f01824e1cbc","type":"change","z":"3fe087dd9290cd30","name":"cooldown","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('manualCooldown')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":525,"y":525,"wires":[["f4e6ddd8960529f3"]]},{"id":"d826541759debe8b","type":"change","z":"3fe087dd9290cd30","name":"timeOffAfter","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('timeOffAfter')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":585,"wires":[["5436a3c1b895bd12"]]},{"id":"5436a3c1b895bd12","type":"trigger","z":"3fe087dd9290cd30","name":"Turn Off after motion ends","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":685,"y":615,"wires":[["e13e288088919cdf"]]},{"id":"c46ec6da75a29ac3","type":"tab","label":"Bathroom","disabled":false,"info":"","env":[]},{"id":"537c7adde52f50c8","type":"group","z":"c46ec6da75a29ac3","name":"Bathroom Lighting - Motion Control","style":{"label":true,"fill":"#bfbfbf","fill-opacity":"0.28"},"nodes":["5b9a844b4fed15dc","4c25f2418350340f","fcbdc357f6fb230f","83e9fe224cf56eaf","8ccff7d2f7752935","8cfe54e24192df53","4a6cc4a70ec8b894","269f267b17835f9e","3e8a6ff53d4425a8","2d224de037c2e0fb","4d70d9cf0b54bc16","631bf9eac4809e41","0f8f82c086edc370","d8532d882bb3b7e8","c0b45b47b2055647"],"x":14,"y":19,"w":1372,"h":342},{"id":"5b9a844b4fed15dc","type":"server-state-changed","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Light Changed - Bathroom","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.all_bathroom_lights","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":120,"wires":[["fcbdc357f6fb230f"]]},{"id":"4c25f2418350340f","type":"server-state-changed","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Presence - Bathroom","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bathroom_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":200,"wires":[["fcbdc357f6fb230f"],[]]},{"id":"fcbdc357f6fb230f","type":"time-range-switch","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Day?","lat":"","lon":"","startTime":"10:30","endTime":"00:00","startOffset":0,"endOffset":0,"x":350,"y":160,"wires":[["269f267b17835f9e"],["3e8a6ff53d4425a8"]]},{"id":"83e9fe224cf56eaf","type":"api-call-service","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_normal"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1240,"y":60,"wires":[[]]},{"id":"8ccff7d2f7752935","type":"api-call-service","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_morning"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1240,"y":220,"wires":[[]]},{"id":"8cfe54e24192df53","type":"api-call-service","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Bathroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1260,"y":120,"wires":[[]]},{"id":"4a6cc4a70ec8b894","type":"api-call-service","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Bathroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1260,"y":280,"wires":[[]]},{"id":"269f267b17835f9e","type":"subflow:3fe087dd9290cd30","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":80,"wires":[["83e9fe224cf56eaf"],["0f8f82c086edc370"],[],[]]},{"id":"3e8a6ff53d4425a8","type":"subflow:3fe087dd9290cd30","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":240,"wires":[["8ccff7d2f7752935"],["2d224de037c2e0fb"],[],[]]},{"id":"2d224de037c2e0fb","type":"api-current-state","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bathroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":240,"wires":[["631bf9eac4809e41"],["4d70d9cf0b54bc16"]]},{"id":"4d70d9cf0b54bc16","type":"api-current-state","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bathroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":240,"wires":[["631bf9eac4809e41"],["4a6cc4a70ec8b894"]]},{"id":"631bf9eac4809e41","type":"delay","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":320,"wires":[["2d224de037c2e0fb"]]},{"id":"c0b45b47b2055647","type":"api-current-state","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bathroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":80,"wires":[["d8532d882bb3b7e8"],["8cfe54e24192df53"]]},{"id":"d8532d882bb3b7e8","type":"delay","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":160,"wires":[["0f8f82c086edc370"]]},{"id":"0f8f82c086edc370","type":"api-current-state","z":"c46ec6da75a29ac3","g":"537c7adde52f50c8","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bathroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":80,"wires":[["d8532d882bb3b7e8"],["c0b45b47b2055647"]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
- [ESPresense Integration](https://espresense.com/)
Automation to activate bath time scene.
Automation to activate morning bathroom scene._which uses:_
- [scene.bathroom_morning](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bathroom/morning.yaml)
Automation to activate normal bathroom scene._which uses:_
- [scene.bathroom_day](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bathroom/day.yaml)
Using Aqara Switch to toggle lighting, overrides motion triggers
Automation to turn off all bathroom lights.Bedroom Motion Automation
Automation which works with motion sensors to activate and de-activate lighting. Also depends on current sleeping status through Bed Sensors.![Node-Red Flow](https://i.imgur.com/rRnmC3Y.png)
Node-Red Code
[{"id":"3fe087dd9290cd30","type":"subflow","name":"Lights Motion Control","info":"","category":"home_assistant","in":[{"x":57,"y":162,"wires":[{"id":"ef28eae7ed719fef"}]}],"out":[{"x":470,"y":375,"wires":[{"id":"7979d0139dcbb40b","port":0}]},{"x":560,"y":390,"wires":[{"id":"7979d0139dcbb40b","port":1}]},{"x":650,"y":75,"wires":[{"id":"41569ba311d53f87","port":0}]},{"x":890,"y":105,"wires":[{"id":"dc014e6fd4f7b01b","port":0}]}],"env":[{"name":"timeOffAfter","type":"num","value":"120"},{"name":"manualCooldown","type":"num","value":"30"},{"name":"brightness","type":"num","value":"100","ui":{"type":"input","opts":{"types":["num","bool","json","bin"]}}},{"name":"transitionOn","type":"num","value":"2"},{"name":"transitionOff","type":"num","value":"2"},{"name":"pause","type":"str","value":"5"},{"name":"controlLights","type":"str","value":""},{"name":"manualLight","type":"bool","value":"false"}],"meta":{},"color":"#52C0F2","icon":"font-awesome/fa-lightbulb-o","status":{"x":1027,"y":157,"wires":[{"id":"67740cc1abae3f4d","port":0}]}},{"id":"69b69fb47d2e171c","type":"change","z":"3fe087dd9290cd30","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":544,"y":178,"wires":[["dc014e6fd4f7b01b"]]},{"id":"dc014e6fd4f7b01b","type":"state-machine","z":"3fe087dd9290cd30","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":741,"y":157,"wires":[["7979d0139dcbb40b","67740cc1abae3f4d"]]},{"id":"c0ac9957e8074a3a","type":"change","z":"3fe087dd9290cd30","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":541,"y":223,"wires":[["dc014e6fd4f7b01b"]]},{"id":"b808c7939e262898","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":630,"wires":[["5436a3c1b895bd12"]]},{"id":"529401309069e7e5","type":"inject","z":"3fe087dd9290cd30","name":"Initial State","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","x":665,"y":570,"wires":[["4060d565fc3941d1","f4e6ddd8960529f3"]]},{"id":"18d112236dd3f2c6","type":"link in","z":"3fe087dd9290cd30","name":"","links":["774c661db65310b7","f95e514e2b0be219"],"x":592,"y":120,"wires":[["dc014e6fd4f7b01b"]]},{"id":"774c661db65310b7","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":1020,"y":570,"wires":[]},{"id":"7979d0139dcbb40b","type":"switch","z":"3fe087dd9290cd30","name":"State Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"},{"t":"eq","v":"motion-off","vt":"str"},{"t":"eq","v":"motion-on","vt":"str"},{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":230,"y":465,"wires":[["83884d0cb7a1e2a8","f9350e6c9e6be889"],["ab49cdb37a246459"],["d826541759debe8b"],["b808c7939e262898","ae931f01824e1cbc"]]},{"id":"ece9daf5e1c3fe6c","type":"rbe","z":"3fe087dd9290cd30","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":369,"y":223,"wires":[["c0ac9957e8074a3a"]]},{"id":"ef28eae7ed719fef","type":"switch","z":"3fe087dd9290cd30","name":"Topic Route","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"^config\\b","vt":"str","case":false},{"t":"regex","v":"^reset\\b","vt":"str","case":false},{"t":"eq","v":"light_state","vt":"str"},{"t":"cont","v":"sensor.","vt":"str"},{"t":"regex","v":"^(light|switch)\\.","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":5,"x":175,"y":162,"wires":[["41569ba311d53f87"],["6b80334d2b0bd4ab"],["dc014e6fd4f7b01b"],["5855ad1b303c6bc1"],["ece9daf5e1c3fe6c","8ffe714a5901d07d"]]},{"id":"41569ba311d53f87","type":"function","z":"3fe087dd9290cd30","name":"Update Configuration","func":"// Init our Lights state while we're here\nlet lights = flow.get('lights')\n// Is this our start-up initialisation? (If so, reset config!)\nlet init = msg.init || false\nif (!lights)\n flow.set('lights', { state: { }, ids: [], ids_csv: '' })\n\n// Merge new Payload with existing config and defaults\nlet cfg = Object.assign(\n // Existing Config\n init?flow.get('cfg')||{}:{}, // 'cfg.'+id\n // Updated Config\n msg.payload)\n\n// Make sure Light IDs are initted.\n// if (!cfg.lights) cfg.lights = []\nif (!cfg.brightness)\n cfg.brightness = env.get('brightness') || 100\n\nif (!cfg.transitionOn && cfg.transitionOn !== 0)\n cfg.transitionOn = env.get('transitionOn') || 2\n \nif (!cfg.transitionOff && cfg.transitionOff !== 0)\n cfg.transitionOff = env.get('transitionOff') || 2\n\nif (!cfg.lights && env.get('controlLights') && env.get('controlLights').length>0)\n cfg.lights = env.get('controlLights').split(/\\s*,\\s*/)\n\nflow.set('cfg', cfg)\n\nreturn { topic: 'config', payload: cfg, lights }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":505,"y":75,"wires":[[]]},{"id":"5855ad1b303c6bc1","type":"switch","z":"3fe087dd9290cd30","name":"motion on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375,"y":178,"wires":[["69b69fb47d2e171c"]]},{"id":"8ffe714a5901d07d","type":"function","z":"3fe087dd9290cd30","name":"Track Lights","func":"// Keep a record of all the light entity_ids coming in, for later switching\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\n\nlet [all, id] = msg.topic.match(/^light\\.(.*)/)\nlet update = false\n\nif (id) {\n lights.state[id] = msg.data.new_state\n if (!lights.ids.includes(id)) {\n lights.ids.push(id)\n update = true\n }\n lights.ids_csv = lights.ids.join(',')\n}\n\nflow.set('lights', lights)\n\nreturn {update}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":389,"y":268,"wires":[["31b931f6b9df7e2e"]]},{"id":"83884d0cb7a1e2a8","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light On. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n brightness: Math.floor(cfg.brightness/100*255),\n transition: cfg.transitionOn,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":330,"wires":[["412fe93b1c4add94","3803e8ecf7384d2b"]]},{"id":"ab49cdb37a246459","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light Off. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n transition: cfg.transitionOff,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":435,"wires":[["ed01207d5f3679e4","63c85b090efb1c5c"]]},{"id":"1ec81804eca7f722","type":"inject","z":"3fe087dd9290cd30","name":"Default Configuration","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"init","v":"true","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"config","payload":"{}","payloadType":"json","x":235,"y":75,"wires":[["41569ba311d53f87"]]},{"id":"2dfcf7ed6c713ca9","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn on light","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":285,"wires":[[]]},{"id":"015672de6c534fb2","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn off light","server":"f43d015e.4b29","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":435,"wires":[[]]},{"id":"4060d565fc3941d1","type":"function","z":"3fe087dd9290cd30","name":"Check State","func":"// Fetch light state from our \"Track Lights\" data\n// - no need for a HA State node\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\nlet cfg = flow.get('cfg')|| {}\n\n// Return \"on\" if any one light is \"on\"\nreturn {\n topic: 'light.'+lights.ids_csv,\n payload: lights.ids.map(id => lights.state[id].state).includes('on') ? 'on' : 'off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":525,"wires":[["774c661db65310b7"]]},{"id":"4b0205094e835fcc","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":880,"y":285,"wires":[["2dfcf7ed6c713ca9"]]},{"id":"88c1ddf9130a3f60","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":875,"y":435,"wires":[["015672de6c534fb2"]]},{"id":"01dd313513cd6bbc","type":"function","z":"3fe087dd9290cd30","name":"motion-on","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-on'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":885,"y":330,"wires":[["f95e514e2b0be219"]]},{"id":"e13e288088919cdf","type":"function","z":"3fe087dd9290cd30","name":"motion-off","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":615,"wires":[["774c661db65310b7"]]},{"id":"f9350e6c9e6be889","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[["63c85b090efb1c5c"]]},{"id":"67740cc1abae3f4d","type":"function","z":"3fe087dd9290cd30","name":"status","func":"\nmsg.payload = {\n text: msg.payload, \n shape: msg.payload.match(/on/) ? 'ring' : 'dot',\n fill: msg.payload == 'switch' ? 'red' : 'green'\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":157,"wires":[[]]},{"id":"412fe93b1c4add94","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":285,"wires":[[],["4b0205094e835fcc"]]},{"id":"ed01207d5f3679e4","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":435,"wires":[[],["88c1ddf9130a3f60"]]},{"id":"f95e514e2b0be219","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":990,"y":330,"wires":[]},{"id":"6b80334d2b0bd4ab","type":"function","z":"3fe087dd9290cd30","name":"Reset","func":"flow.set('lights', null)\nflow.set('cfg', null)\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":365,"y":135,"wires":[["41569ba311d53f87"]]},{"id":"31b931f6b9df7e2e","type":"switch","z":"3fe087dd9290cd30","name":"Updated?","property":"update","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":270,"wires":[["41569ba311d53f87"]]},{"id":"3803e8ecf7384d2b","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":330,"wires":[["01dd313513cd6bbc"]]},{"id":"63c85b090efb1c5c","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":480,"wires":[["4060d565fc3941d1"]]},{"id":"f4e6ddd8960529f3","type":"trigger","z":"3fe087dd9290cd30","name":"Back to Auto","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":715,"y":525,"wires":[["4060d565fc3941d1"]]},{"id":"ae931f01824e1cbc","type":"change","z":"3fe087dd9290cd30","name":"cooldown","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('manualCooldown')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":525,"y":525,"wires":[["f4e6ddd8960529f3"]]},{"id":"d826541759debe8b","type":"change","z":"3fe087dd9290cd30","name":"timeOffAfter","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('timeOffAfter')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":585,"wires":[["5436a3c1b895bd12"]]},{"id":"5436a3c1b895bd12","type":"trigger","z":"3fe087dd9290cd30","name":"Turn Off after motion ends","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":685,"y":615,"wires":[["e13e288088919cdf"]]},{"id":"c2ba449f446e667c","type":"tab","label":"Bedroom","disabled":false,"info":"","env":[]},{"id":"3078332f43c74f1e","type":"group","z":"c2ba449f446e667c","name":"Bedroom Lighting - Motion Control","style":{"fill":"#bfbfbf","fill-opacity":"0.28","label":true},"nodes":["5ce86c26042ed130","cd09166b18a2f86b","0364439744f43537","d2a1dd7d5996161d","04c00c183752e772","fa3b7940e4d2fa24","0b0f420ae089691b","b55a96d513e91a1f","dab1e06e38d4c443","e3d9f3b1d3bcc801","36ec48f25d8ac699","528497d80aeca402","4c43170ab9b6c4fc","ff1a1c54f34eb696","c05cc102028d85e9","cb47a6c87fb91b76","df3acb47ef0f0334","8b28b8db6a97e3b2","40bded6d504046aa","b0bc0dd2b5bc36dc","64fb0975f7ea4c76"],"x":14,"y":19,"w":1792,"h":342},{"id":"5ce86c26042ed130","type":"server-state-changed","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Light Changed - Bedroom","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.all_bedroom_lights","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":120,"wires":[["0364439744f43537"]]},{"id":"cd09166b18a2f86b","type":"server-state-changed","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Presence - Bedroom","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bedroom_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":200,"wires":[["0364439744f43537"],[]]},{"id":"0364439744f43537","type":"time-range-switch","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Day?","lat":"","lon":"","startTime":"sunrise","endTime":"sunset","startOffset":0,"endOffset":0,"x":350,"y":160,"wires":[["d2a1dd7d5996161d"],["04c00c183752e772"]]},{"id":"d2a1dd7d5996161d","type":"subflow:3fe087dd9290cd30","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":80,"wires":[["cb47a6c87fb91b76"],["e3d9f3b1d3bcc801"],[],[]]},{"id":"04c00c183752e772","type":"subflow:3fe087dd9290cd30","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":240,"wires":[["64fb0975f7ea4c76"],["ff1a1c54f34eb696"],[],[]]},{"id":"fa3b7940e4d2fa24","type":"api-call-service","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_day"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1660,"y":60,"wires":[[]]},{"id":"0b0f420ae089691b","type":"api-call-service","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Bedroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1680,"y":120,"wires":[[]]},{"id":"b55a96d513e91a1f","type":"api-call-service","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_night"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1660,"y":220,"wires":[[]]},{"id":"dab1e06e38d4c443","type":"api-call-service","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Bedroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1680,"y":280,"wires":[[]]},{"id":"e3d9f3b1d3bcc801","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bedroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":80,"wires":[["528497d80aeca402"],["36ec48f25d8ac699"]]},{"id":"36ec48f25d8ac699","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bedroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":80,"wires":[["528497d80aeca402"],["0b0f420ae089691b"]]},{"id":"528497d80aeca402","type":"delay","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":160,"wires":[["e3d9f3b1d3bcc801"]]},{"id":"4c43170ab9b6c4fc","type":"delay","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":320,"wires":[["ff1a1c54f34eb696"]]},{"id":"ff1a1c54f34eb696","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bedroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":240,"wires":[["4c43170ab9b6c4fc"],["c05cc102028d85e9"]]},{"id":"c05cc102028d85e9","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"bedroom","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":240,"wires":[["4c43170ab9b6c4fc"],["dab1e06e38d4c443"]]},{"id":"cb47a6c87fb91b76","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleep - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sam_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1190,"y":60,"wires":[[],["df3acb47ef0f0334"]]},{"id":"df3acb47ef0f0334","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleep - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.leah_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1350,"y":60,"wires":[[],["8b28b8db6a97e3b2"]]},{"id":"8b28b8db6a97e3b2","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleeping","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.all_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1500,"y":60,"wires":[[],["fa3b7940e4d2fa24"]]},{"id":"40bded6d504046aa","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleeping","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.all_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1500,"y":220,"wires":[[],["b55a96d513e91a1f"]]},{"id":"b0bc0dd2b5bc36dc","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleep - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.leah_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1350,"y":220,"wires":[[],["40bded6d504046aa"]]},{"id":"64fb0975f7ea4c76","type":"api-current-state","z":"c2ba449f446e667c","g":"3078332f43c74f1e","name":"Sleep - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sam_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1190,"y":220,"wires":[[],["b0bc0dd2b5bc36dc"]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
- [Sleep Sensor Control](#sleep)
Automation to activate bedroom day time scene._which uses:_
- [scene.bedroom_day](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bedroom/day.yaml)
Automation to activate bedroom night time scene._which uses:_
- [scene.bedroom_night](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bedroom/night.yaml)
Automation to activate bedroom movie scene._which uses:_
- [scene.bedroom_movie](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bedroom/movie.yaml)
Automation automatically turn on Movie Scene when TV is turned on to certain apps/channels._which uses:_
- [scene.bedroom_movie](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/bedroom/movie.yaml)
- [Android TV Integration](https://www.home-assistant.io/integrations/androidtv/)
Using Aqara Switch to toggle lighting, overrides motion triggers
Automation to turn off all bedroom lights.Hall Motion Automations
Automation which works with motion and door sensors to activate and de-activate lighting. Also depends on time of day.![Node-Red Flow](https://i.imgur.com/JwBNkYo.png)
Node-Red Code
[{"id":"3fe087dd9290cd30","type":"subflow","name":"Lights Motion Control","info":"","category":"home_assistant","in":[{"x":57,"y":162,"wires":[{"id":"ef28eae7ed719fef"}]}],"out":[{"x":470,"y":375,"wires":[{"id":"7979d0139dcbb40b","port":0}]},{"x":560,"y":390,"wires":[{"id":"7979d0139dcbb40b","port":1}]},{"x":650,"y":75,"wires":[{"id":"41569ba311d53f87","port":0}]},{"x":890,"y":105,"wires":[{"id":"dc014e6fd4f7b01b","port":0}]}],"env":[{"name":"timeOffAfter","type":"num","value":"120"},{"name":"manualCooldown","type":"num","value":"30"},{"name":"brightness","type":"num","value":"100","ui":{"type":"input","opts":{"types":["num","bool","json","bin"]}}},{"name":"transitionOn","type":"num","value":"2"},{"name":"transitionOff","type":"num","value":"2"},{"name":"pause","type":"str","value":"5"},{"name":"controlLights","type":"str","value":""},{"name":"manualLight","type":"bool","value":"false"}],"meta":{},"color":"#52C0F2","icon":"font-awesome/fa-lightbulb-o","status":{"x":1027,"y":157,"wires":[{"id":"67740cc1abae3f4d","port":0}]}},{"id":"69b69fb47d2e171c","type":"change","z":"3fe087dd9290cd30","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":544,"y":178,"wires":[["dc014e6fd4f7b01b"]]},{"id":"dc014e6fd4f7b01b","type":"state-machine","z":"3fe087dd9290cd30","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":741,"y":157,"wires":[["7979d0139dcbb40b","67740cc1abae3f4d"]]},{"id":"c0ac9957e8074a3a","type":"change","z":"3fe087dd9290cd30","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":541,"y":223,"wires":[["dc014e6fd4f7b01b"]]},{"id":"b808c7939e262898","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":630,"wires":[["5436a3c1b895bd12"]]},{"id":"529401309069e7e5","type":"inject","z":"3fe087dd9290cd30","name":"Initial State","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","x":665,"y":570,"wires":[["4060d565fc3941d1","f4e6ddd8960529f3"]]},{"id":"18d112236dd3f2c6","type":"link in","z":"3fe087dd9290cd30","name":"","links":["774c661db65310b7","f95e514e2b0be219"],"x":592,"y":120,"wires":[["dc014e6fd4f7b01b"]]},{"id":"774c661db65310b7","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":1020,"y":570,"wires":[]},{"id":"7979d0139dcbb40b","type":"switch","z":"3fe087dd9290cd30","name":"State Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"},{"t":"eq","v":"motion-off","vt":"str"},{"t":"eq","v":"motion-on","vt":"str"},{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":230,"y":465,"wires":[["83884d0cb7a1e2a8","f9350e6c9e6be889"],["ab49cdb37a246459"],["d826541759debe8b"],["b808c7939e262898","ae931f01824e1cbc"]]},{"id":"ece9daf5e1c3fe6c","type":"rbe","z":"3fe087dd9290cd30","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":369,"y":223,"wires":[["c0ac9957e8074a3a"]]},{"id":"ef28eae7ed719fef","type":"switch","z":"3fe087dd9290cd30","name":"Topic Route","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"^config\\b","vt":"str","case":false},{"t":"regex","v":"^reset\\b","vt":"str","case":false},{"t":"eq","v":"light_state","vt":"str"},{"t":"cont","v":"sensor.","vt":"str"},{"t":"regex","v":"^(light|switch)\\.","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":5,"x":175,"y":162,"wires":[["41569ba311d53f87"],["6b80334d2b0bd4ab"],["dc014e6fd4f7b01b"],["5855ad1b303c6bc1"],["ece9daf5e1c3fe6c","8ffe714a5901d07d"]]},{"id":"41569ba311d53f87","type":"function","z":"3fe087dd9290cd30","name":"Update Configuration","func":"// Init our Lights state while we're here\nlet lights = flow.get('lights')\n// Is this our start-up initialisation? (If so, reset config!)\nlet init = msg.init || false\nif (!lights)\n flow.set('lights', { state: { }, ids: [], ids_csv: '' })\n\n// Merge new Payload with existing config and defaults\nlet cfg = Object.assign(\n // Existing Config\n init?flow.get('cfg')||{}:{}, // 'cfg.'+id\n // Updated Config\n msg.payload)\n\n// Make sure Light IDs are initted.\n// if (!cfg.lights) cfg.lights = []\nif (!cfg.brightness)\n cfg.brightness = env.get('brightness') || 100\n\nif (!cfg.transitionOn && cfg.transitionOn !== 0)\n cfg.transitionOn = env.get('transitionOn') || 2\n \nif (!cfg.transitionOff && cfg.transitionOff !== 0)\n cfg.transitionOff = env.get('transitionOff') || 2\n\nif (!cfg.lights && env.get('controlLights') && env.get('controlLights').length>0)\n cfg.lights = env.get('controlLights').split(/\\s*,\\s*/)\n\nflow.set('cfg', cfg)\n\nreturn { topic: 'config', payload: cfg, lights }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":505,"y":75,"wires":[[]]},{"id":"5855ad1b303c6bc1","type":"switch","z":"3fe087dd9290cd30","name":"motion on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375,"y":178,"wires":[["69b69fb47d2e171c"]]},{"id":"8ffe714a5901d07d","type":"function","z":"3fe087dd9290cd30","name":"Track Lights","func":"// Keep a record of all the light entity_ids coming in, for later switching\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\n\nlet [all, id] = msg.topic.match(/^light\\.(.*)/)\nlet update = false\n\nif (id) {\n lights.state[id] = msg.data.new_state\n if (!lights.ids.includes(id)) {\n lights.ids.push(id)\n update = true\n }\n lights.ids_csv = lights.ids.join(',')\n}\n\nflow.set('lights', lights)\n\nreturn {update}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":389,"y":268,"wires":[["31b931f6b9df7e2e"]]},{"id":"83884d0cb7a1e2a8","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light On. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n brightness: Math.floor(cfg.brightness/100*255),\n transition: cfg.transitionOn,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":330,"wires":[["412fe93b1c4add94","3803e8ecf7384d2b"]]},{"id":"ab49cdb37a246459","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light Off. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n transition: cfg.transitionOff,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":435,"wires":[["ed01207d5f3679e4","63c85b090efb1c5c"]]},{"id":"1ec81804eca7f722","type":"inject","z":"3fe087dd9290cd30","name":"Default Configuration","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"init","v":"true","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"config","payload":"{}","payloadType":"json","x":235,"y":75,"wires":[["41569ba311d53f87"]]},{"id":"2dfcf7ed6c713ca9","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn on light","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":285,"wires":[[]]},{"id":"015672de6c534fb2","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn off light","server":"f43d015e.4b29","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":435,"wires":[[]]},{"id":"4060d565fc3941d1","type":"function","z":"3fe087dd9290cd30","name":"Check State","func":"// Fetch light state from our \"Track Lights\" data\n// - no need for a HA State node\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\nlet cfg = flow.get('cfg')|| {}\n\n// Return \"on\" if any one light is \"on\"\nreturn {\n topic: 'light.'+lights.ids_csv,\n payload: lights.ids.map(id => lights.state[id].state).includes('on') ? 'on' : 'off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":525,"wires":[["774c661db65310b7"]]},{"id":"4b0205094e835fcc","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":880,"y":285,"wires":[["2dfcf7ed6c713ca9"]]},{"id":"88c1ddf9130a3f60","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":875,"y":435,"wires":[["015672de6c534fb2"]]},{"id":"01dd313513cd6bbc","type":"function","z":"3fe087dd9290cd30","name":"motion-on","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-on'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":885,"y":330,"wires":[["f95e514e2b0be219"]]},{"id":"e13e288088919cdf","type":"function","z":"3fe087dd9290cd30","name":"motion-off","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":615,"wires":[["774c661db65310b7"]]},{"id":"f9350e6c9e6be889","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[["63c85b090efb1c5c"]]},{"id":"67740cc1abae3f4d","type":"function","z":"3fe087dd9290cd30","name":"status","func":"\nmsg.payload = {\n text: msg.payload, \n shape: msg.payload.match(/on/) ? 'ring' : 'dot',\n fill: msg.payload == 'switch' ? 'red' : 'green'\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":157,"wires":[[]]},{"id":"412fe93b1c4add94","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":285,"wires":[[],["4b0205094e835fcc"]]},{"id":"ed01207d5f3679e4","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":435,"wires":[[],["88c1ddf9130a3f60"]]},{"id":"f95e514e2b0be219","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":990,"y":330,"wires":[]},{"id":"6b80334d2b0bd4ab","type":"function","z":"3fe087dd9290cd30","name":"Reset","func":"flow.set('lights', null)\nflow.set('cfg', null)\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":365,"y":135,"wires":[["41569ba311d53f87"]]},{"id":"31b931f6b9df7e2e","type":"switch","z":"3fe087dd9290cd30","name":"Updated?","property":"update","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":270,"wires":[["41569ba311d53f87"]]},{"id":"3803e8ecf7384d2b","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":330,"wires":[["01dd313513cd6bbc"]]},{"id":"63c85b090efb1c5c","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":480,"wires":[["4060d565fc3941d1"]]},{"id":"f4e6ddd8960529f3","type":"trigger","z":"3fe087dd9290cd30","name":"Back to Auto","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":715,"y":525,"wires":[["4060d565fc3941d1"]]},{"id":"ae931f01824e1cbc","type":"change","z":"3fe087dd9290cd30","name":"cooldown","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('manualCooldown')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":525,"y":525,"wires":[["f4e6ddd8960529f3"]]},{"id":"d826541759debe8b","type":"change","z":"3fe087dd9290cd30","name":"timeOffAfter","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('timeOffAfter')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":585,"wires":[["5436a3c1b895bd12"]]},{"id":"5436a3c1b895bd12","type":"trigger","z":"3fe087dd9290cd30","name":"Turn Off after motion ends","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":685,"y":615,"wires":[["e13e288088919cdf"]]},{"id":"7c547859912b407f","type":"tab","label":"Hall","disabled":false,"info":"","env":[]},{"id":"e47d3124ce86e5cf","type":"group","z":"7c547859912b407f","name":"Hall Lighting - Door Control","style":{"label":true,"fill":"#bfbfbf","fill-opacity":"0.28"},"nodes":["0d31b91fa456ef0a","34ed0ea27e507b41","1160707e1d5f6745","e067aa5a9a5ad390","a89b115c1bcf76b0"],"x":14,"y":339,"w":812,"h":142},{"id":"464bc9ab39de8545","type":"group","z":"7c547859912b407f","name":"Hall Lighting - Laundry Door Control","style":{"label":true,"fill":"#bfbfbf","fill-opacity":"0.28"},"nodes":["d195ee04f84b7928","69ebe74c270b5bb1","ee688e398b26730a"],"x":14,"y":499,"w":432,"h":122},{"id":"aa2f310e392efda0","type":"group","z":"7c547859912b407f","name":"Hall Lighting - Motion Control","style":{"label":true,"fill":"#bfbfbf","fill-opacity":"0.28"},"nodes":["62efa5699f57d51f","de1df19184f06c83","a94a530f88e5f4f9","2632c616d1300e99","bad02d499148ab35","7672c00a2173eac4","5ff5a464bebab643","e01790068bb3e847","1291ef35c3de7250"],"x":14,"y":19,"w":832,"h":302},{"id":"62efa5699f57d51f","type":"server-state-changed","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Light Changed - Hall","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.hall_l","entityidfiltertype":"regex","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":120,"wires":[["a94a530f88e5f4f9"]]},{"id":"de1df19184f06c83","type":"server-state-changed","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Presence - Hall","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.hall_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":200,"wires":[["a94a530f88e5f4f9"],[]]},{"id":"a94a530f88e5f4f9","type":"time-range-switch","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Day?","lat":"","lon":"","startTime":"08:00","endTime":"18:00","startOffset":0,"endOffset":0,"x":310,"y":160,"wires":[["e01790068bb3e847"],["1291ef35c3de7250"]]},{"id":"2632c616d1300e99","type":"api-call-service","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_hall_night"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":220,"wires":[[]]},{"id":"0d31b91fa456ef0a","type":"server-state-changed","z":"7c547859912b407f","g":"e47d3124ce86e5cf","name":"Hall Door Open","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.front_door_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":400,"wires":[["34ed0ea27e507b41"],["1160707e1d5f6745"]]},{"id":"34ed0ea27e507b41","type":"api-call-service","z":"7c547859912b407f","g":"e47d3124ce86e5cf","name":"Main Lights ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.hall_main_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":320,"y":380,"wires":[["1160707e1d5f6745"]]},{"id":"1160707e1d5f6745","type":"delay","z":"7c547859912b407f","g":"e47d3124ce86e5cf","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":440,"wires":[["a89b115c1bcf76b0"]]},{"id":"e067aa5a9a5ad390","type":"api-call-service","z":"7c547859912b407f","g":"e47d3124ce86e5cf","name":"Main Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.hall_main_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":400,"wires":[[]]},{"id":"d195ee04f84b7928","type":"server-state-changed","z":"7c547859912b407f","g":"464bc9ab39de8545","name":"Laundry Door Open","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.washing_room_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":560,"wires":[["69ebe74c270b5bb1"],["ee688e398b26730a"]]},{"id":"69ebe74c270b5bb1","type":"api-call-service","z":"7c547859912b407f","g":"464bc9ab39de8545","name":"Main Light ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.hall_main_light_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":340,"y":540,"wires":[[]]},{"id":"ee688e398b26730a","type":"api-call-service","z":"7c547859912b407f","g":"464bc9ab39de8545","name":"Main Light OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.hall_main_light_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":340,"y":580,"wires":[[]]},{"id":"bad02d499148ab35","type":"api-call-service","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Hall Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_hall_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":120,"wires":[[]]},{"id":"7672c00a2173eac4","type":"api-call-service","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Hall Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_hall_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":280,"wires":[[]]},{"id":"5ff5a464bebab643","type":"api-call-service","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_hall_day"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":60,"wires":[[]]},{"id":"a89b115c1bcf76b0","type":"api-current-state","z":"7c547859912b407f","g":"e47d3124ce86e5cf","name":"Laundry Open","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.washing_room_door","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":400,"wires":[["1160707e1d5f6745"],["e067aa5a9a5ad390"]]},{"id":"e01790068bb3e847","type":"subflow:3fe087dd9290cd30","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"","env":[{"name":"timeOffAfter","value":"300","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":500,"y":80,"wires":[["5ff5a464bebab643"],["bad02d499148ab35"],[],[]]},{"id":"1291ef35c3de7250","type":"subflow:3fe087dd9290cd30","z":"7c547859912b407f","g":"aa2f310e392efda0","name":"","env":[{"name":"timeOffAfter","value":"300","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":500,"y":240,"wires":[["2632c616d1300e99"],["7672c00a2173eac4"],[],[]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
Automation to activate hallway day time scene._which uses:_
- [scene.hall_day](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/hall/day.yaml)
Automation to activate hallway night time scene._which uses:_
- [scene.hall_night](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/hall/night.yaml)
Automation to activate hallway sleeping scene when going for a pee at night._which uses:_
- [scene.hall_sleep](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/hall/sleep.yaml)
Automation to turn off all hallway lights.Kitchen Motion Automations
Automation which works with motion sensors to activate and de-activate lighting. Also depends on time of day.![Node-Red Flow](https://i.imgur.com/l8UDEn1.png)
Node-Red Code
[{"id":"3fe087dd9290cd30","type":"subflow","name":"Lights Motion Control","info":"","category":"home_assistant","in":[{"x":57,"y":162,"wires":[{"id":"ef28eae7ed719fef"}]}],"out":[{"x":470,"y":375,"wires":[{"id":"7979d0139dcbb40b","port":0}]},{"x":560,"y":390,"wires":[{"id":"7979d0139dcbb40b","port":1}]},{"x":650,"y":75,"wires":[{"id":"41569ba311d53f87","port":0}]},{"x":890,"y":105,"wires":[{"id":"dc014e6fd4f7b01b","port":0}]}],"env":[{"name":"timeOffAfter","type":"num","value":"120"},{"name":"manualCooldown","type":"num","value":"30"},{"name":"brightness","type":"num","value":"100","ui":{"type":"input","opts":{"types":["num","bool","json","bin"]}}},{"name":"transitionOn","type":"num","value":"2"},{"name":"transitionOff","type":"num","value":"2"},{"name":"pause","type":"str","value":"5"},{"name":"controlLights","type":"str","value":""},{"name":"manualLight","type":"bool","value":"false"}],"meta":{},"color":"#52C0F2","icon":"font-awesome/fa-lightbulb-o","status":{"x":1027,"y":157,"wires":[{"id":"67740cc1abae3f4d","port":0}]}},{"id":"69b69fb47d2e171c","type":"change","z":"3fe087dd9290cd30","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":544,"y":178,"wires":[["dc014e6fd4f7b01b"]]},{"id":"dc014e6fd4f7b01b","type":"state-machine","z":"3fe087dd9290cd30","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":741,"y":157,"wires":[["7979d0139dcbb40b","67740cc1abae3f4d"]]},{"id":"c0ac9957e8074a3a","type":"change","z":"3fe087dd9290cd30","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":541,"y":223,"wires":[["dc014e6fd4f7b01b"]]},{"id":"b808c7939e262898","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":630,"wires":[["5436a3c1b895bd12"]]},{"id":"529401309069e7e5","type":"inject","z":"3fe087dd9290cd30","name":"Initial State","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","x":665,"y":570,"wires":[["4060d565fc3941d1","f4e6ddd8960529f3"]]},{"id":"18d112236dd3f2c6","type":"link in","z":"3fe087dd9290cd30","name":"","links":["774c661db65310b7","f95e514e2b0be219"],"x":592,"y":120,"wires":[["dc014e6fd4f7b01b"]]},{"id":"774c661db65310b7","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":1020,"y":570,"wires":[]},{"id":"7979d0139dcbb40b","type":"switch","z":"3fe087dd9290cd30","name":"State Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"},{"t":"eq","v":"motion-off","vt":"str"},{"t":"eq","v":"motion-on","vt":"str"},{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":230,"y":465,"wires":[["83884d0cb7a1e2a8","f9350e6c9e6be889"],["ab49cdb37a246459"],["d826541759debe8b"],["b808c7939e262898","ae931f01824e1cbc"]]},{"id":"ece9daf5e1c3fe6c","type":"rbe","z":"3fe087dd9290cd30","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":369,"y":223,"wires":[["c0ac9957e8074a3a"]]},{"id":"ef28eae7ed719fef","type":"switch","z":"3fe087dd9290cd30","name":"Topic Route","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"^config\\b","vt":"str","case":false},{"t":"regex","v":"^reset\\b","vt":"str","case":false},{"t":"eq","v":"light_state","vt":"str"},{"t":"cont","v":"sensor.","vt":"str"},{"t":"regex","v":"^(light|switch)\\.","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":5,"x":175,"y":162,"wires":[["41569ba311d53f87"],["6b80334d2b0bd4ab"],["dc014e6fd4f7b01b"],["5855ad1b303c6bc1"],["ece9daf5e1c3fe6c","8ffe714a5901d07d"]]},{"id":"41569ba311d53f87","type":"function","z":"3fe087dd9290cd30","name":"Update Configuration","func":"// Init our Lights state while we're here\nlet lights = flow.get('lights')\n// Is this our start-up initialisation? (If so, reset config!)\nlet init = msg.init || false\nif (!lights)\n flow.set('lights', { state: { }, ids: [], ids_csv: '' })\n\n// Merge new Payload with existing config and defaults\nlet cfg = Object.assign(\n // Existing Config\n init?flow.get('cfg')||{}:{}, // 'cfg.'+id\n // Updated Config\n msg.payload)\n\n// Make sure Light IDs are initted.\n// if (!cfg.lights) cfg.lights = []\nif (!cfg.brightness)\n cfg.brightness = env.get('brightness') || 100\n\nif (!cfg.transitionOn && cfg.transitionOn !== 0)\n cfg.transitionOn = env.get('transitionOn') || 2\n \nif (!cfg.transitionOff && cfg.transitionOff !== 0)\n cfg.transitionOff = env.get('transitionOff') || 2\n\nif (!cfg.lights && env.get('controlLights') && env.get('controlLights').length>0)\n cfg.lights = env.get('controlLights').split(/\\s*,\\s*/)\n\nflow.set('cfg', cfg)\n\nreturn { topic: 'config', payload: cfg, lights }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":505,"y":75,"wires":[[]]},{"id":"5855ad1b303c6bc1","type":"switch","z":"3fe087dd9290cd30","name":"motion on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375,"y":178,"wires":[["69b69fb47d2e171c"]]},{"id":"8ffe714a5901d07d","type":"function","z":"3fe087dd9290cd30","name":"Track Lights","func":"// Keep a record of all the light entity_ids coming in, for later switching\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\n\nlet [all, id] = msg.topic.match(/^light\\.(.*)/)\nlet update = false\n\nif (id) {\n lights.state[id] = msg.data.new_state\n if (!lights.ids.includes(id)) {\n lights.ids.push(id)\n update = true\n }\n lights.ids_csv = lights.ids.join(',')\n}\n\nflow.set('lights', lights)\n\nreturn {update}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":389,"y":268,"wires":[["31b931f6b9df7e2e"]]},{"id":"83884d0cb7a1e2a8","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light On. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n brightness: Math.floor(cfg.brightness/100*255),\n transition: cfg.transitionOn,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":330,"wires":[["412fe93b1c4add94","3803e8ecf7384d2b"]]},{"id":"ab49cdb37a246459","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light Off. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n transition: cfg.transitionOff,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":435,"wires":[["ed01207d5f3679e4","63c85b090efb1c5c"]]},{"id":"1ec81804eca7f722","type":"inject","z":"3fe087dd9290cd30","name":"Default Configuration","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"init","v":"true","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"config","payload":"{}","payloadType":"json","x":235,"y":75,"wires":[["41569ba311d53f87"]]},{"id":"2dfcf7ed6c713ca9","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn on light","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":285,"wires":[[]]},{"id":"015672de6c534fb2","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn off light","server":"f43d015e.4b29","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":435,"wires":[[]]},{"id":"4060d565fc3941d1","type":"function","z":"3fe087dd9290cd30","name":"Check State","func":"// Fetch light state from our \"Track Lights\" data\n// - no need for a HA State node\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\nlet cfg = flow.get('cfg')|| {}\n\n// Return \"on\" if any one light is \"on\"\nreturn {\n topic: 'light.'+lights.ids_csv,\n payload: lights.ids.map(id => lights.state[id].state).includes('on') ? 'on' : 'off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":525,"wires":[["774c661db65310b7"]]},{"id":"4b0205094e835fcc","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":880,"y":285,"wires":[["2dfcf7ed6c713ca9"]]},{"id":"88c1ddf9130a3f60","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":875,"y":435,"wires":[["015672de6c534fb2"]]},{"id":"01dd313513cd6bbc","type":"function","z":"3fe087dd9290cd30","name":"motion-on","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-on'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":885,"y":330,"wires":[["f95e514e2b0be219"]]},{"id":"e13e288088919cdf","type":"function","z":"3fe087dd9290cd30","name":"motion-off","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":615,"wires":[["774c661db65310b7"]]},{"id":"f9350e6c9e6be889","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[["63c85b090efb1c5c"]]},{"id":"67740cc1abae3f4d","type":"function","z":"3fe087dd9290cd30","name":"status","func":"\nmsg.payload = {\n text: msg.payload, \n shape: msg.payload.match(/on/) ? 'ring' : 'dot',\n fill: msg.payload == 'switch' ? 'red' : 'green'\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":157,"wires":[[]]},{"id":"412fe93b1c4add94","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":285,"wires":[[],["4b0205094e835fcc"]]},{"id":"ed01207d5f3679e4","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":435,"wires":[[],["88c1ddf9130a3f60"]]},{"id":"f95e514e2b0be219","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":990,"y":330,"wires":[]},{"id":"6b80334d2b0bd4ab","type":"function","z":"3fe087dd9290cd30","name":"Reset","func":"flow.set('lights', null)\nflow.set('cfg', null)\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":365,"y":135,"wires":[["41569ba311d53f87"]]},{"id":"31b931f6b9df7e2e","type":"switch","z":"3fe087dd9290cd30","name":"Updated?","property":"update","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":270,"wires":[["41569ba311d53f87"]]},{"id":"3803e8ecf7384d2b","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":330,"wires":[["01dd313513cd6bbc"]]},{"id":"63c85b090efb1c5c","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":480,"wires":[["4060d565fc3941d1"]]},{"id":"f4e6ddd8960529f3","type":"trigger","z":"3fe087dd9290cd30","name":"Back to Auto","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":715,"y":525,"wires":[["4060d565fc3941d1"]]},{"id":"ae931f01824e1cbc","type":"change","z":"3fe087dd9290cd30","name":"cooldown","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('manualCooldown')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":525,"y":525,"wires":[["f4e6ddd8960529f3"]]},{"id":"d826541759debe8b","type":"change","z":"3fe087dd9290cd30","name":"timeOffAfter","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('timeOffAfter')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":585,"wires":[["5436a3c1b895bd12"]]},{"id":"5436a3c1b895bd12","type":"trigger","z":"3fe087dd9290cd30","name":"Turn Off after motion ends","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":685,"y":615,"wires":[["e13e288088919cdf"]]},{"id":"5925a2ee8761878a","type":"tab","label":"Kitchen","disabled":false,"info":"","env":[]},{"id":"39d02b6be63906b1","type":"group","z":"5925a2ee8761878a","name":"Kitchen Lighting - Motion Control","style":{"fill":"#bfbfbf","fill-opacity":"0.28","label":true},"nodes":["a06c23e8790108bb","a5333058d41b3bec","3d13c8a135a17c03","4efdbdf503b5c76a","c3bef82f56eb994a","3692fc1e966e3ef0","883438455db258f9","53268e3df43ccfe4","6f7f1df2807a48ce","0b7f118beb260c50","15fb765bf841966f","9542b8ade6e70e3b","66f27ab9b75d99f1","7fdc95a31e7ab91f","80b7271fdd1bb59d"],"x":14,"y":19,"w":1352,"h":342},{"id":"a06c23e8790108bb","type":"server-state-changed","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Light Changed - Kitchen","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.all_kitchen_lights","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":120,"wires":[["3d13c8a135a17c03"]]},{"id":"a5333058d41b3bec","type":"server-state-changed","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Presence - Kitchen","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.kitchen_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":200,"wires":[["3d13c8a135a17c03"],[]]},{"id":"3d13c8a135a17c03","type":"time-range-switch","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Day?","lat":"","lon":"","startTime":"12:30","endTime":"20:30","startOffset":0,"endOffset":0,"x":350,"y":160,"wires":[["4efdbdf503b5c76a"],["c3bef82f56eb994a"]]},{"id":"4efdbdf503b5c76a","type":"subflow:3fe087dd9290cd30","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":80,"wires":[["3692fc1e966e3ef0"],["0b7f118beb260c50"],[],[]]},{"id":"c3bef82f56eb994a","type":"subflow:3fe087dd9290cd30","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":540,"y":240,"wires":[["53268e3df43ccfe4"],["66f27ab9b75d99f1"],[],[]]},{"id":"3692fc1e966e3ef0","type":"api-call-service","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Cooking Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_cooking"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":60,"wires":[[]]},{"id":"883438455db258f9","type":"api-call-service","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Kitchen Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":120,"wires":[[]]},{"id":"53268e3df43ccfe4","type":"api-call-service","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Normal Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_normal"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":220,"wires":[[]]},{"id":"6f7f1df2807a48ce","type":"api-call-service","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Kitchen Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1250,"y":280,"wires":[[]]},{"id":"0b7f118beb260c50","type":"api-current-state","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"kitchen","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":80,"wires":[["9542b8ade6e70e3b"],["15fb765bf841966f"]]},{"id":"15fb765bf841966f","type":"api-current-state","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"kitchen","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":80,"wires":[["9542b8ade6e70e3b"],["883438455db258f9"]]},{"id":"9542b8ade6e70e3b","type":"delay","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":160,"wires":[["0b7f118beb260c50"]]},{"id":"66f27ab9b75d99f1","type":"api-current-state","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"kitchen","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":780,"y":240,"wires":[["7fdc95a31e7ab91f"],["80b7271fdd1bb59d"]]},{"id":"7fdc95a31e7ab91f","type":"delay","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":880,"y":320,"wires":[["66f27ab9b75d99f1"]]},{"id":"80b7271fdd1bb59d","type":"api-current-state","z":"5925a2ee8761878a","g":"39d02b6be63906b1","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"kitchen","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":980,"y":240,"wires":[["7fdc95a31e7ab91f"],["6f7f1df2807a48ce"]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
Automation to activate kitchen cooking scene during certain times._which uses:_
- [scene.kitchen_cooking](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/kitchen/cooking.yaml)
Automation to activate normal kitchen scene._which uses:_
- [scene.kitchen_normal](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/kitchen/normal.yaml)
Using Aqara Switch to toggle lighting, overrides motion triggers
Automation to turn off all kitchen lights.Living Room Motion Automations
Automation which works with motion sensors to activate and de-activate lighting. Also depends on time of day.![Node-Red Flow](https://i.imgur.com/N2MnvfY.png)
Node-Red Code
[{"id":"3fe087dd9290cd30","type":"subflow","name":"Lights Motion Control","info":"","category":"home_assistant","in":[{"x":57,"y":162,"wires":[{"id":"ef28eae7ed719fef"}]}],"out":[{"x":470,"y":375,"wires":[{"id":"7979d0139dcbb40b","port":0}]},{"x":560,"y":390,"wires":[{"id":"7979d0139dcbb40b","port":1}]},{"x":650,"y":75,"wires":[{"id":"41569ba311d53f87","port":0}]},{"x":890,"y":105,"wires":[{"id":"dc014e6fd4f7b01b","port":0}]}],"env":[{"name":"timeOffAfter","type":"num","value":"120"},{"name":"manualCooldown","type":"num","value":"30"},{"name":"brightness","type":"num","value":"100","ui":{"type":"input","opts":{"types":["num","bool","json","bin"]}}},{"name":"transitionOn","type":"num","value":"2"},{"name":"transitionOff","type":"num","value":"2"},{"name":"pause","type":"str","value":"5"},{"name":"controlLights","type":"str","value":""},{"name":"manualLight","type":"bool","value":"false"}],"meta":{},"color":"#52C0F2","icon":"font-awesome/fa-lightbulb-o","status":{"x":1027,"y":157,"wires":[{"id":"67740cc1abae3f4d","port":0}]}},{"id":"69b69fb47d2e171c","type":"change","z":"3fe087dd9290cd30","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":544,"y":178,"wires":[["dc014e6fd4f7b01b"]]},{"id":"dc014e6fd4f7b01b","type":"state-machine","z":"3fe087dd9290cd30","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":741,"y":157,"wires":[["7979d0139dcbb40b","67740cc1abae3f4d"]]},{"id":"c0ac9957e8074a3a","type":"change","z":"3fe087dd9290cd30","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":541,"y":223,"wires":[["dc014e6fd4f7b01b"]]},{"id":"b808c7939e262898","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":630,"wires":[["5436a3c1b895bd12"]]},{"id":"529401309069e7e5","type":"inject","z":"3fe087dd9290cd30","name":"Initial State","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"10","topic":"","x":665,"y":570,"wires":[["4060d565fc3941d1","f4e6ddd8960529f3"]]},{"id":"18d112236dd3f2c6","type":"link in","z":"3fe087dd9290cd30","name":"","links":["774c661db65310b7","f95e514e2b0be219"],"x":592,"y":120,"wires":[["dc014e6fd4f7b01b"]]},{"id":"774c661db65310b7","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":1020,"y":570,"wires":[]},{"id":"7979d0139dcbb40b","type":"switch","z":"3fe087dd9290cd30","name":"State Action","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"},{"t":"eq","v":"motion-off","vt":"str"},{"t":"eq","v":"motion-on","vt":"str"},{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":230,"y":465,"wires":[["83884d0cb7a1e2a8","f9350e6c9e6be889"],["ab49cdb37a246459"],["d826541759debe8b"],["b808c7939e262898","ae931f01824e1cbc"]]},{"id":"ece9daf5e1c3fe6c","type":"rbe","z":"3fe087dd9290cd30","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":369,"y":223,"wires":[["c0ac9957e8074a3a"]]},{"id":"ef28eae7ed719fef","type":"switch","z":"3fe087dd9290cd30","name":"Topic Route","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"^config\\b","vt":"str","case":false},{"t":"regex","v":"^reset\\b","vt":"str","case":false},{"t":"eq","v":"light_state","vt":"str"},{"t":"cont","v":"sensor.","vt":"str"},{"t":"regex","v":"^(light|switch)\\.","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":5,"x":175,"y":162,"wires":[["41569ba311d53f87"],["6b80334d2b0bd4ab"],["dc014e6fd4f7b01b"],["5855ad1b303c6bc1"],["ece9daf5e1c3fe6c","8ffe714a5901d07d"]]},{"id":"41569ba311d53f87","type":"function","z":"3fe087dd9290cd30","name":"Update Configuration","func":"// Init our Lights state while we're here\nlet lights = flow.get('lights')\n// Is this our start-up initialisation? (If so, reset config!)\nlet init = msg.init || false\nif (!lights)\n flow.set('lights', { state: { }, ids: [], ids_csv: '' })\n\n// Merge new Payload with existing config and defaults\nlet cfg = Object.assign(\n // Existing Config\n init?flow.get('cfg')||{}:{}, // 'cfg.'+id\n // Updated Config\n msg.payload)\n\n// Make sure Light IDs are initted.\n// if (!cfg.lights) cfg.lights = []\nif (!cfg.brightness)\n cfg.brightness = env.get('brightness') || 100\n\nif (!cfg.transitionOn && cfg.transitionOn !== 0)\n cfg.transitionOn = env.get('transitionOn') || 2\n \nif (!cfg.transitionOff && cfg.transitionOff !== 0)\n cfg.transitionOff = env.get('transitionOff') || 2\n\nif (!cfg.lights && env.get('controlLights') && env.get('controlLights').length>0)\n cfg.lights = env.get('controlLights').split(/\\s*,\\s*/)\n\nflow.set('cfg', cfg)\n\nreturn { topic: 'config', payload: cfg, lights }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":505,"y":75,"wires":[[]]},{"id":"5855ad1b303c6bc1","type":"switch","z":"3fe087dd9290cd30","name":"motion on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":375,"y":178,"wires":[["69b69fb47d2e171c"]]},{"id":"8ffe714a5901d07d","type":"function","z":"3fe087dd9290cd30","name":"Track Lights","func":"// Keep a record of all the light entity_ids coming in, for later switching\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\n\nlet [all, id] = msg.topic.match(/^light\\.(.*)/)\nlet update = false\n\nif (id) {\n lights.state[id] = msg.data.new_state\n if (!lights.ids.includes(id)) {\n lights.ids.push(id)\n update = true\n }\n lights.ids_csv = lights.ids.join(',')\n}\n\nflow.set('lights', lights)\n\nreturn {update}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":389,"y":268,"wires":[["31b931f6b9df7e2e"]]},{"id":"83884d0cb7a1e2a8","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light On. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n brightness: Math.floor(cfg.brightness/100*255),\n transition: cfg.transitionOn,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":330,"wires":[["412fe93b1c4add94","3803e8ecf7384d2b"]]},{"id":"ab49cdb37a246459","type":"function","z":"3fe087dd9290cd30","name":"Light Cfg","func":"let cfg = flow.get('cfg')|| {}\nlet lights = flow.get('lights') || {}\n// Use Light IDs from Config if defined - otherwise use detected\nlet light_ids = cfg.lights || lights.ids\nlet delay = env.get('pause')*1000\n\n// Prepare config paramters for Light Off. This is\n// an Array of Payload Data, one for each light\nlet payload = light_ids.map(id => { return {\n data: {\n transition: cfg.transitionOff,\n entity_id: 'light.'+id\n }\n}})\n\nreturn {\n topic: 'light.'+light_ids.join(','),\n payload,\n delay\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":525,"y":435,"wires":[["ed01207d5f3679e4","63c85b090efb1c5c"]]},{"id":"1ec81804eca7f722","type":"inject","z":"3fe087dd9290cd30","name":"Default Configuration","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"init","v":"true","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"config","payload":"{}","payloadType":"json","x":235,"y":75,"wires":[["41569ba311d53f87"]]},{"id":"2dfcf7ed6c713ca9","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn on light","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":285,"wires":[[]]},{"id":"015672de6c534fb2","type":"api-call-service","z":"3fe087dd9290cd30","name":"Turn off light","server":"f43d015e.4b29","version":5,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":1045,"y":435,"wires":[[]]},{"id":"4060d565fc3941d1","type":"function","z":"3fe087dd9290cd30","name":"Check State","func":"// Fetch light state from our \"Track Lights\" data\n// - no need for a HA State node\n\nlet lights = flow.get('lights') || { state: { }, ids: [], ids_csv: '' }\nlet cfg = flow.get('cfg')|| {}\n\n// Return \"on\" if any one light is \"on\"\nreturn {\n topic: 'light.'+lights.ids_csv,\n payload: lights.ids.map(id => lights.state[id].state).includes('on') ? 'on' : 'off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":525,"wires":[["774c661db65310b7"]]},{"id":"4b0205094e835fcc","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":880,"y":285,"wires":[["2dfcf7ed6c713ca9"]]},{"id":"88c1ddf9130a3f60","type":"split","z":"3fe087dd9290cd30","name":"Each Light","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":875,"y":435,"wires":[["015672de6c534fb2"]]},{"id":"01dd313513cd6bbc","type":"function","z":"3fe087dd9290cd30","name":"motion-on","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-on'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":885,"y":330,"wires":[["f95e514e2b0be219"]]},{"id":"e13e288088919cdf","type":"function","z":"3fe087dd9290cd30","name":"motion-off","func":"// We use a function here to generate a new clean message\n\nreturn {\n topic: 'state',\n payload: 'motion-off'\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":900,"y":615,"wires":[["774c661db65310b7"]]},{"id":"f9350e6c9e6be889","type":"change","z":"3fe087dd9290cd30","name":"stop","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":480,"wires":[["63c85b090efb1c5c"]]},{"id":"67740cc1abae3f4d","type":"function","z":"3fe087dd9290cd30","name":"status","func":"\nmsg.payload = {\n text: msg.payload, \n shape: msg.payload.match(/on/) ? 'ring' : 'dot',\n fill: msg.payload == 'switch' ? 'red' : 'green'\n}\nreturn msg;","outputs":1,"noerr":0,"x":928,"y":157,"wires":[[]]},{"id":"412fe93b1c4add94","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":285,"wires":[[],["4b0205094e835fcc"]]},{"id":"ed01207d5f3679e4","type":"switch","z":"3fe087dd9290cd30","name":"Manual?","property":"manualLight","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":705,"y":435,"wires":[[],["88c1ddf9130a3f60"]]},{"id":"f95e514e2b0be219","type":"link out","z":"3fe087dd9290cd30","name":"living room state","links":["18d112236dd3f2c6"],"x":990,"y":330,"wires":[]},{"id":"6b80334d2b0bd4ab","type":"function","z":"3fe087dd9290cd30","name":"Reset","func":"flow.set('lights', null)\nflow.set('cfg', null)\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":365,"y":135,"wires":[["41569ba311d53f87"]]},{"id":"31b931f6b9df7e2e","type":"switch","z":"3fe087dd9290cd30","name":"Updated?","property":"update","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":270,"wires":[["41569ba311d53f87"]]},{"id":"3803e8ecf7384d2b","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":330,"wires":[["01dd313513cd6bbc"]]},{"id":"63c85b090efb1c5c","type":"trigger","z":"3fe087dd9290cd30","name":"pause","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":695,"y":480,"wires":[["4060d565fc3941d1"]]},{"id":"f4e6ddd8960529f3","type":"trigger","z":"3fe087dd9290cd30","name":"Back to Auto","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":715,"y":525,"wires":[["4060d565fc3941d1"]]},{"id":"ae931f01824e1cbc","type":"change","z":"3fe087dd9290cd30","name":"cooldown","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('manualCooldown')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":525,"y":525,"wires":[["f4e6ddd8960529f3"]]},{"id":"d826541759debe8b","type":"change","z":"3fe087dd9290cd30","name":"timeOffAfter","rules":[{"t":"set","p":"delay","pt":"msg","to":"$env('timeOffAfter')*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":585,"wires":[["5436a3c1b895bd12"]]},{"id":"5436a3c1b895bd12","type":"trigger","z":"3fe087dd9290cd30","name":"Turn Off after motion ends","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":true,"overrideDelay":true,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":685,"y":615,"wires":[["e13e288088919cdf"]]},{"id":"e0c421ee2f5c3583","type":"tab","label":"Living Room","disabled":false,"info":"","env":[]},{"id":"d145013fd225514e","type":"group","z":"e0c421ee2f5c3583","name":"Living Room Lighting - Motion Control","style":{"fill":"#bfbfbf","fill-opacity":"0.28","label":true},"nodes":["f396b801e8b91c33","3dc2680596e293a9","34fc805bf3ba1ab4","3798a83c9943d757","2435cf2a9de94252","c755295b8d9c038e","8522062f8659f6d9","e75f566645916eaf","52dda2bb64a6deee","15227e746b821b8f","684ee904cda12c90","3ec6c81cb45af358","1c4c65f28cfce75c","60c98d0125ee20a5","76e5a670cbb08c94","1c92d6d336ec8899","939bf525bdba98c7","d20c32fe0bb41d7b","fae1320af0d51887"],"x":14,"y":19,"w":1792,"h":342},{"id":"f396b801e8b91c33","type":"server-state-changed","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Light Changed - LR","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.all_living_room_lights","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":120,"wires":[["34fc805bf3ba1ab4"]]},{"id":"3dc2680596e293a9","type":"server-state-changed","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Presence - Living Room","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.living_room_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":200,"wires":[["34fc805bf3ba1ab4"],[]]},{"id":"34fc805bf3ba1ab4","type":"time-range-switch","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Day?","lat":"","lon":"","startTime":"sunrise","endTime":"sunset","startOffset":0,"endOffset":0,"x":330,"y":160,"wires":[["3798a83c9943d757"],["2435cf2a9de94252"]]},{"id":"3798a83c9943d757","type":"subflow:3fe087dd9290cd30","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":520,"y":80,"wires":[["1c92d6d336ec8899"],["15227e746b821b8f"],[],[]]},{"id":"2435cf2a9de94252","type":"subflow:3fe087dd9290cd30","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"","env":[{"name":"timeOffAfter","value":"500","type":"num"},{"name":"brightness","value":"","type":"num"},{"name":"manualLight","value":"true","type":"bool"}],"x":520,"y":240,"wires":[["939bf525bdba98c7"],["60c98d0125ee20a5"],[],[]]},{"id":"c755295b8d9c038e","type":"api-call-service","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_day"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1640,"y":60,"wires":[[]]},{"id":"8522062f8659f6d9","type":"api-call-service","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Living Room Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1670,"y":120,"wires":[[]]},{"id":"e75f566645916eaf","type":"api-call-service","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_night"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1640,"y":220,"wires":[[]]},{"id":"52dda2bb64a6deee","type":"api-call-service","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Living Room Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1670,"y":280,"wires":[[]]},{"id":"15227e746b821b8f","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"living_room","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":760,"y":80,"wires":[["3ec6c81cb45af358"],["684ee904cda12c90"]]},{"id":"684ee904cda12c90","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"living_room","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":960,"y":80,"wires":[["3ec6c81cb45af358"],["fae1320af0d51887"]]},{"id":"3ec6c81cb45af358","type":"delay","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":160,"wires":[["15227e746b821b8f"]]},{"id":"1c4c65f28cfce75c","type":"delay","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":320,"wires":[["60c98d0125ee20a5"]]},{"id":"60c98d0125ee20a5","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Presense - Sam","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"living_room","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sam_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":760,"y":240,"wires":[["1c4c65f28cfce75c"],["76e5a670cbb08c94"]]},{"id":"76e5a670cbb08c94","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"Presense - Leah","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"living_room","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.leah_phone_ble","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":960,"y":240,"wires":[["1c4c65f28cfce75c"],["d20c32fe0bb41d7b"]]},{"id":"1c92d6d336ec8899","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"TV On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.living_room_tv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1460,"y":60,"wires":[[],["c755295b8d9c038e"]]},{"id":"939bf525bdba98c7","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"TV On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.living_room_tv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1460,"y":220,"wires":[[],["e75f566645916eaf"]]},{"id":"d20c32fe0bb41d7b","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"TV On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.living_room_tv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1460,"y":280,"wires":[[],["52dda2bb64a6deee"]]},{"id":"fae1320af0d51887","type":"api-current-state","z":"e0c421ee2f5c3583","g":"d145013fd225514e","name":"TV On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"media_player.living_room_tv","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1460,"y":120,"wires":[[],["8522062f8659f6d9"]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
Automation to activate living room day time scene._which uses:_
- [scene.living_room_day](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/living_room/day.yaml)
Automation to activate living room night time scene._which uses:_
- [scene.living_room_night](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/living_room/night.yaml)
Automation to activate living room movie scene._which uses:_
- [scene.living_room_movie](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/living_room/movie.yaml)
Automation automatically turn on Movie Scene when TV is turned on to certain apps/channels._which uses:_
- [scene.living_room_movie](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/living_room/movie.yaml)
- [Samsung SmartTV Integration](https://github.com/ollo69/ha-samsungtv-smart)
Using Aqara Switch to toggle lighting, overrides motion triggers
Automation to turn off all living room lights.
Office Motion Lighting Automations
Automation which works with motion sensors and mac system status to activate and de-activate lighting. Also depends on time of day.![Node-Red Flow](https://i.imgur.com/Lx5Qe6t.png)
Node-Red Code
[{"id":"6dc0247c.d7210c","type":"subflow","name":"iOS Actionable Notification","info":"[Click here for latest Documentation](https://github.com/sstratoti/actionable-notifications-subflow-for-ios)\n","category":"home_assistant","in":[{"x":100,"y":80,"wires":[{"id":"6b940f2bfba5188c"}]}],"out":[{"x":1500,"y":280,"wires":[{"id":"90ab222038404541","port":0}]},{"x":1500,"y":340,"wires":[{"id":"90ab222038404541","port":1}]},{"x":1500,"y":400,"wires":[{"id":"90ab222038404541","port":2}]},{"x":1500,"y":460,"wires":[{"id":"90ab222038404541","port":3}]}],"env":[{"name":"group","type":"str","value":"None","ui":{"label":{"en-US":"Group Name"}}},{"name":"tag","type":"str","value":"","ui":{"label":{"en-US":"Tag (for replacing messages - optional)"}}},{"name":"service","type":"str","value":"","ui":{"label":{"en-US":"Notify Service"},"type":"input","opts":{"types":["str","env"]}}},{"name":"title","type":"str","value":"","ui":{"label":{"en-US":"Title"},"type":"input","opts":{"types":["str","env"]}}},{"name":"subtitle","type":"str","value":"","ui":{"label":{"en-US":"Subtitle (optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"message","type":"str","value":"","ui":{"label":{"en-US":"Message"},"type":"input","opts":{"types":["str","env"]}}},{"name":"notificationUrl","type":"str","value":"","ui":{"label":{"en-US":"Notification URL (optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"customSoundPreInstalled","type":"str","value":"default","ui":{"label":{"en-US":"Pre-installed Custom Sound"},"type":"select","opts":{"opts":[{"l":{"en-US":"default"},"v":"default"},{"l":{"en-US":"No Sound"},"v":"none"},{"l":{"en-US":"US-EN-Alexa-Back-Door-Opened.wav"},"v":"US-EN-Alexa-Back-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Back-Door-Unlocked.wav"},"v":"US-EN-Alexa-Back-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Basement-Door-Opened.wav"},"v":"US-EN-Alexa-Basement-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Basement-Door-Unlocked.wav"},"v":"US-EN-Alexa-Basement-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Boyfriend-Is-Arriving.wav"},"v":"US-EN-Alexa-Boyfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Daughter-Is-Arriving.wav"},"v":"US-EN-Alexa-Daughter-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Front-Door-Opened.wav"},"v":"US-EN-Alexa-Front-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Front-Door-Unlocked.wav"},"v":"US-EN-Alexa-Front-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Garage-Door-Opened.wav"},"v":"US-EN-Alexa-Garage-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Girlfriend-Is-Arriving.wav"},"v":"US-EN-Alexa-Girlfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Good-Morning.wav"},"v":"US-EN-Alexa-Good-Morning.wav"},{"l":{"en-US":"US-EN-Alexa-Good-Night.wav"},"v":"US-EN-Alexa-Good-Night.wav"},{"l":{"en-US":"US-EN-Alexa-Husband-Is-Arriving.wav"},"v":"US-EN-Alexa-Husband-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Mail-Has-Arrived.wav"},"v":"US-EN-Alexa-Mail-Has-Arrived.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-At-Back-Door.wav"},"v":"US-EN-Alexa-Motion-At-Back-Door.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-At-Front-Door.wav"},"v":"US-EN-Alexa-Motion-At-Front-Door.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-Detected-Generic.wav"},"v":"US-EN-Alexa-Motion-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Back-Yard.wav"},"v":"US-EN-Alexa-Motion-In-Back-Yard.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Basement.wav"},"v":"US-EN-Alexa-Motion-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Front-Yard.wav"},"v":"US-EN-Alexa-Motion-In-Front-Yard.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Garage.wav"},"v":"US-EN-Alexa-Motion-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Patio-Door-Opened.wav"},"v":"US-EN-Alexa-Patio-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Patio-Door-Unlocked.wav"},"v":"US-EN-Alexa-Patio-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-Generic.wav"},"v":"US-EN-Alexa-Smoke-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Basement.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Garage.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Kitchen.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Alexa-Son-Is-Arriving.wav"},"v":"US-EN-Alexa-Son-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-Generic.wav"},"v":"US-EN-Alexa-Water-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Basement.wav"},"v":"US-EN-Alexa-Water-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Garage.wav"},"v":"US-EN-Alexa-Water-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Kitchen.wav"},"v":"US-EN-Alexa-Water-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Alexa-Welcome-Home.wav"},"v":"US-EN-Alexa-Welcome-Home.wav"},{"l":{"en-US":"US-EN-Alexa-Wife-Is-Arriving.wav"},"v":"US-EN-Alexa-Wife-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Daisy-Back-Door-Motion.wav"},"v":"US-EN-Daisy-Back-Door-Motion.wav"},{"l":{"en-US":"US-EN-Daisy-Back-Door-Open.wav"},"v":"US-EN-Daisy-Back-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Door-Motion.wav"},"v":"US-EN-Daisy-Front-Door-Motion.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Door-Open.wav"},"v":"US-EN-Daisy-Front-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Window-Open.wav"},"v":"US-EN-Daisy-Front-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Garage-Door-Open.wav"},"v":"US-EN-Daisy-Garage-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Guest-Bath-Leak.wav"},"v":"US-EN-Daisy-Guest-Bath-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Kitchen-Sink-Leak.wav"},"v":"US-EN-Daisy-Kitchen-Sink-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Kitchen-Window-Open.wav"},"v":"US-EN-Daisy-Kitchen-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Laundry-Room-Leak.wav"},"v":"US-EN-Daisy-Laundry-Room-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Master-Bath-Leak.wav"},"v":"US-EN-Daisy-Master-Bath-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Master-Bedroom-Window-Open.wav"},"v":"US-EN-Daisy-Master-Bedroom-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Office-Window-Open.wav"},"v":"US-EN-Daisy-Office-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Refrigerator-Leak.wav"},"v":"US-EN-Daisy-Refrigerator-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Water-Heater-Leak.wav"},"v":"US-EN-Daisy-Water-Heater-Leak.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Boss-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Boss-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Boyfriend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Boyfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Cleaning-Supplies-Closet-Opened.wav"},"v":"US-EN-Morgan-Freeman-Cleaning-Supplies-Closet-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Coworker-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Coworker-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Daughter-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Daughter-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Friend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Friend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Garage-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Garage-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Garage-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Garage-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Girlfriend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Girlfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Good-Morning.wav"},"v":"US-EN-Morgan-Freeman-Good-Morning.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Good-Night.wav"},"v":"US-EN-Morgan-Freeman-Good-Night.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Liquor-Cabinet-Opened.wav"},"v":"US-EN-Morgan-Freeman-Liquor-Cabinet-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-Detected.wav"},"v":"US-EN-Morgan-Freeman-Motion-Detected.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Bedroom.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Bedroom.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Game-Room.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Game-Room.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Living-Room.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Living-Room.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Theater.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Theater.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Wine-Cellar.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Wine-Cellar.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Searching-For-Car-Keys.wav"},"v":"US-EN-Morgan-Freeman-Searching-For-Car-Keys.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Setting-The-Mood.wav"},"v":"US-EN-Morgan-Freeman-Setting-The-Mood.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-A-Flood.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-A-Flood.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-Carbon-Monoxide.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-Carbon-Monoxide.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-Smoke.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-Smoke.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Someone-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Someone-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Son-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Son-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Movie-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Movie-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Party-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Party-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Romance-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Romance-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-All-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-All-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Air-Conditioner.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Air-Conditioner.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Bar-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Bar-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Chandelier.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Chandelier.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Family-Room-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Family-Room-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Hallway-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Hallway-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Kitchen-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Kitchen-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Mood-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Mood-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-TV.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-TV.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Air-Conditioner.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Air-Conditioner.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Bar-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Bar-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Chandelier.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Chandelier.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Family-Room-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Family-Room-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Hallway-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Hallway-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Kitchen-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Kitchen-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Mood-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Mood-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-TV.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-TV.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Vacate-The-Premises.wav"},"v":"US-EN-Morgan-Freeman-Vacate-The-Premises.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Welcome-Home.wav"},"v":"US-EN-Morgan-Freeman-Welcome-Home.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Wife-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Wife-Is-Arriving.wav"}]}}},{"name":"customSound","type":"str","value":"","ui":{"label":{"en-US":"Custom Sound (Optional - will override pre-installed selection)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"isCriticalNotification","type":"bool","value":"false","ui":{"label":{"en-US":"Critical Notification?"},"type":"input","opts":{"types":["bool"]}}},{"name":"interruptionLevel","type":"str","value":"active","ui":{"label":{"en-US":"Interruption Level"},"type":"select","opts":{"opts":[{"l":{"en-US":"Passive (iOS 15+)"},"v":"passive"},{"l":{"en-US":"Active (Default)"},"v":"active"},{"l":{"en-US":"Time Sensitive (iOS 15+)"},"v":"time-sensitive"},{"l":{"en-US":"Critical"},"v":"critical"}]}}},{"name":"userInfo","type":"bool","value":"false","ui":{"label":{"en-US":"Populate User Information"},"type":"checkbox"}},{"name":"isClearNotificationsOnAction","type":"bool","value":"false","ui":{"label":{"en-US":"Clear notifications on Action Received?"},"type":"checkbox"}},{"name":"action1Title","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action1Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 1 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action1ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 1 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action1AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 1 App Authentication Required?"},"type":"checkbox"}},{"name":"action1Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 1 Destructive?"},"type":"checkbox"}},{"name":"action1Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 1 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action1TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action1TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action1Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2Title","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action2Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 2 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action2ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 2 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action2AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 2 App Authentication Required?"},"type":"checkbox"}},{"name":"action2Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 2 Destructive?"},"type":"checkbox"}},{"name":"action2Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 2 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action2TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3Title","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action3Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 3 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action3ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 3 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action3AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 3 App Authentication Required?"},"type":"checkbox"}},{"name":"action3Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 3 Destructive?"},"type":"checkbox"}},{"name":"action3Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 3 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action3TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4Title","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action4Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 4 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action4ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 4 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action4AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 4 App Authentication Required?"},"type":"checkbox"}},{"name":"action4Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 4 Destructive?"},"type":"checkbox"}},{"name":"action4Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 4 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action4TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"latitudeFirst","type":"num","value":"","ui":{"label":{"en-US":"Latitude for Pin 1"},"type":"input","opts":{"types":["num","env"]}}},{"name":"longitudeFirst","type":"num","value":"","ui":{"label":{"en-US":"Longitude for Pin 1"},"type":"input","opts":{"types":["num","env"]}}},{"name":"latitudeSecond","type":"num","value":"","ui":{"label":{"en-US":"Latitude for Pin 2"},"type":"input","opts":{"types":["num","env"]}}},{"name":"longitudeSecond","type":"num","value":"","ui":{"label":{"en-US":"Longitude for Pin 2"},"type":"input","opts":{"types":["num","env"]}}},{"name":"showLineBetweenPoints","type":"bool","value":"false","ui":{"label":{"en-US":"Show a line between points?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showCompass","type":"bool","value":"false","ui":{"label":{"en-US":"Show a compass on the map?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showPointsOfInterest","type":"bool","value":"false","ui":{"label":{"en-US":"Show points of interest?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showScale","type":"bool","value":"false","ui":{"label":{"en-US":"Show scale information on the map?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showTraffic","type":"bool","value":"false","ui":{"label":{"en-US":"Show Traffic?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showUserLocation","type":"bool","value":"false","ui":{"label":{"en-US":"Show User Location?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"cameraEntity","type":"str","value":"","ui":{"label":{"en-US":"Camera Entity"},"type":"input","opts":{"types":["str","env"]}}},{"name":"imagePath","type":"str","value":"","ui":{"label":{"en-US":"Image Path (10MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"videoPath","type":"str","value":"","ui":{"label":{"en-US":"Video Path (50MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"audioPath","type":"str","value":"","ui":{"label":{"en-US":"Audio Path (5MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"contentUrl","type":"str","value":"","ui":{"label":{"en-US":"Content URL (overrides image/video/audio)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"lazyLoading","type":"bool","value":"false","ui":{"label":{"en-US":"Load Media in Notification Lazily?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"hideThumbnail","type":"bool","value":"false","ui":{"label":{"en-US":"Hide thumbnail?"},"type":"input","opts":{"types":["bool","env"]}}}],"meta":{},"color":"#C7E9C0","outputLabels":["Action 1","Action 2","Action 3","Cleared"],"icon":"font-awesome/fa-mobile-phone","status":{"x":220,"y":320,"wires":[{"id":"f3d74762ed30ae54","port":0}]}},{"id":"3586791854cfef41","type":"function","z":"6dc0247c.d7210c","name":"create service call","func":"msg._originalPayload = msg.payload;\nlet flow_msg_variables = {\n tag: '',\n service: '',\n message: msg,\n date_created: Date.now()\n}\n\nvar xTitle = \"\";\nvar xSubtitle = \"\";\nvar xMessage = \"\";\nvar xServices = \"\";\nvar xTag = \"\";\nvar xUrl = \"\";\nvar xCameraEntity = \"\";\nvar xInterruptionLevel = \"\";\n\n// overrides\nif (typeof msg.notificationOverride !== 'undefined' && msg.notificationOverride !== null) {\n if (typeof msg.notificationOverride.title !== 'undefined' && msg.notificationOverride.title !=='' && msg.notificationOverride.title !== null){\n xTitle = msg.notificationOverride.title;\n } else {\n xTitle = env.get('title');\n }\n if (typeof msg.notificationOverride.subtitle !== 'undefined' && msg.notificationOverride.subtitle !=='' && msg.notificationOverride.subtitle !== null){\n xSubtitle = msg.notificationOverride.subtitle;\n } else {\n xSubtitle = env.get('subtitle');\n }\n if (typeof msg.notificationOverride.message !== 'undefined' && msg.notificationOverride.message !=='' && msg.notificationOverride.message !== null){\n xMessage = msg.notificationOverride.message;\n } else {\n xMessage = env.get('message');\n }\n if (typeof msg.notificationOverride.url !== 'undefined' && msg.notificationOverride.url !=='' && msg.notificationOverride.url !== null){\n xUrl = msg.notificationOverride.url;\n } else {\n xUrl = env.get('notificationUrl');\n }\n if (typeof msg.notificationOverride.services !== 'undefined' && msg.notificationOverride.services !=='' && msg.notificationOverride.services !== null){\n xServices = msg.notificationOverride.services;\n } else {\n xServices = env.get('service');\n }\n if (typeof msg.notificationOverride.cameraEntity !== 'undefined' && msg.notificationOverride.cameraEntity !=='' && msg.notificationOverride.cameraEntity !== null){\n xCameraEntity = msg.notificationOverride.cameraEntity;\n } else {\n xCameraEntity = env.get('cameraEntity');\n }\n \n if (typeof msg.notificationOverride.interruptionLevel !== 'undefined' && msg.notificationOverride.interruptionLevel !=='' && msg.notificationOverride.interruptionLevel !== null){\n xInterruptionLevel = msg.notificationOverride.interruptionLevel;\n } else {\n xInterruptionLevel = env.get('interruptionLevel');\n }\n \n flow_msg_variables.service=xServices;\n if (typeof msg.notificationOverride.tag !== 'undefined' && msg.notificationOverride.tag !=='' && msg.notificationOverride.tag !== null){\n xTag = msg.notificationOverride.tag.replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();\n } else {\n if (env.get('tag') !== '') {\n xTag = `${env.get('tag').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}`;\n } else {\n // need to still set this to something in case clear_notification is sent.\n xTag = `${env.get('title').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}_${flow.get('random')}`;\n } \n }\n//support multiple tags per flow\n flow_msg_variables.tag=xTag;\n} else {\n // If no override is sent in...\n if (env.get('tag') !== '') {\n xTag = `${env.get('tag').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}`;\n } else {\n // need to still set this to something in case clear_notification is sent.\n xTag = `${env.get('title').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}_${flow.get('random')}`;\n } \n //support multiple tags per flow\n // flow.set('tag',xTag);\n flow_msg_variables.tag=xTag;\n \n xServices = env.get('service');\n flow_msg_variables.service=xServices;\n\n xTitle = env.get('title');\n xSubtitle = env.get('subtitle');\n xMessage = env.get('message');\n xUrl = env.get('notificationUrl');\n xCameraEntity = env.get('cameraEntity');\n xInterruptionLevel = env.get('interruptionLevel');\n}\n\nlet all_flow_messages= flow.get('flow_messages');\nif (!all_flow_messages){\n all_flow_messages=[];\n}\nlet new_flow_messages=[];\nfor(var i=0;i {\n const name = `action${i}`\n if (env.get(`${name}Title`) !== ''){\n const action = env.get(`${name}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();\n const title = env.get(`${name}Title`);\n const activationMode = env.get(`${name}ActivationMode`); \n \n const uri = env.get(`${name}Uri`);\n const textInputButtonTitle = env.get(`${name}TextInputButtonTitle`);\n const textInputPlaceholder = env.get(`${name}TextInputPlaceHolder`);\n const authenticationRequired = env.get(`${name}AuthenticationRequired`);\n const destructive = env.get(`${name}Destructive`);\n const behavior = env.get(`${name}Behavior`);\n const icon = env.get(`${name}Icon`);\n \n const actionObject = {};\n actionObject.action = action;\n actionObject.title = title;\n actionObject.activationMode = activationMode;\n \n if (uri != \"\") actionObject.uri = uri;\n if (textInputButtonTitle != \"\") actionObject.textInputButtonTitle = textInputButtonTitle;\n if (textInputPlaceholder != \"\") actionObject.textInputPlaceholder = textInputPlaceholder;\n if (authenticationRequired != \"\") actionObject.authenticationRequired = authenticationRequired;\n if (destructive != \"\") actionObject.destructive = destructive;\n if (behavior != \"\") actionObject.behavior = behavior;\n if (icon != \"\") actionObject.icon = icon;\n \n actions.push(actionObject);\n }\n});\n\n// create msg object\n\nmsg.payload = {\n domain: 'notify',\n data: {\n title: xTitle,\n message: xMessage,\n data: {\n push: {},\n tag: xTag\n }\n }\n };\n\nif (actions.length > 0) {\n msg.payload.data.data.action_data = {tag: xTag};\n msg.payload.data.data.actions = actions;\n \n}\n\n\n// notification url\nif (xUrl !== \"\") {\n msg.payload.data.data.url = {};\n msg.payload.data.data.url = xUrl;\n}\n\n// subtitle\nif (xSubtitle !== '') {\n msg.payload.data.data.subtitle = xSubtitle;\n}\n\n// sound information\nmsg.payload.data.data.push.sound = {};\nif (env.get('customSound').length > 0){\n msg.payload.data.data.push.sound.name = env.get('customSound');\n} else if (env.get('customSoundPreInstalled').length > 0) {\n if(env.get('customSoundPreInstalled')=='none'){\n msg.payload.data.data.push.sound = 'none';\n }else{\n msg.payload.data.data.push.sound.name = env.get('customSoundPreInstalled');\n }\n} else {\n msg.payload.data.data.push.sound.name = 'default';\n}\n\nif (env.get('isCriticalNotification')) {\n msg.payload.data.data.push.sound.critical = 1;\n msg.payload.data.data.push.sound.volume = 1.0;\n msg.payload.data.data.push[\"interruption-level\"] = 'critical';\n} else {\n // interruption level\n if (xInterruptionLevel !== '') {\n msg.payload.data.data.push[\"interruption-level\"] = xInterruptionLevel;\n if (xInterruptionLevel == 'critical'){\n msg.payload.data.data.push.sound.critical = 1;\n msg.payload.data.data.push.sound.volume = 1.0;\n }\n }\n}\n\n \n\n// overrides interruption level\nif (env.get('isCriticalNotification') == true) {\n \n}\n\n// group thread id\nif (env.get('group') !== '') {\n msg.payload.data.data.group = env.get('group');\n}\n\n// Map Information\nif (env.get('latitudeFirst') !== 0 && env.get('longitudeFirst') !== 0){\n msg.payload.data.data.action_data.latitude = env.get('latitudeFirst');\n msg.payload.data.data.action_data.longitude = env.get('longitudeFirst');\n if (env.get('latitudeSecond') !== 0 && env.get('longitudeSecond') !== 0){\n msg.payload.data.data.action_data.second_latitude = env.get('latitudeSecond');\n msg.payload.data.data.action_data.second_longitude = env.get('longitudeSecond');\n // add in all the extras, which default to false.\n msg.payload.data.data.action_data.shows_line_between_points = env.get('showLineBetweenPoints');\n msg.payload.data.data.action_data.shows_compass = env.get('showCompass');\n msg.payload.data.data.action_data.shows_points_of_interest = env.get('showPointsOfInterest');\n msg.payload.data.data.action_data.shows_scale = env.get('showScale');\n msg.payload.data.data.action_data.shows_traffic = env.get('showTraffic');\n msg.payload.data.data.action_data.shows_user_location = env.get('showUserLocation');\n }\n}\n// camera information\nif (xCameraEntity !== '') {\n msg.payload.data.data.entity_id = xCameraEntity;\n}\n// media information\nif (env.get('contentUrl') !== '') {\n\n} else {\n if (env.get('imagePath') !== '') {\n msg.payload.data.data.image = env.get('imagePath');\n }\n if (env.get('videoPath') !== '') {\n msg.payload.data.data.video = env.get('videoPath');\n }\n if (env.get('audioPath') !== '') {\n msg.payload.data.data.audio = env.get('audioPath');\n }\n}\nif (env.get('contentUrl') !== '' || env.get('imagePath') !== '' || env.get('videoPath') !== '' || env.get('audioPath') !== '') {\n if (env.get('lazyLoading')) {\n msg.payload.data.data.lazy = env.get('lazyLoading');\n }\n if (env.get('hideThumbnail')) {\n msg.payload.data.data.attachment = {};\n msg.payload.data.data.attachment['hide-thumbnail'] = env.get('hideThumbnail');\n }\n}\n\nservices.trim().split(/,\\s*/).forEach(service => {\n if(!service) return;\n msg.payload.service = service;\n node.send(msg);\n});\n\nnode.done();","outputs":1,"noerr":0,"initialize":"flow.set('random',Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5).toUpperCase());","finalize":"","libs":[],"x":430,"y":80,"wires":[["84115d3979a0b0b6"]]},{"id":"90ab222038404541","type":"switch","z":"6dc0247c.d7210c","name":"which action?","property":"responseIndex","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":1280,"y":380,"wires":[[],[],[],[]]},{"id":"f3d74762ed30ae54","type":"status","z":"6dc0247c.d7210c","name":"","scope":["3586791854cfef41","b1e2e20511543565","fcf9f9c27469a607","6fdf5748e207aa7e"],"x":100,"y":320,"wires":[[]]},{"id":"b1e2e20511543565","type":"function","z":"6dc0247c.d7210c","name":"build message","func":"const latestMessage = flow.get('latestMessage');\nconst event = msg.payload.event;\n\nlatestMessage.payload = latestMessage._originalPayload;\nlatestMessage.eventData = msg.payload;\ndelete latestMessage._originalPayload;\n\nif(env.get('userInfo')) {\n const userData = msg.userData.find(u => u.id === msg.payload.context.user_id);\n latestMessage.userData = userData;\n}\n\nconst index = [1,2,3,4].find(i => env.get(`action${i}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase() === event.actionName);\nflow.set(\"responseIndex\",index);\nnode.status({\n text: `${env.get(`action${index}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()} at: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'green'\n});\n\nreturn latestMessage;\n\n\nfunction getPrettyDate() {\n return new Date().toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour12: false,\n hour: 'numeric',\n minute: 'numeric',\n });\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":380,"wires":[["90ab222038404541"]]},{"id":"7bc5c379b10a2fbf","type":"ha-api","z":"6dc0247c.d7210c","name":"get user info","server":"f43d015e.4b29","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/auth/list\"}","dataType":"json","responseType":"json","outputProperties":[{"property":"userData","propertyType":"msg","value":"","valueType":"results"}],"x":950,"y":320,"wires":[["b1e2e20511543565"]]},{"id":"c25a82298fbaad78","type":"switch","z":"6dc0247c.d7210c","name":"fetch user info?","property":"userInfo","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":380,"wires":[["7bc5c379b10a2fbf"],["b1e2e20511543565"]]},{"id":"b738bc2e474ec4a5","type":"server-events","z":"6dc0247c.d7210c","name":"ios.notification_action_fired","server":"f43d015e.4b29","version":1,"event_type":"ios.notification_action_fired","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":164,"y":256,"wires":[["86b12904f73a0329"]]},{"id":"fcf9f9c27469a607","type":"api-call-service","z":"6dc0247c.d7210c","name":"Send Notifications","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"notify","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"callServiceData","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":80,"wires":[[]]},{"id":"6fdf5748e207aa7e","type":"function","z":"6dc0247c.d7210c","name":"create CLEAR service call","func":"msg._originalPayload = msg.payload;\nvar tag_to_clear = \"\";\nvar services = \"\";\nvar clearAll = false;\nif (typeof msg.notificationOverride !== 'undefined') {\n if (typeof msg.notificationOverride.clear !== 'undefined' && msg.notificationOverride.clear !== null && msg.notificationOverride.clear) {\n clearAll = true;\n }\n if (typeof msg.notificationOverride.services !== 'undefined' && msg.notificationOverride.services !== null && msg.notificationOverride.services){\n services = msg.notificationOverride.services;\n }\n if (typeof msg.notificationOverride.tag !== 'undefined' && msg.notificationOverride.tag !== null && msg.notificationOverride.tag){\n tag_to_clear = msg.notificationOverride.tag.replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();//formatting tags as sent to the phone before\n }\n}\n\nif (tag_to_clear==\"\"){//no specific tag sent, clear the last message.\n var all_flow_messages= flow.get('flow_messages');\n if(all_flow_messages) {\n var last_message= all_flow_messages.pop();\n if (last_message){//on nodeRED restart\n tag_to_clear= last_message.tag;\n services = last_message.service;//override service to the one used in last message sent\n flow.set('flow_messages',all_flow_messages);//clear the message from memory\n }\n }\n}\n\nif(services==\"\") {\n node.status({\n text: 'no services defined',\n shape: 'ring',\n fill: 'red'\n });\n return; \n}\n\nif(tag_to_clear==\"\") {\n node.status({\n text: 'no messages to delete',\n shape: 'ring',\n fill: 'red'\n });\n return; \n}\n\n// create ios msg object\n\nmsg.payload = {\n domain: 'notify',\n data: {\n message: \"clear_notification\",\n data: {\n tag: tag_to_clear\n }\n }\n };\n\nfunction getPrettyDate() {\n return new Date().toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour12: false,\n hour: 'numeric',\n minute: 'numeric',\n });\n}\n\nif (clearAll){\n delete msg.notificationOverride;\n}\n \nvar xCountCleared = 0;\nservices.trim().split(/,\\s*/).forEach(service => {\n if(!service) return;\n // only clear on devices that didn't send the event.\n if (clearAll){\n msg.payload.service = service;\n node.send(msg);\n xCountCleared++;\n } else if (!service.includes(msg._originalPayload.event.sourceDeviceID)){\n msg.payload.service = service;\n node.send(msg);\n xCountCleared++;\n }\n});\nif (xCountCleared > 0) {\n node.status({\n text: `${xCountCleared} messages cleared at: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'blue'\n });\n} else {\n node.status({\n text: `No messages cleared: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'red'\n });\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":220,"wires":[["05b8370d35105d3c"]]},{"id":"a69ed312811b3a6d","type":"switch","z":"6dc0247c.d7210c","name":"Clear Notification on Action?","property":"isClearNotificationsOnAction","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":320,"wires":[["6fdf5748e207aa7e","227a6ab8de989095"],["c25a82298fbaad78"]]},{"id":"e229e2d8efb85d22","type":"api-call-service","z":"6dc0247c.d7210c","name":"Clear Notifications","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"notify","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"callServiceData","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":140,"wires":[[]]},{"id":"227a6ab8de989095","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":720,"y":320,"wires":[["c25a82298fbaad78"]]},{"id":"6b940f2bfba5188c","type":"switch","z":"6dc0247c.d7210c","name":"clear?","property":"notificationOverride.clear","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"null"},{"t":"false"},{"t":"true"}],"checkall":"false","repair":false,"outputs":4,"x":210,"y":80,"wires":[["3586791854cfef41"],["3586791854cfef41"],["3586791854cfef41"],["6fdf5748e207aa7e"]]},{"id":"05b8370d35105d3c","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":970,"y":160,"wires":[["e229e2d8efb85d22"]]},{"id":"84115d3979a0b0b6","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":630,"y":80,"wires":[["fcf9f9c27469a607"]]},{"id":"86b12904f73a0329","type":"function","z":"6dc0247c.d7210c","name":"belongs here?","func":"let msg_tag=msg.payload.event.action_data.tag;\nlet all_flow_messages= flow.get('flow_messages');\nif(all_flow_messages){\n for (var i=0;i_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [@dortamur's Node-Red Motion Lighting Flow Template](https://github.com/dortamur/ha-node-red-flows)
Automation to activate bright office scene._which uses:_
- [scene.office_bright](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/office/bright.yaml)
Automation to activate dull office scene._which uses:_
- [scene.office_dull](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/office/dull.yaml)
Automation to activate gaming scene when xbox turned on.![Node-Red Flow](https://i.imgur.com/mEJb7J4.png)
Node-Red Code
[{"id":"cfa2b5528df1706e","type":"group","z":"0c8b275e7a34a25c","name":"Office Lighting - Xbox Control","style":{"label":true},"nodes":["865b763260b2e656","1a5eb1854aee1bc9","53a4c9a8dd06e4cd","1875a0907cefbee9","d917ba0864630d2f","2261c3a7f4611001","d0855e19f896afe2","ac5131fbd36abbf7"],"x":14,"y":239,"w":852,"h":142},{"id":"865b763260b2e656","type":"server-state-changed","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Xbox On?","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.xbox_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":280,"wires":[["1a5eb1854aee1bc9"],[]]},{"id":"1a5eb1854aee1bc9","type":"api-call-service","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Capture Scene","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"scene","service":"create","areaId":[],"deviceId":[],"entityId":[],"data":"{\"scene_id\":\"pregame\",\"snapshot_entities\":\"light.office_leds\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":280,"y":280,"wires":[["53a4c9a8dd06e4cd"]]},{"id":"53a4c9a8dd06e4cd","type":"api-call-service","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Game Scene","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["scene.office_gaming"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":470,"y":280,"wires":[[]]},{"id":"1875a0907cefbee9","type":"server-state-changed","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Xbox Off?","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.xbox_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":340,"wires":[["d917ba0864630d2f"],[]]},{"id":"d917ba0864630d2f","type":"api-call-service","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Return Scene","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["scene.pregame"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":280,"y":340,"wires":[["d0855e19f896afe2"]]},{"id":"2261c3a7f4611001","type":"api-current-state","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Mac On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.sam_s_mac_mini_active","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":620,"y":340,"wires":[["1fed51c35e7f4b43"],["ac5131fbd36abbf7"]]},{"id":"d0855e19f896afe2","type":"delay","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":340,"wires":[["2261c3a7f4611001"]]},{"id":"ac5131fbd36abbf7","type":"api-call-service","z":"0c8b275e7a34a25c","g":"cfa2b5528df1706e","name":"Office Off","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.office_leds"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":780,"y":340,"wires":[[]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]
_which uses:_- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
- [scene.office_gaming](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/office/gaming.yaml)
Lamp
Automation to activate bright office scene with desk lamp._which uses:_
- [scene.office_lamp](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/office/lamp.yaml)
NFC Tag used to easily turn on the desk lamp._which uses:_
- [scene.office_lamp](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scenes/office/lamp.yaml)
- [HA NFC Tag Integration](https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/)Meeting
Automation to activate meeting scene so wife knows on meeting when camera or audio input activated on mac.![Node-Red Flow](https://i.imgur.com/Blz2hH5.png)
Node-Red Code
[{"id":"76df181a3cc2f2fc","type":"group","z":"0c8b275e7a34a25c","name":"Office Lighting - Meeting Control","style":{"label":true},"nodes":["19066ee6e6da335a","824364bea194606b","9f7094f7af59e95f","6207327b28e05dcd","53edba07177a1d3f","894c2646c144064a","4586b621b7692fef","5e9d3a41a63a5db4","73c665fd127a2b29","de24f97454d497fb","4d664383a521c324","31f941d4bba4734f","b1668861914488f6"],"x":14,"y":399,"w":1232,"h":377},{"id":"6dc0247c.d7210c","type":"subflow","name":"iOS Actionable Notification","info":"[Click here for latest Documentation](https://github.com/sstratoti/actionable-notifications-subflow-for-ios)\n","category":"home_assistant","in":[{"x":100,"y":80,"wires":[{"id":"6b940f2bfba5188c"}]}],"out":[{"x":1500,"y":280,"wires":[{"id":"90ab222038404541","port":0}]},{"x":1500,"y":340,"wires":[{"id":"90ab222038404541","port":1}]},{"x":1500,"y":400,"wires":[{"id":"90ab222038404541","port":2}]},{"x":1500,"y":460,"wires":[{"id":"90ab222038404541","port":3}]}],"env":[{"name":"group","type":"str","value":"None","ui":{"label":{"en-US":"Group Name"}}},{"name":"tag","type":"str","value":"","ui":{"label":{"en-US":"Tag (for replacing messages - optional)"}}},{"name":"service","type":"str","value":"","ui":{"label":{"en-US":"Notify Service"},"type":"input","opts":{"types":["str","env"]}}},{"name":"title","type":"str","value":"","ui":{"label":{"en-US":"Title"},"type":"input","opts":{"types":["str","env"]}}},{"name":"subtitle","type":"str","value":"","ui":{"label":{"en-US":"Subtitle (optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"message","type":"str","value":"","ui":{"label":{"en-US":"Message"},"type":"input","opts":{"types":["str","env"]}}},{"name":"notificationUrl","type":"str","value":"","ui":{"label":{"en-US":"Notification URL (optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"customSoundPreInstalled","type":"str","value":"default","ui":{"label":{"en-US":"Pre-installed Custom Sound"},"type":"select","opts":{"opts":[{"l":{"en-US":"default"},"v":"default"},{"l":{"en-US":"No Sound"},"v":"none"},{"l":{"en-US":"US-EN-Alexa-Back-Door-Opened.wav"},"v":"US-EN-Alexa-Back-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Back-Door-Unlocked.wav"},"v":"US-EN-Alexa-Back-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Basement-Door-Opened.wav"},"v":"US-EN-Alexa-Basement-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Basement-Door-Unlocked.wav"},"v":"US-EN-Alexa-Basement-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Boyfriend-Is-Arriving.wav"},"v":"US-EN-Alexa-Boyfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Daughter-Is-Arriving.wav"},"v":"US-EN-Alexa-Daughter-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Front-Door-Opened.wav"},"v":"US-EN-Alexa-Front-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Front-Door-Unlocked.wav"},"v":"US-EN-Alexa-Front-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Garage-Door-Opened.wav"},"v":"US-EN-Alexa-Garage-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Girlfriend-Is-Arriving.wav"},"v":"US-EN-Alexa-Girlfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Good-Morning.wav"},"v":"US-EN-Alexa-Good-Morning.wav"},{"l":{"en-US":"US-EN-Alexa-Good-Night.wav"},"v":"US-EN-Alexa-Good-Night.wav"},{"l":{"en-US":"US-EN-Alexa-Husband-Is-Arriving.wav"},"v":"US-EN-Alexa-Husband-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Mail-Has-Arrived.wav"},"v":"US-EN-Alexa-Mail-Has-Arrived.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-At-Back-Door.wav"},"v":"US-EN-Alexa-Motion-At-Back-Door.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-At-Front-Door.wav"},"v":"US-EN-Alexa-Motion-At-Front-Door.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-Detected-Generic.wav"},"v":"US-EN-Alexa-Motion-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Back-Yard.wav"},"v":"US-EN-Alexa-Motion-In-Back-Yard.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Basement.wav"},"v":"US-EN-Alexa-Motion-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Front-Yard.wav"},"v":"US-EN-Alexa-Motion-In-Front-Yard.wav"},{"l":{"en-US":"US-EN-Alexa-Motion-In-Garage.wav"},"v":"US-EN-Alexa-Motion-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Patio-Door-Opened.wav"},"v":"US-EN-Alexa-Patio-Door-Opened.wav"},{"l":{"en-US":"US-EN-Alexa-Patio-Door-Unlocked.wav"},"v":"US-EN-Alexa-Patio-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-Generic.wav"},"v":"US-EN-Alexa-Smoke-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Basement.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Garage.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Smoke-Detected-In-Kitchen.wav"},"v":"US-EN-Alexa-Smoke-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Alexa-Son-Is-Arriving.wav"},"v":"US-EN-Alexa-Son-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-Generic.wav"},"v":"US-EN-Alexa-Water-Detected-Generic.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Basement.wav"},"v":"US-EN-Alexa-Water-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Garage.wav"},"v":"US-EN-Alexa-Water-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Alexa-Water-Detected-In-Kitchen.wav"},"v":"US-EN-Alexa-Water-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Alexa-Welcome-Home.wav"},"v":"US-EN-Alexa-Welcome-Home.wav"},{"l":{"en-US":"US-EN-Alexa-Wife-Is-Arriving.wav"},"v":"US-EN-Alexa-Wife-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Daisy-Back-Door-Motion.wav"},"v":"US-EN-Daisy-Back-Door-Motion.wav"},{"l":{"en-US":"US-EN-Daisy-Back-Door-Open.wav"},"v":"US-EN-Daisy-Back-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Door-Motion.wav"},"v":"US-EN-Daisy-Front-Door-Motion.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Door-Open.wav"},"v":"US-EN-Daisy-Front-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Front-Window-Open.wav"},"v":"US-EN-Daisy-Front-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Garage-Door-Open.wav"},"v":"US-EN-Daisy-Garage-Door-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Guest-Bath-Leak.wav"},"v":"US-EN-Daisy-Guest-Bath-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Kitchen-Sink-Leak.wav"},"v":"US-EN-Daisy-Kitchen-Sink-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Kitchen-Window-Open.wav"},"v":"US-EN-Daisy-Kitchen-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Laundry-Room-Leak.wav"},"v":"US-EN-Daisy-Laundry-Room-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Master-Bath-Leak.wav"},"v":"US-EN-Daisy-Master-Bath-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Master-Bedroom-Window-Open.wav"},"v":"US-EN-Daisy-Master-Bedroom-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Office-Window-Open.wav"},"v":"US-EN-Daisy-Office-Window-Open.wav"},{"l":{"en-US":"US-EN-Daisy-Refrigerator-Leak.wav"},"v":"US-EN-Daisy-Refrigerator-Leak.wav"},{"l":{"en-US":"US-EN-Daisy-Water-Heater-Leak.wav"},"v":"US-EN-Daisy-Water-Heater-Leak.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Back-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Back-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Basement-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Basement-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Boss-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Boss-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Boyfriend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Boyfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Cleaning-Supplies-Closet-Opened.wav"},"v":"US-EN-Morgan-Freeman-Cleaning-Supplies-Closet-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Coworker-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Coworker-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Daughter-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Daughter-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Friend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Friend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Front-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Front-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Garage-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Garage-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Garage-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Garage-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Girlfriend-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Girlfriend-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Good-Morning.wav"},"v":"US-EN-Morgan-Freeman-Good-Morning.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Good-Night.wav"},"v":"US-EN-Morgan-Freeman-Good-Night.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Liquor-Cabinet-Opened.wav"},"v":"US-EN-Morgan-Freeman-Liquor-Cabinet-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-Detected.wav"},"v":"US-EN-Morgan-Freeman-Motion-Detected.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Bedroom.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Bedroom.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Game-Room.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Game-Room.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Living-Room.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Living-Room.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Theater.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Theater.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Motion-In-Wine-Cellar.wav"},"v":"US-EN-Morgan-Freeman-Motion-In-Wine-Cellar.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Closed.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Closed.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Locked.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Locked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Opened.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Opened.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Patio-Door-Unlocked.wav"},"v":"US-EN-Morgan-Freeman-Patio-Door-Unlocked.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Searching-For-Car-Keys.wav"},"v":"US-EN-Morgan-Freeman-Searching-For-Car-Keys.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Setting-The-Mood.wav"},"v":"US-EN-Morgan-Freeman-Setting-The-Mood.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-A-Flood.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-A-Flood.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-Carbon-Monoxide.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-Carbon-Monoxide.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smartthings-Detected-Smoke.wav"},"v":"US-EN-Morgan-Freeman-Smartthings-Detected-Smoke.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Smoke-Detected-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Smoke-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Someone-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Someone-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Son-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Son-Is-Arriving.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Movie-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Movie-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Party-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Party-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Starting-Romance-Mode.wav"},"v":"US-EN-Morgan-Freeman-Starting-Romance-Mode.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-All-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-All-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Air-Conditioner.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Air-Conditioner.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Bar-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Bar-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Chandelier.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Chandelier.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Family-Room-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Family-Room-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Hallway-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Hallway-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Kitchen-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Kitchen-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-Mood-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-Mood-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-Off-The-TV.wav"},"v":"US-EN-Morgan-Freeman-Turning-Off-The-TV.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Air-Conditioner.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Air-Conditioner.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Bar-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Bar-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Chandelier.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Chandelier.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Family-Room-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Family-Room-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Hallway-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Hallway-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Kitchen-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Kitchen-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Light.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Light.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-Mood-Lights.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-Mood-Lights.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Turning-On-The-TV.wav"},"v":"US-EN-Morgan-Freeman-Turning-On-The-TV.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Vacate-The-Premises.wav"},"v":"US-EN-Morgan-Freeman-Vacate-The-Premises.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Basement.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Basement.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Garage.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Garage.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Water-Detected-In-Kitchen.wav"},"v":"US-EN-Morgan-Freeman-Water-Detected-In-Kitchen.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Welcome-Home.wav"},"v":"US-EN-Morgan-Freeman-Welcome-Home.wav"},{"l":{"en-US":"US-EN-Morgan-Freeman-Wife-Is-Arriving.wav"},"v":"US-EN-Morgan-Freeman-Wife-Is-Arriving.wav"}]}}},{"name":"customSound","type":"str","value":"","ui":{"label":{"en-US":"Custom Sound (Optional - will override pre-installed selection)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"isCriticalNotification","type":"bool","value":"false","ui":{"label":{"en-US":"Critical Notification?"},"type":"input","opts":{"types":["bool"]}}},{"name":"interruptionLevel","type":"str","value":"active","ui":{"label":{"en-US":"Interruption Level"},"type":"select","opts":{"opts":[{"l":{"en-US":"Passive (iOS 15+)"},"v":"passive"},{"l":{"en-US":"Active (Default)"},"v":"active"},{"l":{"en-US":"Time Sensitive (iOS 15+)"},"v":"time-sensitive"},{"l":{"en-US":"Critical"},"v":"critical"}]}}},{"name":"userInfo","type":"bool","value":"false","ui":{"label":{"en-US":"Populate User Information"},"type":"checkbox"}},{"name":"isClearNotificationsOnAction","type":"bool","value":"false","ui":{"label":{"en-US":"Clear notifications on Action Received?"},"type":"checkbox"}},{"name":"action1Title","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action1Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 1 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action1ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 1 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action1AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 1 App Authentication Required?"},"type":"checkbox"}},{"name":"action1Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 1 Destructive?"},"type":"checkbox"}},{"name":"action1Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 1 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action1TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action1TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action1Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 1 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2Title","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action2Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 2 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action2ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 2 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action2AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 2 App Authentication Required?"},"type":"checkbox"}},{"name":"action2Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 2 Destructive?"},"type":"checkbox"}},{"name":"action2Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 2 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action2TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action2Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 2 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3Title","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action3Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 3 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action3ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 3 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action3AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 3 App Authentication Required?"},"type":"checkbox"}},{"name":"action3Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 3 Destructive?"},"type":"checkbox"}},{"name":"action3Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 3 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action3TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action3Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 3 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4Title","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Title"},"type":"input","opts":{"types":["str"]}}},{"name":"action4Uri","type":"str","value":"","ui":{"label":{"en-US":"Action 4 URL (optional)"},"type":"input","opts":{"types":["str"]}}},{"name":"action4ActivationMode","type":"str","value":"background","ui":{"label":{"en-US":"Action 4 Activation Mode"},"type":"select","opts":{"opts":[{"l":{"en-US":"Background"},"v":"background"},{"l":{"en-US":"Foreground"},"v":"foreground"}]}}},{"name":"action4AuthenticationRequired","type":"bool","value":"false","ui":{"label":{"en-US":"Action 4 App Authentication Required?"},"type":"checkbox"}},{"name":"action4Destructive","type":"bool","value":"false","ui":{"label":{"en-US":"Action 4 Destructive?"},"type":"checkbox"}},{"name":"action4Behavior","type":"str","value":"default","ui":{"label":{"en-US":"Action 4 Behavior"},"type":"select","opts":{"opts":[{"l":{"en-US":"Default"},"v":"default"},{"l":{"en-US":"Text Input"},"v":"textInput"}]}}},{"name":"action4TextInputButtonTitle","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Text Input Button Title (Required if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4TextInputPlaceHolder","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Text Input Placeholder (Optional - only if behavior is Text Input)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"action4Icon","type":"str","value":"","ui":{"label":{"en-US":"Action 4 Icon (Optional)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"latitudeFirst","type":"num","value":"","ui":{"label":{"en-US":"Latitude for Pin 1"},"type":"input","opts":{"types":["num","env"]}}},{"name":"longitudeFirst","type":"num","value":"","ui":{"label":{"en-US":"Longitude for Pin 1"},"type":"input","opts":{"types":["num","env"]}}},{"name":"latitudeSecond","type":"num","value":"","ui":{"label":{"en-US":"Latitude for Pin 2"},"type":"input","opts":{"types":["num","env"]}}},{"name":"longitudeSecond","type":"num","value":"","ui":{"label":{"en-US":"Longitude for Pin 2"},"type":"input","opts":{"types":["num","env"]}}},{"name":"showLineBetweenPoints","type":"bool","value":"false","ui":{"label":{"en-US":"Show a line between points?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showCompass","type":"bool","value":"false","ui":{"label":{"en-US":"Show a compass on the map?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showPointsOfInterest","type":"bool","value":"false","ui":{"label":{"en-US":"Show points of interest?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showScale","type":"bool","value":"false","ui":{"label":{"en-US":"Show scale information on the map?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showTraffic","type":"bool","value":"false","ui":{"label":{"en-US":"Show Traffic?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"showUserLocation","type":"bool","value":"false","ui":{"label":{"en-US":"Show User Location?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"cameraEntity","type":"str","value":"","ui":{"label":{"en-US":"Camera Entity"},"type":"input","opts":{"types":["str","env"]}}},{"name":"imagePath","type":"str","value":"","ui":{"label":{"en-US":"Image Path (10MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"videoPath","type":"str","value":"","ui":{"label":{"en-US":"Video Path (50MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"audioPath","type":"str","value":"","ui":{"label":{"en-US":"Audio Path (5MB limit)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"contentUrl","type":"str","value":"","ui":{"label":{"en-US":"Content URL (overrides image/video/audio)"},"type":"input","opts":{"types":["str","env"]}}},{"name":"lazyLoading","type":"bool","value":"false","ui":{"label":{"en-US":"Load Media in Notification Lazily?"},"type":"input","opts":{"types":["bool","env"]}}},{"name":"hideThumbnail","type":"bool","value":"false","ui":{"label":{"en-US":"Hide thumbnail?"},"type":"input","opts":{"types":["bool","env"]}}}],"meta":{},"color":"#C7E9C0","outputLabels":["Action 1","Action 2","Action 3","Cleared"],"icon":"font-awesome/fa-mobile-phone","status":{"x":220,"y":320,"wires":[{"id":"f3d74762ed30ae54","port":0}]}},{"id":"3586791854cfef41","type":"function","z":"6dc0247c.d7210c","name":"create service call","func":"msg._originalPayload = msg.payload;\nlet flow_msg_variables = {\n tag: '',\n service: '',\n message: msg,\n date_created: Date.now()\n}\n\nvar xTitle = \"\";\nvar xSubtitle = \"\";\nvar xMessage = \"\";\nvar xServices = \"\";\nvar xTag = \"\";\nvar xUrl = \"\";\nvar xCameraEntity = \"\";\nvar xInterruptionLevel = \"\";\n\n// overrides\nif (typeof msg.notificationOverride !== 'undefined' && msg.notificationOverride !== null) {\n if (typeof msg.notificationOverride.title !== 'undefined' && msg.notificationOverride.title !=='' && msg.notificationOverride.title !== null){\n xTitle = msg.notificationOverride.title;\n } else {\n xTitle = env.get('title');\n }\n if (typeof msg.notificationOverride.subtitle !== 'undefined' && msg.notificationOverride.subtitle !=='' && msg.notificationOverride.subtitle !== null){\n xSubtitle = msg.notificationOverride.subtitle;\n } else {\n xSubtitle = env.get('subtitle');\n }\n if (typeof msg.notificationOverride.message !== 'undefined' && msg.notificationOverride.message !=='' && msg.notificationOverride.message !== null){\n xMessage = msg.notificationOverride.message;\n } else {\n xMessage = env.get('message');\n }\n if (typeof msg.notificationOverride.url !== 'undefined' && msg.notificationOverride.url !=='' && msg.notificationOverride.url !== null){\n xUrl = msg.notificationOverride.url;\n } else {\n xUrl = env.get('notificationUrl');\n }\n if (typeof msg.notificationOverride.services !== 'undefined' && msg.notificationOverride.services !=='' && msg.notificationOverride.services !== null){\n xServices = msg.notificationOverride.services;\n } else {\n xServices = env.get('service');\n }\n if (typeof msg.notificationOverride.cameraEntity !== 'undefined' && msg.notificationOverride.cameraEntity !=='' && msg.notificationOverride.cameraEntity !== null){\n xCameraEntity = msg.notificationOverride.cameraEntity;\n } else {\n xCameraEntity = env.get('cameraEntity');\n }\n \n if (typeof msg.notificationOverride.interruptionLevel !== 'undefined' && msg.notificationOverride.interruptionLevel !=='' && msg.notificationOverride.interruptionLevel !== null){\n xInterruptionLevel = msg.notificationOverride.interruptionLevel;\n } else {\n xInterruptionLevel = env.get('interruptionLevel');\n }\n \n flow_msg_variables.service=xServices;\n if (typeof msg.notificationOverride.tag !== 'undefined' && msg.notificationOverride.tag !=='' && msg.notificationOverride.tag !== null){\n xTag = msg.notificationOverride.tag.replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();\n } else {\n if (env.get('tag') !== '') {\n xTag = `${env.get('tag').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}`;\n } else {\n // need to still set this to something in case clear_notification is sent.\n xTag = `${env.get('title').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}_${flow.get('random')}`;\n } \n }\n//support multiple tags per flow\n flow_msg_variables.tag=xTag;\n} else {\n // If no override is sent in...\n if (env.get('tag') !== '') {\n xTag = `${env.get('tag').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}`;\n } else {\n // need to still set this to something in case clear_notification is sent.\n xTag = `${env.get('title').replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()}_${flow.get('random')}`;\n } \n //support multiple tags per flow\n // flow.set('tag',xTag);\n flow_msg_variables.tag=xTag;\n \n xServices = env.get('service');\n flow_msg_variables.service=xServices;\n\n xTitle = env.get('title');\n xSubtitle = env.get('subtitle');\n xMessage = env.get('message');\n xUrl = env.get('notificationUrl');\n xCameraEntity = env.get('cameraEntity');\n xInterruptionLevel = env.get('interruptionLevel');\n}\n\nlet all_flow_messages= flow.get('flow_messages');\nif (!all_flow_messages){\n all_flow_messages=[];\n}\nlet new_flow_messages=[];\nfor(var i=0;i {\n const name = `action${i}`\n if (env.get(`${name}Title`) !== ''){\n const action = env.get(`${name}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();\n const title = env.get(`${name}Title`);\n const activationMode = env.get(`${name}ActivationMode`); \n \n const uri = env.get(`${name}Uri`);\n const textInputButtonTitle = env.get(`${name}TextInputButtonTitle`);\n const textInputPlaceholder = env.get(`${name}TextInputPlaceHolder`);\n const authenticationRequired = env.get(`${name}AuthenticationRequired`);\n const destructive = env.get(`${name}Destructive`);\n const behavior = env.get(`${name}Behavior`);\n const icon = env.get(`${name}Icon`);\n \n const actionObject = {};\n actionObject.action = action;\n actionObject.title = title;\n actionObject.activationMode = activationMode;\n \n if (uri != \"\") actionObject.uri = uri;\n if (textInputButtonTitle != \"\") actionObject.textInputButtonTitle = textInputButtonTitle;\n if (textInputPlaceholder != \"\") actionObject.textInputPlaceholder = textInputPlaceholder;\n if (authenticationRequired != \"\") actionObject.authenticationRequired = authenticationRequired;\n if (destructive != \"\") actionObject.destructive = destructive;\n if (behavior != \"\") actionObject.behavior = behavior;\n if (icon != \"\") actionObject.icon = icon;\n \n actions.push(actionObject);\n }\n});\n\n// create msg object\n\nmsg.payload = {\n domain: 'notify',\n data: {\n title: xTitle,\n message: xMessage,\n data: {\n push: {},\n tag: xTag\n }\n }\n };\n\nif (actions.length > 0) {\n msg.payload.data.data.action_data = {tag: xTag};\n msg.payload.data.data.actions = actions;\n \n}\n\n\n// notification url\nif (xUrl !== \"\") {\n msg.payload.data.data.url = {};\n msg.payload.data.data.url = xUrl;\n}\n\n// subtitle\nif (xSubtitle !== '') {\n msg.payload.data.data.subtitle = xSubtitle;\n}\n\n// sound information\nmsg.payload.data.data.push.sound = {};\nif (env.get('customSound').length > 0){\n msg.payload.data.data.push.sound.name = env.get('customSound');\n} else if (env.get('customSoundPreInstalled').length > 0) {\n if(env.get('customSoundPreInstalled')=='none'){\n msg.payload.data.data.push.sound = 'none';\n }else{\n msg.payload.data.data.push.sound.name = env.get('customSoundPreInstalled');\n }\n} else {\n msg.payload.data.data.push.sound.name = 'default';\n}\n\nif (env.get('isCriticalNotification')) {\n msg.payload.data.data.push.sound.critical = 1;\n msg.payload.data.data.push.sound.volume = 1.0;\n msg.payload.data.data.push[\"interruption-level\"] = 'critical';\n} else {\n // interruption level\n if (xInterruptionLevel !== '') {\n msg.payload.data.data.push[\"interruption-level\"] = xInterruptionLevel;\n if (xInterruptionLevel == 'critical'){\n msg.payload.data.data.push.sound.critical = 1;\n msg.payload.data.data.push.sound.volume = 1.0;\n }\n }\n}\n\n \n\n// overrides interruption level\nif (env.get('isCriticalNotification') == true) {\n \n}\n\n// group thread id\nif (env.get('group') !== '') {\n msg.payload.data.data.group = env.get('group');\n}\n\n// Map Information\nif (env.get('latitudeFirst') !== 0 && env.get('longitudeFirst') !== 0){\n msg.payload.data.data.action_data.latitude = env.get('latitudeFirst');\n msg.payload.data.data.action_data.longitude = env.get('longitudeFirst');\n if (env.get('latitudeSecond') !== 0 && env.get('longitudeSecond') !== 0){\n msg.payload.data.data.action_data.second_latitude = env.get('latitudeSecond');\n msg.payload.data.data.action_data.second_longitude = env.get('longitudeSecond');\n // add in all the extras, which default to false.\n msg.payload.data.data.action_data.shows_line_between_points = env.get('showLineBetweenPoints');\n msg.payload.data.data.action_data.shows_compass = env.get('showCompass');\n msg.payload.data.data.action_data.shows_points_of_interest = env.get('showPointsOfInterest');\n msg.payload.data.data.action_data.shows_scale = env.get('showScale');\n msg.payload.data.data.action_data.shows_traffic = env.get('showTraffic');\n msg.payload.data.data.action_data.shows_user_location = env.get('showUserLocation');\n }\n}\n// camera information\nif (xCameraEntity !== '') {\n msg.payload.data.data.entity_id = xCameraEntity;\n}\n// media information\nif (env.get('contentUrl') !== '') {\n\n} else {\n if (env.get('imagePath') !== '') {\n msg.payload.data.data.image = env.get('imagePath');\n }\n if (env.get('videoPath') !== '') {\n msg.payload.data.data.video = env.get('videoPath');\n }\n if (env.get('audioPath') !== '') {\n msg.payload.data.data.audio = env.get('audioPath');\n }\n}\nif (env.get('contentUrl') !== '' || env.get('imagePath') !== '' || env.get('videoPath') !== '' || env.get('audioPath') !== '') {\n if (env.get('lazyLoading')) {\n msg.payload.data.data.lazy = env.get('lazyLoading');\n }\n if (env.get('hideThumbnail')) {\n msg.payload.data.data.attachment = {};\n msg.payload.data.data.attachment['hide-thumbnail'] = env.get('hideThumbnail');\n }\n}\n\nservices.trim().split(/,\\s*/).forEach(service => {\n if(!service) return;\n msg.payload.service = service;\n node.send(msg);\n});\n\nnode.done();","outputs":1,"noerr":0,"initialize":"flow.set('random',Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5).toUpperCase());","finalize":"","libs":[],"x":430,"y":80,"wires":[["84115d3979a0b0b6"]]},{"id":"90ab222038404541","type":"switch","z":"6dc0247c.d7210c","name":"which action?","property":"responseIndex","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":1280,"y":380,"wires":[[],[],[],[]]},{"id":"f3d74762ed30ae54","type":"status","z":"6dc0247c.d7210c","name":"","scope":["3586791854cfef41","b1e2e20511543565","fcf9f9c27469a607","6fdf5748e207aa7e"],"x":100,"y":320,"wires":[[]]},{"id":"b1e2e20511543565","type":"function","z":"6dc0247c.d7210c","name":"build message","func":"const latestMessage = flow.get('latestMessage');\nconst event = msg.payload.event;\n\nlatestMessage.payload = latestMessage._originalPayload;\nlatestMessage.eventData = msg.payload;\ndelete latestMessage._originalPayload;\n\nif(env.get('userInfo')) {\n const userData = msg.userData.find(u => u.id === msg.payload.context.user_id);\n latestMessage.userData = userData;\n}\n\nconst index = [1,2,3,4].find(i => env.get(`action${i}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase() === event.actionName);\nflow.set(\"responseIndex\",index);\nnode.status({\n text: `${env.get(`action${index}Title`).replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase()} at: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'green'\n});\n\nreturn latestMessage;\n\n\nfunction getPrettyDate() {\n return new Date().toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour12: false,\n hour: 'numeric',\n minute: 'numeric',\n });\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":380,"wires":[["90ab222038404541"]]},{"id":"7bc5c379b10a2fbf","type":"ha-api","z":"6dc0247c.d7210c","name":"get user info","server":"f43d015e.4b29","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\"type\": \"config/auth/list\"}","dataType":"json","responseType":"json","outputProperties":[{"property":"userData","propertyType":"msg","value":"","valueType":"results"}],"x":950,"y":320,"wires":[["b1e2e20511543565"]]},{"id":"c25a82298fbaad78","type":"switch","z":"6dc0247c.d7210c","name":"fetch user info?","property":"userInfo","propertyType":"env","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":800,"y":380,"wires":[["7bc5c379b10a2fbf"],["b1e2e20511543565"]]},{"id":"b738bc2e474ec4a5","type":"server-events","z":"6dc0247c.d7210c","name":"ios.notification_action_fired","server":"f43d015e.4b29","version":1,"event_type":"ios.notification_action_fired","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":164,"y":256,"wires":[["86b12904f73a0329"]]},{"id":"fcf9f9c27469a607","type":"api-call-service","z":"6dc0247c.d7210c","name":"Send Notifications","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"notify","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"callServiceData","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":80,"wires":[[]]},{"id":"6fdf5748e207aa7e","type":"function","z":"6dc0247c.d7210c","name":"create CLEAR service call","func":"msg._originalPayload = msg.payload;\nvar tag_to_clear = \"\";\nvar services = \"\";\nvar clearAll = false;\nif (typeof msg.notificationOverride !== 'undefined') {\n if (typeof msg.notificationOverride.clear !== 'undefined' && msg.notificationOverride.clear !== null && msg.notificationOverride.clear) {\n clearAll = true;\n }\n if (typeof msg.notificationOverride.services !== 'undefined' && msg.notificationOverride.services !== null && msg.notificationOverride.services){\n services = msg.notificationOverride.services;\n }\n if (typeof msg.notificationOverride.tag !== 'undefined' && msg.notificationOverride.tag !== null && msg.notificationOverride.tag){\n tag_to_clear = msg.notificationOverride.tag.replace(/[^\\w\\s]/gi, '').replace(/\\s+/g,'_').toUpperCase();//formatting tags as sent to the phone before\n }\n}\n\nif (tag_to_clear==\"\"){//no specific tag sent, clear the last message.\n var all_flow_messages= flow.get('flow_messages');\n if(all_flow_messages) {\n var last_message= all_flow_messages.pop();\n if (last_message){//on nodeRED restart\n tag_to_clear= last_message.tag;\n services = last_message.service;//override service to the one used in last message sent\n flow.set('flow_messages',all_flow_messages);//clear the message from memory\n }\n }\n}\n\nif(services==\"\") {\n node.status({\n text: 'no services defined',\n shape: 'ring',\n fill: 'red'\n });\n return; \n}\n\nif(tag_to_clear==\"\") {\n node.status({\n text: 'no messages to delete',\n shape: 'ring',\n fill: 'red'\n });\n return; \n}\n\n// create ios msg object\n\nmsg.payload = {\n domain: 'notify',\n data: {\n message: \"clear_notification\",\n data: {\n tag: tag_to_clear\n }\n }\n };\n\nfunction getPrettyDate() {\n return new Date().toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n hour12: false,\n hour: 'numeric',\n minute: 'numeric',\n });\n}\n\nif (clearAll){\n delete msg.notificationOverride;\n}\n \nvar xCountCleared = 0;\nservices.trim().split(/,\\s*/).forEach(service => {\n if(!service) return;\n // only clear on devices that didn't send the event.\n if (clearAll){\n msg.payload.service = service;\n node.send(msg);\n xCountCleared++;\n } else if (!service.includes(msg._originalPayload.event.sourceDeviceID)){\n msg.payload.service = service;\n node.send(msg);\n xCountCleared++;\n }\n});\nif (xCountCleared > 0) {\n node.status({\n text: `${xCountCleared} messages cleared at: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'blue'\n });\n} else {\n node.status({\n text: `No messages cleared: ${getPrettyDate()}`,\n shape: 'dot',\n fill: 'red'\n });\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":750,"y":220,"wires":[["05b8370d35105d3c"]]},{"id":"a69ed312811b3a6d","type":"switch","z":"6dc0247c.d7210c","name":"Clear Notification on Action?","property":"isClearNotificationsOnAction","propertyType":"env","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":320,"wires":[["6fdf5748e207aa7e","227a6ab8de989095"],["c25a82298fbaad78"]]},{"id":"e229e2d8efb85d22","type":"api-call-service","z":"6dc0247c.d7210c","name":"Clear Notifications","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"notify","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"json","mergeContext":"callServiceData","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":140,"wires":[[]]},{"id":"227a6ab8de989095","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":720,"y":320,"wires":[["c25a82298fbaad78"]]},{"id":"6b940f2bfba5188c","type":"switch","z":"6dc0247c.d7210c","name":"clear?","property":"notificationOverride.clear","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"null"},{"t":"false"},{"t":"true"}],"checkall":"false","repair":false,"outputs":4,"x":210,"y":80,"wires":[["3586791854cfef41"],["3586791854cfef41"],["3586791854cfef41"],["6fdf5748e207aa7e"]]},{"id":"05b8370d35105d3c","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":970,"y":160,"wires":[["e229e2d8efb85d22"]]},{"id":"84115d3979a0b0b6","type":"delay","z":"6dc0247c.d7210c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":630,"y":80,"wires":[["fcf9f9c27469a607"]]},{"id":"86b12904f73a0329","type":"function","z":"6dc0247c.d7210c","name":"belongs here?","func":"let msg_tag=msg.payload.event.action_data.tag;\nlet all_flow_messages= flow.get('flow_messages');\nif(all_flow_messages){\n for (var i=0;i_which uses:_
- [Node-RED Add-On](https://github.com/hassio-addons/addon-node-red)
Automation to turn off all office lights.
Automation to activate party mode which alternates lighting using a script._which uses:_
- [input_boolean.party](https://github.com/smcnab1/home-assistant-config/blob/master/entities/input_boolean/party.yaml)
- [script.party_on](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scripts/party_on.yaml)
- [script.party_lighting](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scripts/party_lighting.yaml)
Automation to de-activate party mode._which uses:_
- [input_boolean.party](https://github.com/smcnab1/home-assistant-config/blob/master/entities/input_boolean/party.yaml)
- [script.party_off](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scripts/party_off.yaml)
- [script.party_lighting](https://github.com/smcnab1/home-assistant-config/blob/master/entities/scripts/party_lighting.yaml)
Automation to turn all lights off using NFC Tags next to our bed._which uses:_
- [HA NFC Tag Integration](https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/)
Transport 🚌🚝 Automations (7 automations)Car Wash Notify
Using the car wash input boolean to predict upcoming weather to see if it is worth washing my car or not. Then providing options as to either book car wash at home or show me navigation to nearest car wash._which uses:_
- [binary_sensor.car_wash](https://github.com/smcnab1/home-assistant-config/blob/master/entities/binary_sensor/car_wash.yaml)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Car Wash Binary Sensor Integration (HACS)](https://github.com/Limych/ha-car_wash)Citymapper Notify Wife (Random)
Automation triggered by dashboard pushing actionable notification to wifes phone to input end location from current location on the Citymapper Mobile App._which uses:_
- [Citymapper URL API](https://citymapper.com/tools/1053/launch-citymapper-for-directions)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)Citymapper Notify Wife (Work)
Automation triggered by dashboard pushing actionable notification to wifes phone to work which auto populates directions from current location on the Citymapper Mobile App._which uses:_
- [Citymapper URL API](https://citymapper.com/tools/1053/launch-citymapper-for-directions)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)Citymapper Notify Sam (Random)
Automation triggered by dashboard pushing actionable notification to my phone to input end location from current location on the Citymapper Mobile App._which uses:_
- [Citymapper URL API](https://citymapper.com/tools/1053/launch-citymapper-for-directions)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)Waze to Work x2
2x automations triggered by dashboard pushing actionable notification to my phone that automatically navigates to two work locations with the Waze Mobile App._which uses:_
- [Waze URL API](https://developers.google.com/waze/deeplinks)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)
Apple Watch 🍎⌚ Automations (1 automations with 13 actions)Apple Watch Automations
13 actions that can be triggered by my apple watch. From alarm control to controlling lighting and manually triggering sleep sensors.![Node-Red Flow](https://i.imgur.com/7RNvbEd.png)
Node-Red Code
[{"id":"53b211e7eae914b5","type":"tab","label":"Apple Watch Control","disabled":false,"info":"","env":[]},{"id":"2b2e5ead437c8a76","type":"server-events","z":"53b211e7eae914b5","name":"Action Fired","server":"f43d015e.4b29","version":1,"event_type":"ios.action_fired","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":110,"y":580,"wires":[["0387dc6d32bac12a","958687d0f9255526"]]},{"id":"0387dc6d32bac12a","type":"switch","z":"53b211e7eae914b5","name":"Action Name","property":"payload.event.actionName","propertyType":"msg","rules":[{"t":"eq","v":"All Lights Off","vt":"str"},{"t":"eq","v":"Living Room Movie Time","vt":"str"},{"t":"eq","v":"Bedroom Movie Time","vt":"str"},{"t":"eq","v":"Arm Alarm","vt":"str"},{"t":"eq","v":"Disarm Alarm","vt":"str"},{"t":"eq","v":"Bedroom","vt":"str"},{"t":"eq","v":"Living Room","vt":"str"},{"t":"eq","v":"Kitchen","vt":"str"},{"t":"eq","v":"Bathroom","vt":"str"},{"t":"eq","v":"Office","vt":"str"},{"t":"eq","v":"Sleeping","vt":"str"},{"t":"eq","v":"Temperature Report","vt":"str"},{"t":"eq","v":"Where is Leah","vt":"str"}],"checkall":"true","repair":false,"outputs":13,"x":330,"y":580,"wires":[["910038d1a1674c82"],["b9d4549809d8a831"],["811d96c515866843"],["9090542e432153a8"],["63df95d45f329f21"],["aac1909642084293"],["a278087da393da7f"],["69fac16822ab17cc"],["731b8cddbf99a33f"],["9218650105e353db"],["e6774d51f721f18a"],["0282ee546bfbe2a6"],["8d548b5b1b08a368"]]},{"id":"910038d1a1674c82","type":"api-call-service","z":"53b211e7eae914b5","name":"All Lights Off","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_off","automation.lighting_bedroom_off","automation.lighting_hall_off","automation.lighting_kitchen_off","automation.lighting_living_room_off","automation.lighting_office_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1110,"y":40,"wires":[[]]},{"id":"b9d4549809d8a831","type":"api-call-service","z":"53b211e7eae914b5","name":"Living Room Movie","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_movie"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":80,"wires":[[]]},{"id":"811d96c515866843","type":"api-call-service","z":"53b211e7eae914b5","name":"Bedroom Movie","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_movie_time"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1120,"y":120,"wires":[[]]},{"id":"9090542e432153a8","type":"api-call-service","z":"53b211e7eae914b5","name":"Arm Alarm","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"alarm_control_panel","service":"alarm_arm_away","areaId":[],"deviceId":[],"entityId":["alarm_control_panel.home_alarm"],"data":"{\"code\":\"1550\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1110,"y":160,"wires":[[]]},{"id":"63df95d45f329f21","type":"api-call-service","z":"53b211e7eae914b5","name":"Disarm Alarm","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"alarm_control_panel","service":"alarm_disarm","areaId":[],"deviceId":[],"entityId":["alarm_control_panel.home_alarm"],"data":"{\"code\":\"1550\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1120,"y":200,"wires":[[]]},{"id":"958687d0f9255526","type":"debug","z":"53b211e7eae914b5","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":320,"y":440,"wires":[]},{"id":"86ef3c433cfd4068","type":"time-range-switch","z":"53b211e7eae914b5","name":"Day?","lat":"","lon":"","startTime":"08:00","endTime":"18:00","startOffset":0,"endOffset":0,"x":1230,"y":240,"wires":[["e829a0611a4be2fb"],["491cd090b134f51f"]]},{"id":"e829a0611a4be2fb","type":"api-call-service","z":"53b211e7eae914b5","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_day"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":220,"wires":[[]]},{"id":"d6271874df4f87ad","type":"api-call-service","z":"53b211e7eae914b5","name":"Bedroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1280,"y":300,"wires":[[]]},{"id":"491cd090b134f51f","type":"api-call-service","z":"53b211e7eae914b5","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bedroom_night"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":260,"wires":[[]]},{"id":"aac1909642084293","type":"api-current-state","z":"53b211e7eae914b5","name":"On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.all_bedroom_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1090,"y":260,"wires":[["86ef3c433cfd4068"],["d6271874df4f87ad"]]},{"id":"59a6f9407a24afc7","type":"time-range-switch","z":"53b211e7eae914b5","name":"Day?","lat":"","lon":"","startTime":"08:00","endTime":"18:00","startOffset":0,"endOffset":0,"x":1230,"y":360,"wires":[["060aa6883398b95f"],["7a84bf111397c3be"]]},{"id":"e902ae5f31b77f1e","type":"api-call-service","z":"53b211e7eae914b5","name":"Living Room Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1290,"y":420,"wires":[[]]},{"id":"7a84bf111397c3be","type":"api-call-service","z":"53b211e7eae914b5","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_night"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":380,"wires":[[]]},{"id":"a278087da393da7f","type":"api-current-state","z":"53b211e7eae914b5","name":"On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.all_living_room_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1090,"y":380,"wires":[["59a6f9407a24afc7"],["e902ae5f31b77f1e"]]},{"id":"060aa6883398b95f","type":"api-call-service","z":"53b211e7eae914b5","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_living_room_day"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":340,"wires":[[]]},{"id":"0d3b95ae93daed9a","type":"time-range-switch","z":"53b211e7eae914b5","name":"Day?","lat":"","lon":"","startTime":"12:30","endTime":"20:30","startOffset":0,"endOffset":0,"x":1230,"y":480,"wires":[["f47ab3c1fd2d5476"],["6554d0f4e256c742"]]},{"id":"ac6702189d91ab94","type":"api-call-service","z":"53b211e7eae914b5","name":"Kitchen Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1270,"y":540,"wires":[[]]},{"id":"6554d0f4e256c742","type":"api-call-service","z":"53b211e7eae914b5","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_normal"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":500,"wires":[[]]},{"id":"69fac16822ab17cc","type":"api-current-state","z":"53b211e7eae914b5","name":"On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.all_kitchen_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1090,"y":500,"wires":[["0d3b95ae93daed9a"],["ac6702189d91ab94"]]},{"id":"f47ab3c1fd2d5476","type":"api-call-service","z":"53b211e7eae914b5","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_kitchen_cooking"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":460,"wires":[[]]},{"id":"91a6d0992bf778ce","type":"time-range-switch","z":"53b211e7eae914b5","name":"Day?","lat":"","lon":"","startTime":"10:00","endTime":"00:00","startOffset":0,"endOffset":0,"x":1230,"y":600,"wires":[["508fcf53eafa9047"],["ae9b5216d1d396ad"]]},{"id":"cbb007d6b1724be0","type":"api-call-service","z":"53b211e7eae914b5","name":"Bathroom Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1280,"y":660,"wires":[[]]},{"id":"ae9b5216d1d396ad","type":"api-call-service","z":"53b211e7eae914b5","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_morning"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":620,"wires":[[]]},{"id":"731b8cddbf99a33f","type":"api-current-state","z":"53b211e7eae914b5","name":"On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.all_bathroom_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1090,"y":620,"wires":[["91a6d0992bf778ce"],["cbb007d6b1724be0"]]},{"id":"508fcf53eafa9047","type":"api-call-service","z":"53b211e7eae914b5","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_bathroom_normal"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":580,"wires":[[]]},{"id":"ba652209a9801332","type":"time-range-switch","z":"53b211e7eae914b5","name":"Day?","lat":"","lon":"","startTime":"08:00","endTime":"18:00","startOffset":0,"endOffset":0,"x":1230,"y":720,"wires":[["d66003b80142ec85"],["d91895f5d84e158e"]]},{"id":"72b6c7cc58e1533a","type":"api-call-service","z":"53b211e7eae914b5","name":"Office Lights OFF","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_office_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1270,"y":780,"wires":[[]]},{"id":"d91895f5d84e158e","type":"api-call-service","z":"53b211e7eae914b5","name":"Night Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_office_bright"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":740,"wires":[[]]},{"id":"9218650105e353db","type":"api-current-state","z":"53b211e7eae914b5","name":"On?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.all_office_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1090,"y":740,"wires":[["ba652209a9801332"],["72b6c7cc58e1533a"]]},{"id":"d66003b80142ec85","type":"api-call-service","z":"53b211e7eae914b5","name":"Day Scene ON","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.lighting_office_dull"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":700,"wires":[[]]},{"id":"e6774d51f721f18a","type":"api-current-state","z":"53b211e7eae914b5","name":"On Already?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sam_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1110,"y":860,"wires":[["841d533e5c5c625e"],["be04040f72242a13"]]},{"id":"be04040f72242a13","type":"api-call-service","z":"53b211e7eae914b5","name":"Toggle","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.sam_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":900,"wires":[[]]},{"id":"841d533e5c5c625e","type":"api-current-state","z":"53b211e7eae914b5","name":"In Bed?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.bed_sensor_sam","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1280,"y":840,"wires":[[],["be6dbdd733f40783"]]},{"id":"be6dbdd733f40783","type":"api-call-service","z":"53b211e7eae914b5","name":"Toggle","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.sam_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1430,"y":860,"wires":[[]]},{"id":"0282ee546bfbe2a6","type":"api-call-service","z":"53b211e7eae914b5","name":"Temperature Report","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.notify_temp_report"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1140,"y":940,"wires":[[]]},{"id":"8d548b5b1b08a368","type":"api-call-service","z":"53b211e7eae914b5","name":"Where is Leah","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"automation","service":"trigger","areaId":[],"deviceId":[],"entityId":["automation.notify_where_is_leah"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1120,"y":980,"wires":[[]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_actions include:_
- [All Lights Off]()
- [Living Room Movie Time](https://github.com/smcnab1/home-assistant-config/blob/Master/automations/lighting/living_room/movie_time.yaml)
- [Bedroom Movie Time](https://github.com/smcnab1/home-assistant-config/blob/Master/automations/lighting/bedroom/movie_time.yaml)
- [Arm Alarm]()
- [Disarm Alarm]()
- [Bedroom Lights Toggle]()
- [Living Room Lights Toggle]()
- [Kitchen Lights Toggle]()
- [Bathroom Lights Toggle]()
- [Office Lights Toggle]()
- [Sleep Sensor Toggle]()
- [Temperature Report](https://github.com/smcnab1/home-assistant-config/blob/Master/automations/notify/temp_report.yaml)
- [Where is the Wife?](https://github.com/smcnab1/home-assistant-config/blob/Master/automations/notify/where_is_leah.yaml)_which uses:_
- [Home Assistant Dashboard](https://companion.home-assistant.io/docs/apple-watch/)
HA-System ⏰🖥️ Automations (9 automations)Server Cabinet Fan Control
Controls server cabinet temperature using temperature sensor and USB fans in Sonoff USB plugsGit Auto Update
Script that automatically updates github at 23:23:23 everyday to keep repo up-to-date._which uses:_
- [ha_gitpush.sh](***)
Restart Complete Notify
Automation which sends notification to my mac and google hubs through TTS to alert us that system restart has been complete and now back up. Gives the wife a heads up that things are now working and gives me actionable notification to open HA from notification on PC._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)Pre-Shutdown Notify
Automation which sends notification to my mac, wifes phone and google hubs through TTS to alert us that system is restarting. Gives the wife a heads up that things won't work for a few minutes._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)System Updates Notify
Provides notifications for all system notifications including HACS and Add-Ons. Sensors are also pushed to the HA Dashboard._which uses:_
- [HA Supervisor Update Sensors](https://www.home-assistant.io/integrations/hassio)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)
- [Update Notifications Blueprint](https://github.com/smcnab1/home-assistant-config/blob/master/blueprints/automation/mdegat01/update_notifications.yaml)Tablet Charging
Automation to trigger dashboard tablet's charging schedule. When battery level gets below 40%, charging begins. When above 90%, charging stops._which uses:_
- [Fully Kiosk Browswer Integration](https://github.com/cgarwood/homeassistant-fullykiosk)
- [Wall Panel Battery Blueprint](https://github.com/smcnab1/home-assistant-config/blob/master/blueprints/automation/seamus65/wallpanel-battery-management.yaml)Back-Up Stale Notification
Alerts me when updates become stale which require an update. Also gives me ability to remind me later through actionable notifications._which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [HA Google Drive Backup Add-On](https://github.com/sabeechen/hassio-google-drive-backup)Tablet Screen Time
Turns the screen of dashboard tablet off at 23:00hrs unless motion is detected so light doesn't shine under bedroom door._which uses:_
- [Fully Kiosk Browswer Integration](https://github.com/cgarwood/homeassistant-fullykiosk)
Battery Alert
Alerts me when any of the sensors batteries reach 15% for me to then replace_which uses:_
- [Battery Alert Blueprint](https://github.com/smcnab1/home-assistant-config/blob/Master/blueprints/automation/sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml)
Media 🔊📺 Automations (5 automations)TV Control Notify
Automation which sends actionable notification to open Smartthings Remote App to control TV when switched on._which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Samsung SmartTV Integration](https://github.com/ollo69/ha-samsungtv-smart)Night Reminder
Automation which triggers at 21:30 to remind me to get off my PC if I am still on it. Using flashing red lights, TTS & Actionable Notification through my PC._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)XBOX Hurry Up Notify
Automation which sends notification to wifes phone when I turn on my XBOX and she is home. Uses actionable notifications to trigger a hurry up automation._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [HA XBOX Integration](https://www.home-assistant.io/integrations/xbox/)XBOX Hurry Up Actions
Automation which is triggered by the wife through actionable notification. Flashes lights in office red and plays TTS through google home telling me to hurry up. Also sends me a notification on PC on other monitor._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [HA XBOX Integration](https://www.home-assistant.io/integrations/xbox/)
Auto Volume Set
Automation requested by the wife to automatically set the volume of all google home's so that we can listen to music when sleeping at a pre-set volume.
Notify 🔔📱 Automations (6 automations)House Temperature
Automation to let us know if the temperature in the house gets too hot or too cold including funny GIF & song lyrics_which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Mail Notify - Delivered
Automation that notifies me if any parcels have been delivered using the Mail & Packages Integration. Also has variable actionable notifications dependent on what packages have been delivered taking me to the app/email._which uses:_
- [Mail and Packages Integration](https://github.com/moralmunky/Home-Assistant-Mail-And-Packages)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)Mail Notify - Delivering
Automation that notifies me if any parcels are on the way using the Mail & Packages Integration. Also has variable actionable notifications dependent on what packages are on the way taking me to the app/email._which uses:_
- [Mail and Packages Integration](https://github.com/moralmunky/Home-Assistant-Mail-And-Packages)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)Printer Ink Low Status Notify
Automation to send me notification when ink in printer gets low. Provides link to buy the black or colour cartridge depending on what is low. Offers reminder and silence of notifications._which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Temperature Report
Automation which sends overview of temperature across house._which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Where is the Wife?
Automation which sends me notification with mine and the wifes location and distance away from eachother and time,_which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
TTS 🔊📱 Automations (4 automations)Wife Morning Briefing
Automation which sends TTS morning briefing for wife when she gets up for work. Provides update on weather and travel time. Then plays relaxing music from Spotify._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [Spotify Integration](https://www.home-assistant.io/integrations/spotify/)TTS Input Bedroom
Automation that sends input from HA Dashboard to Google Hub Mini's as TTS Message._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)TTS Input Living Room
Automation that sends input from HA Dashboard to Google Hub Mini's as TTS Message._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [Home Assistant Dashboard](https://github.com/smcnab1/home-assistant-config/tree/master/ui_lovelace_minimalist/dashboard/adaptive-dash/views-tablet)TTS Welcome Home Message
Automation which triggers TTS Briefing when arriving back at home. Pulls person who arrives home into the automation for personalised message._which uses:_
- [Nabu-Casa TTS Cloud](https://www.nabucasa.com/config/tts/)
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
Sleeping 🛏️📡 Automations (1 automations)Sleeping Toggle Management
Automation which works with presense sensors, pressure sensors and location to identify when we are sleeping to use in automations etc.![Node-Red Flow](https://i.imgur.com/rNESDko.png)
Node-Red Code
[{"id":"cdd59c9d83846168","type":"tab","label":"Sleep Control","disabled":false,"info":"","env":[]},{"id":"bb871814b14a48a6","type":"group","z":"cdd59c9d83846168","name":"Sleeping Control - Sam","style":{"fill":"#bfdbef","fill-opacity":"0.28","label":true},"nodes":["594b179734804509","546da122fe24161c","a3969041aa39c0ca","c0fd77c0c1859d2e","c7565947a8c99983","57b3a38993a128f6","12b3e45832c33dff","7f3323fbefe2af35","fec9bfebc2d4dea0","1553bb97e53386f6","84a348c5946921f1"],"x":14,"y":19,"w":1092,"h":222},{"id":"4a64e55f2df94331","type":"group","z":"cdd59c9d83846168","name":"Sleeping Control Leah","style":{"fill":"#dbcbe7","fill-opacity":"0.28","label":true},"nodes":["8a8acaa98d476bff","934f749c9cf008ef","a8146ffcf68f5f5e","1c69dc0794fe946a","64b275109c271202","773bff586e509a36","e7369a982cb5979d","3f144473847b1b0c","2308fd3b079d1d61"],"x":14,"y":259,"w":972,"h":222},{"id":"594b179734804509","type":"server-state-changed","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Sam in Bed","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bed_sensor_sam","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":140,"wires":[["1553bb97e53386f6"],["84a348c5946921f1"]]},{"id":"8a8acaa98d476bff","type":"server-state-changed","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Leah in Bed","server":"f43d015e.4b29","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bed_sensor_leah","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":380,"wires":[["934f749c9cf008ef"],["a8146ffcf68f5f5e"]]},{"id":"546da122fe24161c","type":"api-call-service","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Sam is in Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.sam_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":420,"y":80,"wires":[["57b3a38993a128f6"]]},{"id":"934f749c9cf008ef","type":"api-call-service","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Leah is in bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.leah_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":300,"y":320,"wires":[["1c69dc0794fe946a"]]},{"id":"a8146ffcf68f5f5e","type":"api-call-service","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Leah out of Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.leah_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":300,"y":440,"wires":[["64b275109c271202"]]},{"id":"a3969041aa39c0ca","type":"api-call-service","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Sam out of Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.sam_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":420,"y":200,"wires":[["12b3e45832c33dff"]]},{"id":"c0fd77c0c1859d2e","type":"api-call-service","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Both in Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.all_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":80,"wires":[["0ba07493f5d534cd"]]},{"id":"c7565947a8c99983","type":"api-call-service","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Both out of Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.all_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1000,"y":200,"wires":[["0ba07493f5d534cd"]]},{"id":"57b3a38993a128f6","type":"api-current-state","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Leah Home?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.leah","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":610,"y":80,"wires":[["7f3323fbefe2af35"],["c0fd77c0c1859d2e"]]},{"id":"12b3e45832c33dff","type":"api-current-state","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Leah Home?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.leah","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":610,"y":200,"wires":[["fec9bfebc2d4dea0"],["c7565947a8c99983"]]},{"id":"1c69dc0794fe946a","type":"api-current-state","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Sam Home?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.sam","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":490,"y":320,"wires":[["773bff586e509a36"],["2308fd3b079d1d61"]]},{"id":"64b275109c271202","type":"api-current-state","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Sam Home?","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.sam","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":490,"y":440,"wires":[["e7369a982cb5979d"],["3f144473847b1b0c"]]},{"id":"7f3323fbefe2af35","type":"ha-wait-until","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Leah in Bed","server":"f43d015e.4b29","version":1,"outputs":1,"entityId":"input_boolean.leah_sleeping","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":790,"y":60,"wires":[["c0fd77c0c1859d2e"]]},{"id":"fec9bfebc2d4dea0","type":"ha-wait-until","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Leah out Bed","server":"f43d015e.4b29","version":1,"outputs":1,"entityId":"input_boolean.leah_sleeping","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":800,"y":180,"wires":[["c7565947a8c99983"]]},{"id":"773bff586e509a36","type":"ha-wait-until","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Sam in Bed","server":"f43d015e.4b29","version":1,"outputs":1,"entityId":"input_boolean.sam_sleeping","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":670,"y":300,"wires":[["2308fd3b079d1d61"]]},{"id":"e7369a982cb5979d","type":"ha-wait-until","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Sam out Bed","server":"f43d015e.4b29","version":1,"outputs":1,"entityId":"input_boolean.sam_sleeping","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":670,"y":420,"wires":[["3f144473847b1b0c"]]},{"id":"3f144473847b1b0c","type":"api-call-service","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Both out of Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.all_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":440,"wires":[["64abe341c0f48c21"]]},{"id":"2308fd3b079d1d61","type":"api-call-service","z":"cdd59c9d83846168","g":"4a64e55f2df94331","name":"Both in Bed","server":"f43d015e.4b29","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.all_sleeping"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":870,"y":320,"wires":[["64abe341c0f48c21"]]},{"id":"0ba07493f5d534cd","type":"debug","z":"cdd59c9d83846168","name":"Sleep Control Sam Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":140,"wires":[]},{"id":"64abe341c0f48c21","type":"debug","z":"cdd59c9d83846168","name":"Sleep Control Leah Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1220,"y":380,"wires":[]},{"id":"1553bb97e53386f6","type":"api-current-state","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Watch","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sam_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":80,"wires":[[],["546da122fe24161c"]]},{"id":"84a348c5946921f1","type":"api-current-state","z":"cdd59c9d83846168","g":"bb871814b14a48a6","name":"Watch","server":"f43d015e.4b29","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sam_sleeping","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":200,"wires":[["a3969041aa39c0ca"],[]]},{"id":"f43d015e.4b29","type":"server","name":"Home Assistant","version":4,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]_which uses:_
- [ESPresense Integration](https://espresense.com/home_assistant)
- [ESPHome Add-On](https://github.com/esphome/esphome)
Local Issue Tracker Automations 🎟️System that lets the wife complain about the HA system. Provides notifications when new issues are created and notifies wife when something she reported has been fixed. Utilises MQTT entities to produce binary sensors for issues open or complete.
![Lovelace Dashboard Card](https://i.imgur.com/HGvJPic.png)
_which uses:_
- [HA Actionable Notifications](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
- [Home Issue Tracker](https://community.home-assistant.io/t/home-issue-tracker/371742)## Back Matter
### Roadmap
- [ ] Finalise Documentation.
See the [open issues](https://github.com/smcnab1/home-assistant-config/issues) for a full list of proposed features (and known issues).
### Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement" or "feature-request".
Don't forget to give the project a star! Thanks again!1. Fork the Project.
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request### License
This project is licensed under the [MIT License](LICENSE.md).
[contributors-shield]: https://img.shields.io/github/contributors/smcnab1/home-assistant-config.svg?style=for-the-badge
[contributors-url]: https://github.com/smcnab1/home-assistant-config/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/smcnab1/home-assistant-config.svg?style=for-the-badge
[forks-url]: https://github.com/smcnab1/home-assistant-config/network/members
[stars-shield]: https://img.shields.io/github/stars/smcnab1/home-assistant-config.svg?style=for-the-badge
[stars-url]: https://github.com/smcnab1/home-assistant-config/stargazers
[issues-shield]: https://img.shields.io/github/issues/smcnab1/home-assistant-config.svg?style=for-the-badge
[issues-url]: https://github.com/smcnab1/home-assistant-config/issues
[license-shield]: https://img.shields.io/github/license/smcnab1/home-assistant-config.svg?style=for-the-badge
[license-url]: https://github.com/smcnab1/home-assistant-config/blob/master/LICENSE.md
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/sammcnab/
[product-screenshot]: images/screenshot.png
[email-badge]: https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white
[email-url]: mailto:[email protected]
[git-badge]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white
[git-url]: https://github.com/smcnab1
[kofi-badge]: https://ko-fi.com/img/githubbutton_sm.svg
[kofi-url]: https://ko-fi.com/sammcnab1