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: 11 months ago
JSON representation

Your shortcut to seamless Home Assistant setups. Elevate your smart living experience effortlessly. 🏡✨

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]





Logo

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



Logo



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**😎.

(back to top)

## 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😳

(back to top)

 

## 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-addons

(back to top)

HACS 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 @firstof9

(back to top)

HACS 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

(back to top)

 

## 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 🛀 Lighting

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/)

Bath Time


Automation to activate bath time scene.

Morning


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)

Normal


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)

Switch Control


Using Aqara Switch to toggle lighting, overrides motion triggers

Off


Automation to turn off all bathroom lights.

Bedroom 🛏️ Lighting

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)

Day


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)

Night


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)

Movie Scene


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)

Movie Time


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/)

Switch Control


Using Aqara Switch to toggle lighting, overrides motion triggers

Off


Automation to turn off all bedroom lights.

Hall 🚪 Lighting

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