summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2023-01-21 01:27:13 +0400
committerSuren A. Chilingaryan <csa@suren.me>2023-01-21 01:27:13 +0400
commit614c8a5f4e3bf26d3af0a91685e00eecb171339b (patch)
tree94a94b63fb3e10a1ec4bf132bd5e3dde4dafae3b
parent2c0c331eb7b7a03152309bbbd4e0fee157e8d86c (diff)
downloadhass-614c8a5f4e3bf26d3af0a91685e00eecb171339b.tar.gz
hass-614c8a5f4e3bf26d3af0a91685e00eecb171339b.tar.bz2
hass-614c8a5f4e3bf26d3af0a91685e00eecb171339b.tar.xz
hass-614c8a5f4e3bf26d3af0a91685e00eecb171339b.zip
Media controls, occupancy tracking, and fixes
-rw-r--r--.storage/input_boolean8
-rw-r--r--.storage/lovelace.lovelace_research3
-rw-r--r--.storage/lovelace.lovelace_status60
-rw-r--r--.storage/lovelace.lovelace_test463
-rw-r--r--automations.yaml187
-rw-r--r--blueprints/automation/lights/knob-sound-multi-bulb-control.yaml338
-rw-r--r--blueprints/automation/lights/light_button.yaml50
-rw-r--r--blueprints/automation/media/sven_scene_switch.yaml149
-rw-r--r--blueprints/automation/motion/halabyan24.yaml234
-rw-r--r--blueprints/automation/motion/motion_switch.yaml2
-rw-r--r--blueprints/automation/motion/occupancy_tracking.yaml166
-rw-r--r--configuration.yaml12
-rw-r--r--custom/input_number.yaml5
-rw-r--r--custom/scripts/play-playlist.yaml144
-rw-r--r--custom/scripts/sleep-and-wake.yaml25
-rw-r--r--scripts.yaml15
16 files changed, 1622 insertions, 239 deletions
diff --git a/.storage/input_boolean b/.storage/input_boolean
index ea55fac..f03e5e7 100644
--- a/.storage/input_boolean
+++ b/.storage/input_boolean
@@ -40,6 +40,14 @@
{
"name": "Mode Bright",
"id": "mode_bright"
+ },
+ {
+ "name": "Occupancy Toilet",
+ "id": "occupancy_toilet"
+ },
+ {
+ "name": "Occupancy Bathroom",
+ "id": "occupancy_bathroom"
}
]
}
diff --git a/.storage/lovelace.lovelace_research b/.storage/lovelace.lovelace_research
index dffc4a1..1e53158 100644
--- a/.storage/lovelace.lovelace_research
+++ b/.storage/lovelace.lovelace_research
@@ -65,9 +65,6 @@
"entity": "binary_sensor.bathroom_leak_water_leak"
},
{
- "entity": "binary_sensor.kitchen_door_contact"
- },
- {
"entity": "sensor.living_office_device_temperature"
}
],
diff --git a/.storage/lovelace.lovelace_status b/.storage/lovelace.lovelace_status
index a5ea896..aad7bd1 100644
--- a/.storage/lovelace.lovelace_status
+++ b/.storage/lovelace.lovelace_status
@@ -114,24 +114,52 @@
"type": "entities",
"entities": [
{
+ "entity": "input_boolean.occupancy_toilet",
+ "name": "Toilet"
+ },
+ {
+ "entity": "input_boolean.occupancy_bathroom",
+ "name": "Bathroom"
+ }
+ ],
+ "title": "Occupancy"
+ },
+ {
+ "type": "entities",
+ "title": "Doors",
+ "entities": [
+ {
+ "entity": "binary_sensor.entrance_door_contact",
+ "name": "Entrance"
+ },
+ {
+ "entity": "binary_sensor.toilet_door_contact",
+ "name": "Toilet"
+ }
+ ]
+ },
+ {
+ "type": "entities",
+ "entities": [
+ {
"entity": "binary_sensor.hall_motions_occupancy",
"name": "Hall"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Kitchen1"
},
{
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Living"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Kitchen2"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Bedroom"
+ "entity": "binary_sensor.bathroom_motions_occupancy",
+ "name": "Bathroom"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Kitchen"
+ "entity": "binary_sensor.toilet_motions_occupancy",
+ "name": "Toilet"
}
],
"title": "Motions"
@@ -144,20 +172,20 @@
"name": "Hall"
},
{
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Living"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Kitchen1"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Kitchen2"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Bedroom"
+ "entity": "binary_sensor.bathroom_motions_occupancy",
+ "name": "Bathroom"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Kitchen"
+ "entity": "binary_sensor.toilet_motions_occupancy",
+ "name": "Toilet"
}
],
"hours_to_show": 2,
diff --git a/.storage/lovelace.lovelace_test b/.storage/lovelace.lovelace_test
index d9477fe..42bcdbf 100644
--- a/.storage/lovelace.lovelace_test
+++ b/.storage/lovelace.lovelace_test
@@ -31,169 +31,194 @@
"type": "vertical-stack",
"cards": [
{
- "type": "history-graph",
+ "type": "entities",
"entities": [
{
- "entity": "binary_sensor.entrance_door_contact",
- "name": "Contact"
+ "entity": "group.master_phones",
+ "name": "Phones"
},
{
- "entity": "binary_sensor.hall_motions_occupancy",
- "name": "Motions"
+ "entity": "group.master_laptops",
+ "name": "Laptops"
},
{
- "entity": "binary_sensor.entrance_vibrations_vibration",
- "name": "Vibration"
+ "entity": "sensor.192_168_50_1_devices_connected",
+ "name": "Asgard clients"
},
{
- "entity": "sensor.entrance_vibrations_strength",
- "name": "Strength"
+ "type": "divider"
+ },
+ {
+ "entity": "device_tracker.legion8",
+ "name": "Legion8/Asgard"
+ },
+ {
+ "entity": "device_tracker.lm_g810",
+ "name": "Legion8/Hass"
+ },
+ {
+ "entity": "device_tracker.nyx",
+ "name": "Nyx/Asgard"
}
- ],
- "hours_to_show": 1,
- "title": "Vibration Sensor (1h)"
+ ]
},
{
- "type": "entities",
+ "type": "history-graph",
"entities": [
{
- "entity": "binary_sensor.hall_motions_occupancy",
- "name": "Hall"
+ "entity": "group.master_phones",
+ "name": "Phones"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office"
+ "entity": "group.master_laptops",
+ "name": "Laptops"
},
{
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Living"
+ "entity": "device_tracker.legion8",
+ "name": "Legion8/Asgard"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Bedroom"
+ "entity": "device_tracker.lm_g810",
+ "name": "Legion8/Hass"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Kitchen"
+ "entity": "device_tracker.nyx",
+ "name": "Nyx/Asgard"
+ },
+ {
+ "entity": "sensor.192_168_50_1_devices_connected",
+ "name": "Asgard clients"
}
],
- "title": "Motions"
+ "hours_to_show": 12
},
{
"type": "history-graph",
"entities": [
{
- "entity": "binary_sensor.hall_motions_occupancy",
- "name": "Hall"
- },
- {
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Living"
+ "entity": "binary_sensor.entrance_door_contact",
+ "name": "Contact"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office"
+ "entity": "binary_sensor.hall_motions_occupancy",
+ "name": "Motions"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Bedroom"
+ "entity": "binary_sensor.entrance_vibrations_vibration",
+ "name": "Vibration"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Kitchen"
+ "entity": "sensor.entrance_vibrations_strength",
+ "name": "Strength"
}
],
"hours_to_show": 1,
- "title": "Motion Sensors (1h)"
- },
+ "title": "Vibration Sensor (1h)"
+ }
+ ]
+ },
+ {
+ "type": "vertical-stack",
+ "cards": [
{
- "type": "history-graph",
+ "type": "entities",
"entities": [
{
"entity": "binary_sensor.hall_motions_occupancy",
"name": "Hall"
},
{
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Living"
+ "type": "divider"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Kitchen/Table"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Bedroom"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Kitchen/Sink"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Kitchen"
+ "type": "divider"
+ },
+ {
+ "entity": "binary_sensor.bathroom_motions_occupancy",
+ "name": "Bathroom"
+ },
+ {
+ "type": "divider"
+ },
+ {
+ "entity": "binary_sensor.toilet_motions_occupancy",
+ "name": "Toilet"
+ },
+ {
+ "entity": "binary_sensor.toilet_door_contact",
+ "name": "Door"
}
- ],
- "hours_to_show": 12,
- "title": "Motion Sensors (12h)"
+ ]
},
{
- "type": "entities",
+ "type": "history-graph",
"entities": [
{
- "entity": "group.master_phones",
- "name": "Phones"
- },
- {
- "entity": "group.master_laptops",
- "name": "Laptops"
+ "entity": "binary_sensor.hall_motions_occupancy",
+ "name": "Hall"
},
{
- "entity": "sensor.192_168_50_1_devices_connected",
- "name": "Asgard clients"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Kitchen/Table"
},
{
- "type": "divider"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Kitchen/Sink"
},
{
- "entity": "device_tracker.legion8",
- "name": "Legion8/Asgard"
+ "entity": "binary_sensor.bathroom_motions_occupancy",
+ "name": "Bathroom"
},
{
- "entity": "device_tracker.lm_g810",
- "name": "Legion8/Hass"
+ "entity": "binary_sensor.toilet_motions_occupancy",
+ "name": "Toilet"
},
{
- "entity": "device_tracker.nyx",
- "name": "Nyx/Asgard"
+ "entity": "binary_sensor.toilet_door_contact",
+ "name": "Toilet Door"
}
- ]
+ ],
+ "hours_to_show": 1,
+ "title": "Motion Sensors (1h)"
},
{
"type": "history-graph",
"entities": [
{
- "entity": "group.master_phones",
- "name": "Phones"
+ "entity": "binary_sensor.hall_motions_occupancy",
+ "name": "Hall"
},
{
- "entity": "group.master_laptops",
- "name": "Laptops"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Kitchen/Table"
},
{
- "entity": "device_tracker.legion8",
- "name": "Legion8/Asgard"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Kitchen/Sink"
},
{
- "entity": "device_tracker.lm_g810",
- "name": "Legion8/Hass"
+ "entity": "binary_sensor.bathroom_motions_occupancy",
+ "name": "Bathroom"
},
{
- "entity": "device_tracker.nyx",
- "name": "Nyx/Asgard"
+ "entity": "binary_sensor.toilet_motions_occupancy",
+ "name": "Toilet"
},
{
- "entity": "sensor.192_168_50_1_devices_connected",
- "name": "Asgard clients"
+ "entity": "binary_sensor.toilet_door_contact",
+ "name": "Toilet Door"
}
],
- "hours_to_show": 12
+ "hours_to_show": 12,
+ "title": "Motion Sensors (12h)"
}
]
},
@@ -201,43 +226,55 @@
"type": "vertical-stack",
"cards": [
{
- "type": "history-graph",
+ "type": "entities",
"entities": [
{
- "entity": "switch.living_lights_left",
- "name": "Lustre 1"
+ "entity": "switch.hall_lights_left",
+ "name": "Hall Light"
},
{
- "entity": "switch.living_lights_center",
- "name": "Lustre 2"
+ "entity": "switch.entrance_lights_left",
+ "name": "Entrance Light"
},
{
- "entity": "switch.living_lights_right",
- "name": "Smart Bulb"
+ "entity": "switch.kitchen_lights_left",
+ "name": "Kitchen/Lustre"
+ },
+ {
+ "entity": "switch.kitchen_lights_center",
+ "name": "Kitchen/LED"
},
{
- "entity": "switch.living_tablelamp",
- "name": "DeskLamp"
+ "type": "divider"
},
{
- "entity": "binary_sensor.living_motions_occupancy",
- "name": "Room Motions"
+ "entity": "binary_sensor.hall_motions_occupancy",
+ "name": "Motions/Hall"
},
{
- "entity": "sensor.living_motions_illuminance_lux",
- "name": "Room Lux"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Motions/Table"
},
{
- "entity": "binary_sensor.office_motions_occupancy",
- "name": "Office Motions"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Motions/Sink"
},
{
- "entity": "sensor.office_motions_illuminance_lux",
- "name": "Office Lux"
+ "type": "divider"
+ },
+ {
+ "entity": "sensor.hall_motions_illuminance_lux",
+ "name": "Lux/Hall"
+ },
+ {
+ "entity": "sensor.kitchen_motions_illuminance_lux",
+ "name": "Lux/Table"
+ },
+ {
+ "entity": "sensor.kitchen_motions2_illuminance_lux",
+ "name": "Lux/Sink"
}
- ],
- "hours_to_show": 1,
- "title": "Living Illuminance (1h)"
+ ]
},
{
"type": "history-graph",
@@ -251,118 +288,218 @@
"name": "Entrance Light"
},
{
- "entity": "binary_sensor.hall_motions_occupancy",
- "name": "Motions"
- },
- {
- "entity": "sensor.hall_motions_illuminance_lux",
- "name": "Lux"
- }
- ],
- "hours_to_show": 1,
- "title": "Hall Illuminance (1h)"
- },
- {
- "type": "history-graph",
- "entities": [
- {
"entity": "switch.kitchen_lights_left",
- "name": "Lustre"
+ "name": "Kitchen/Lustre"
},
{
"entity": "switch.kitchen_lights_center",
- "name": "LED"
+ "name": "Kitchen/LED"
},
{
- "entity": "binary_sensor.kitchen_motions_occupancy",
- "name": "Motions"
+ "entity": "switch.living_lights_left",
+ "name": "Living/Lustre1"
},
{
- "entity": "sensor.kitchen_motions_illuminance_lux",
- "name": "Lux"
- }
- ],
- "hours_to_show": 1,
- "title": "Kitchen Illuminance (1h)"
- }
- ]
- },
- {
- "type": "vertical-stack",
- "cards": [
- {
- "type": "history-graph",
- "entities": [
+ "entity": "switch.living_lights_center",
+ "name": "Living/Lustre2"
+ },
{
- "entity": "switch.bedroom_lights_left",
- "name": "Lustre 1"
+ "entity": "switch.living_lights_right",
+ "name": "Living/Office"
},
{
- "entity": "switch.bedroom_lights_center",
- "name": "Lustre 2"
+ "entity": "switch.bathroom_lights_left",
+ "name": "Bedroom/Lustre1"
},
{
- "entity": "switch.bedroom_lights_right",
- "name": "Smart Bulb"
+ "entity": "switch.bedroom_lights_center",
+ "name": "Bedroom/Lustre1"
},
{
- "entity": "switch.bedroom_tablelamp",
- "name": "DeskLamp"
+ "entity": "switch.bathroom_lights_left",
+ "name": "Bathroom/Light"
},
{
- "entity": "binary_sensor.bedroom_bedsidelamp",
- "name": "BedLamp"
+ "entity": "switch.entrance_lights_left",
+ "name": "Toilet/Light"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
+ "entity": "binary_sensor.hall_motions_occupancy",
"name": "Motions"
},
{
- "entity": "sensor.bedroom_motions_illuminance_lux",
+ "entity": "sensor.hall_motions_illuminance_lux",
"name": "Lux"
}
],
"hours_to_show": 1,
- "title": "Bedroom Illuminance (1h)"
+ "title": "Hall Illuminance (1h)"
},
{
"type": "history-graph",
"entities": [
{
- "entity": "switch.bedroom_lights_left",
- "name": "Lustre 1"
+ "entity": "switch.kitchen_lights_left",
+ "name": "Lustre"
+ },
+ {
+ "entity": "switch.kitchen_lights_center",
+ "name": "LED"
},
{
- "entity": "switch.bedroom_lights_center",
- "name": "Lustre 2"
+ "entity": "switch.hall_lights_left",
+ "name": "Hall Light"
},
{
- "entity": "switch.bedroom_lights_right",
- "name": "Smart Bulb"
+ "entity": "switch.entrance_lights_left",
+ "name": "Entrance Light"
},
{
- "entity": "switch.bedroom_tablelamp",
- "name": "DeskLamp"
+ "entity": "binary_sensor.kitchen_motions_occupancy",
+ "name": "Motions/Table"
},
{
- "entity": "binary_sensor.bedroom_bedsidelamp",
- "name": "BedLamp"
+ "entity": "binary_sensor.kitchen_motions2_occupancy",
+ "name": "Motions/Sink"
},
{
- "entity": "binary_sensor.bedroom_motions_occupancy",
- "name": "Motions"
+ "entity": "sensor.kitchen_motions_illuminance_lux",
+ "name": "Lux/Table"
},
{
- "entity": "sensor.bedroom_motions_illuminance_lux",
- "name": "Lux"
+ "entity": "sensor.kitchen_motions2_illuminance_lux",
+ "name": "Lux/Sink"
}
],
- "hours_to_show": 12,
- "title": "Bedroom Illuminance (12h)"
+ "hours_to_show": 1,
+ "title": "Kitchen Illuminance (1h)"
}
]
},
{
+ "type": "conditional",
+ "conditions": [
+ {
+ "entity": "binary_sensor.kitchen_motions_illuminance_lux",
+ "state": "3333"
+ }
+ ],
+ "card": {
+ "type": "vertical-stack",
+ "cards": [
+ {
+ "type": "history-graph",
+ "entities": [
+ {
+ "entity": "switch.living_lights_left",
+ "name": "Lustre 1"
+ },
+ {
+ "entity": "switch.living_lights_center",
+ "name": "Lustre 2"
+ },
+ {
+ "entity": "switch.living_lights_right",
+ "name": "Smart Bulb"
+ },
+ {
+ "entity": "switch.living_tablelamp",
+ "name": "DeskLamp"
+ },
+ {
+ "entity": "binary_sensor.living_motions_occupancy",
+ "name": "Room Motions"
+ },
+ {
+ "entity": "sensor.living_motions_illuminance_lux",
+ "name": "Room Lux"
+ },
+ {
+ "entity": "binary_sensor.office_motions_occupancy",
+ "name": "Office Motions"
+ },
+ {
+ "entity": "sensor.office_motions_illuminance_lux",
+ "name": "Office Lux"
+ }
+ ],
+ "hours_to_show": 1,
+ "title": "Living Illuminance (1h)"
+ },
+ {
+ "type": "history-graph",
+ "entities": [
+ {
+ "entity": "switch.bedroom_lights_left",
+ "name": "Lustre 1"
+ },
+ {
+ "entity": "switch.bedroom_lights_center",
+ "name": "Lustre 2"
+ },
+ {
+ "entity": "switch.bedroom_lights_right",
+ "name": "Smart Bulb"
+ },
+ {
+ "entity": "switch.bedroom_tablelamp",
+ "name": "DeskLamp"
+ },
+ {
+ "entity": "binary_sensor.bedroom_bedsidelamp",
+ "name": "BedLamp"
+ },
+ {
+ "entity": "binary_sensor.bedroom_motions_occupancy",
+ "name": "Motions"
+ },
+ {
+ "entity": "sensor.bedroom_motions_illuminance_lux",
+ "name": "Lux"
+ }
+ ],
+ "hours_to_show": 1,
+ "title": "Bedroom Illuminance (1h)"
+ },
+ {
+ "type": "history-graph",
+ "entities": [
+ {
+ "entity": "switch.bedroom_lights_left",
+ "name": "Lustre 1"
+ },
+ {
+ "entity": "switch.bedroom_lights_center",
+ "name": "Lustre 2"
+ },
+ {
+ "entity": "switch.bedroom_lights_right",
+ "name": "Smart Bulb"
+ },
+ {
+ "entity": "switch.bedroom_tablelamp",
+ "name": "DeskLamp"
+ },
+ {
+ "entity": "binary_sensor.bedroom_bedsidelamp",
+ "name": "BedLamp"
+ },
+ {
+ "entity": "binary_sensor.bedroom_motions_occupancy",
+ "name": "Motions"
+ },
+ {
+ "entity": "sensor.bedroom_motions_illuminance_lux",
+ "name": "Lux"
+ }
+ ],
+ "hours_to_show": 12,
+ "title": "Bedroom Illuminance (12h)"
+ }
+ ]
+ }
+ },
+ {
"type": "vertical-stack",
"cards": [
{
diff --git a/automations.yaml b/automations.yaml
index 3e183c3..efe9950 100644
--- a/automations.yaml
+++ b/automations.yaml
@@ -19,7 +19,7 @@
domain: binary_sensor
for:
hours: 0
- minutes: 20
+ minutes: 10
seconds: 0
id: Toilet
- type: no_motion
@@ -28,8 +28,8 @@
entity_id: binary_sensor.hall_motions_occupancy
domain: binary_sensor
for:
- hours: 1
- minutes: 0
+ hours: 0
+ minutes: 40
seconds: 0
id: Long
- type: no_motion
@@ -283,33 +283,30 @@
- condition: trigger
id: left_dbl
sequence:
- - if:
- - condition: state
- entity_id: input_boolean.mode_alone
- state: 'off'
- then:
- - parallel:
- - service: script.sleep_and_wake
- data:
- mode: sleep
- target: office
- else:
- - parallel:
+ - parallel:
+ - service: switch.turn_off
+ target:
+ entity_id:
+ - switch.lights_living
+ - service: script.sleep_and_wake
+ data:
+ mode: hibernate
+ target: office
+ - if:
+ - condition: state
+ entity_id: input_boolean.mode_guests
+ state: 'off'
+ then:
- service: switch.turn_off
data: {}
target:
entity_id:
- - switch.lights_living
- switch.lights_guest
- switch.lights_temporary
- - service: script.sleep_and_wake
- data:
- mode: hibernate
- target: office
- - service: input_button.press
- data: {}
- target:
- entity_id: input_button.button_confirm
+ - service: input_button.press
+ data: {}
+ target:
+ entity_id: input_button.button_confirm
- conditions:
- condition: trigger
id: left_hold
@@ -527,6 +524,11 @@
on_click: []
off_click: []
dblclick:
+ - service: switch.turn_on
+ target:
+ entity_id: switch.hall_lights_right
+ data: {}
+ enabled: false
- service: script.sleep_and_wake
data:
mode: sleep
@@ -535,7 +537,6 @@
data: {}
target:
entity_id: input_button.button_confirm
- enabled: false
- id: '1672627582279'
alias: 'Hall: Kitchen Combo'
description: ''
@@ -619,7 +620,7 @@
target:
entity_id: input_button.button_confirm
- id: '1672972431474'
- alias: Knob Office Bulb Control
+ alias: 'Office: Knob Office Bulb Control'
description: ''
use_blueprint:
path: lights/knob-bulb-control.yaml
@@ -627,6 +628,17 @@
light: light.yeelight_color_0x7caaf86
knob: sensor.office_knob_action
toggle:
+ - if:
+ - condition: device
+ type: is_on
+ device_id: 32787706a8ff87380633b7c817057935
+ entity_id: switch.living_tablelamp
+ domain: switch
+ then:
+ - service: switch.turn_off
+ data: {}
+ target:
+ entity_id: switch.lights_living_lustre
- type: toggle
device_id: 32787706a8ff87380633b7c817057935
entity_id: switch.living_tablelamp
@@ -636,7 +648,7 @@
hue: input_number.knob_office_hue0
state: input_boolean.state_office_knob_pressed
- id: '1672979291802'
- alias: Knob Multi-Bulb Control
+ alias: 'Office: Knob Multi-Bulb Control'
description: ''
use_blueprint:
path: lights/knob-multi-bulb-control.yaml
@@ -693,14 +705,22 @@
entity_id: switch.smart_power_strip_pro_socket_1
state: 'off'
then:
- - service: script.sleep_and_wake
- data:
- mode: wake
- target: office
- - service: homeassistant.turn_off
- data: {}
- target:
- entity_id: switch.lights_living_lustre
+ - parallel:
+ - service: script.sleep_and_wake
+ data:
+ mode: wake
+ target: office
+ - if:
+ - condition: numeric_state
+ entity_id: sun.sun
+ attribute: elevation
+ below: '5'
+ then:
+ - service: script.turn_on_office_lights
+ data: {}
+ else:
+ - service: script.turn_on_office_lights
+ data: {}
dblclick:
- if:
- condition: state
@@ -753,6 +773,8 @@
target:
entity_id: input_button.button_confirm
data: {}
+ temperature: 6000
+ on_light: 'no'
- id: '1672991247298'
alias: 'Living: Light Sync'
description: ''
@@ -778,10 +800,10 @@
light_target:
- switch.kitchen_lights_left
- switch.kitchen_lights_center
- motion_entity: binary_sensor.kitchen_motions_occupancy
+ motion_entity: binary_sensor.motions_kitchen
illumination_test: sensor
illuminance_entity: sensor.kitchen_motions_illuminance_lux
- lux_threshold: 30
+ lux_threshold: 40
- id: '1673037015865'
alias: 'Motions: Night Light'
description: ''
@@ -826,9 +848,8 @@
device_id: 87071fc9d8fb9ebbccb145f5642c7404
entity_id: light.aqara_hub_m1s_426c
domain: light
- brightness_pct: 100
- id: '1673153262822'
- alias: 'Motions: Global '
+ alias: 'Motions: Global v1'
description: ''
trigger:
- platform: state
@@ -903,7 +924,7 @@
- condition: trigger
id: away
- condition: state
- entity_id: input_boolean.mode_single
+ entity_id: input_boolean.mode_alone
state: 'on'
- condition: state
entity_id: binary_sensor.hall_motions_occupancy
@@ -940,10 +961,10 @@
- condition: trigger
id: home
sequence:
- - service: input_boolean.turn_off
+ - service: switch.turn_off
data: {}
target:
- entity_id: input_boolean.mode_away
+ entity_id: switch.hall_lights_right
- conditions:
- condition: or
conditions:
@@ -1055,3 +1076,85 @@
target:
entity_id: scene.sven_power_switch
mode: single
+- id: '1673329841884'
+ alias: 'Motions: Toilet'
+ description: ''
+ use_blueprint:
+ path: motion/occupancy_tracking.yaml
+ input:
+ occupancy: input_boolean.occupancy_toilet
+ entrance: binary_sensor.toilet_door_contact
+ inside: binary_sensor.toilet_motions_occupancy
+ light: switch.entrance_lights_left
+ on_action:
+ - type: turn_on
+ device_id: 07b7086cf34752386c82a5109311ac6e
+ entity_id: switch.entrance_lights_left
+ domain: switch
+ reentry_wait: 10
+ reentry_timeout: 45
+- id: '1673331563280'
+ alias: 'Motions: Bathroom'
+ description: ''
+ use_blueprint:
+ path: motion/occupancy_tracking.yaml
+ input:
+ entrance: binary_sensor.bathroom_motions_occupancy
+ inside: binary_sensor.bathroom_motions_occupancy
+ light: switch.bathroom_lights_left
+ occupancy: input_boolean.occupancy_bathroom
+ on_action:
+ - type: turn_on
+ device_id: 04c6f563c006599ed7754aba652654ae
+ entity_id: switch.bathroom_lights_left
+ domain: switch
+ reentry_wait: 5
+ reentry_timeout: 30
+- id: '1674140368136'
+ alias: 'Office: Sven Scene Switch'
+ description: ''
+ use_blueprint:
+ path: media/sven_scene_switch.yaml
+ input:
+ switch_action: sensor.living_scene_switch_action
+ media_player: media_player.smartpi
+ playlist_control: input_number.smartpi_playlist
+ power_scene: scene.sven_power_switch
+- id: '1674146213954'
+ alias: 'Motions: Global v2'
+ description: ''
+ use_blueprint:
+ path: motion/halabyan24.yaml
+- id: '1674208339037'
+ alias: 'Office: Knob Sound-Bulb Control'
+ description: ''
+ use_blueprint:
+ path: lights/knob-sound-multi-bulb-control.yaml
+ input:
+ knob: sensor.office_knob_action
+ lights:
+ - light.yeelight_color_0x7caaf86
+ media_player: media_player.smartpi
+ toggle_actions:
+ - choose:
+ - conditions:
+ - condition: template
+ value_template: '{{ current_num == 0 }}'
+ sequence:
+ - if:
+ - condition: device
+ type: is_on
+ device_id: 32787706a8ff87380633b7c817057935
+ entity_id: switch.living_tablelamp
+ domain: switch
+ then:
+ - service: switch.turn_off
+ data: {}
+ target:
+ entity_id: switch.lights_living_lustre
+ enabled: false
+ - type: toggle
+ device_id: 32787706a8ff87380633b7c817057935
+ entity_id: switch.living_tablelamp
+ domain: switch
+ default: []
diff --git a/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml b/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml
new file mode 100644
index 0000000..843b25e
--- /dev/null
+++ b/blueprints/automation/lights/knob-sound-multi-bulb-control.yaml
@@ -0,0 +1,338 @@
+blueprint:
+ name: Knob Sound & Multi-Bulb Control
+ description: Knob (clicking/rotating) to control bulb (or LED band) brightness, color temperature, and hue
+ domain: automation
+ input:
+ knob:
+ name: knob
+ description: controller (select _action entity)
+ selector:
+ entity:
+ domain: sensor
+ lights:
+ name: Bulb
+ description: smart bulb or power socket
+ selector:
+ entity:
+ multiple: true
+ domain: light
+ media_player:
+ name: Media Player
+ description: "Media Player"
+ selector:
+ entity:
+ domain: media_player
+
+ toggle_actions:
+ name: Toggle Actions
+ description: Script to run on clicking knob button (e.g. turn-of bulb power on/off), first action if bulb1 active, second if bulb2 active, etc. (use e.g. choose for grouping)
+ default:
+ - choose: []
+ default: []
+ selector:
+ action:
+
+ name:
+ name: name
+ description: Name of variables tracking bulb parameters (should include ***_current, ***_brighness0, ***_temperature0, ***_hue0
+ default: knob_office
+
+ hue_delay:
+ name: Hue Delay
+ description: Delay between hue changes
+ default: 500
+ selector:
+ number:
+ min: 100
+ max: 10000
+
+ inactivity_delay:
+ name: Inactivity Delay
+ description: Reset to first deveice if no actions (seconds), use 0 to have no inactivity timeout
+ default: 900
+ selector:
+ number:
+ min: 0
+ max: 7200
+
+ volume_steps:
+ name: Hue Delay
+ description: Delay between hue changes
+ default: 4
+ selector:
+ number:
+ min: 1
+ max: 10
+
+trigger:
+ - platform: state
+ id: knob
+ entity_id: !input "knob"
+ to:
+ - "toggle"
+ - "brightness_step_up"
+ - "brightness_step_down"
+ - "color_temperature_step_up"
+ - "color_temperature_step_down"
+ - "hue_move"
+
+variables:
+ name: !input name
+
+ inactivity_delay: !input inactivity_delay
+ last_trigger: '{{ now().timestamp() - as_timestamp(this.attributes.last_triggered) }}'
+
+ current: 'input_number.{{ name + "_current" }}'
+ current_num: '{{ (states(current) | int - 1) if ((inactivity_delay == 0) or (inactivity_delay>last_trigger)) else -1 }}'
+
+ lights: !input lights
+ brightness: 'input_number.{{ name + "_brightness" }}{{ current_num }}'
+ temperature: 'input_number.{{ name + "_temperature" }}{{ current_num }}'
+ hue: 'input_number.{{ name + "_hue" }}{{ current_num }}'
+
+ hue_delay: !input hue_delay
+ volume_steps: !input volume_steps
+
+# We can't use 'queued/restart' if we need to tackle 'double-click'
+#mode: queued
+mode: single
+
+action:
+- if:
+ - condition: template
+ value_template: '{{ last_trigger > inactivity_delay }}'
+ then:
+ - service: input_number.set_value
+ data:
+ value: 0
+ target:
+ entity_id: '{{ current }}'
+
+
+- choose:
+ - conditions:
+ - condition: trigger
+ id: knob
+ sequence:
+ - choose:
+
+# Sounds control
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "brightness_step_up" }}'
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ sequence:
+ - repeat:
+ count: '{{ volume_steps }}'
+ sequence:
+ - service: media_player.volume_up
+ target:
+ entity_id: !input media_player
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "brightness_step_down" }}'
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ sequence:
+ - repeat:
+ count: '{{ volume_steps }}'
+ sequence:
+ - service: media_player.volume_down
+ target:
+ entity_id: !input media_player
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "color_temperature_step_up" }}'
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ - condition: template
+ value_template: '{{ last_trigger > 2 }}'
+ sequence:
+ - service: media_player.media_next_track
+ target:
+ entity_id: !input media_player
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "color_temperature_step_down" }}'
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ - condition: template
+ value_template: '{{ last_trigger > 2 }}'
+ sequence:
+ - service: media_player.media_previous_track
+ target:
+ entity_id: !input media_player
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "hue_move" }}'
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ - condition: template
+ value_template: '{{ last_trigger > 2 }}'
+ sequence:
+ - service: script.play_playlist
+ data:
+ media_player: !input media_player
+ playlist: darksoft
+
+# Light control
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "brightness_step_up" }}'
+ - condition: template
+ value_template: '{{ current_num >= 0 }}'
+ sequence:
+ - service: input_number.increment
+ target:
+ entity_id: '{{ brightness }}'
+ - service: light.turn_on
+ data:
+ brightness: '{{ states(brightness) }}'
+ target:
+ entity_id: '{{ lights[current_num] }}'
+
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "brightness_step_down" }}'
+ - condition: template
+ value_template: '{{ current_num >= 0 }}'
+ sequence:
+ - service: input_number.decrement
+ data: {}
+ target:
+ entity_id: '{{ brightness }}'
+ - service: light.turn_on
+ data:
+ brightness: '{{ states(brightness) }}'
+ target:
+ entity_id: '{{ lights[current_num] }}'
+
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "color_temperature_step_up" }}'
+ - condition: template
+ value_template: '{{ current_num >= 0 }}'
+ sequence:
+ - service: input_number.increment
+ target:
+ entity_id: '{{ temperature }}'
+ - service: light.turn_on
+ data:
+ kelvin: '{{ states(temperature) }}'
+ target:
+ entity_id: '{{ lights[current_num] }}'
+
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "color_temperature_step_down" }}'
+ - condition: template
+ value_template: '{{ current_num >= 0 }}'
+ sequence:
+ - service: input_number.decrement
+ target:
+ entity_id: '{{ temperature }}'
+ - service: light.turn_on
+ data:
+ kelvin: '{{ states(temperature) }}'
+ target:
+ entity_id: '{{ lights[current_num] }}'
+
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "hue_move" }}'
+ - condition: template
+ value_template: '{{ current_num >= 0 }}'
+ sequence:
+ - repeat:
+ until:
+ - condition: template
+ value_template: '{{ wait.trigger != None }}'
+ sequence:
+ - if:
+ - condition: template
+ value_template: '{{ states(hue) | float < 359 }}'
+ then:
+ - service: input_number.increment
+ data: {}
+ target:
+ entity_id: '{{ hue }}'
+ else:
+ - service: input_number.set_value
+ data:
+ value: 0
+ target:
+ entity_id: '{{ hue }}'
+ - service: light.turn_on
+ data:
+ hs_color: '{{ states(hue) }}, 100'
+ target:
+ entity_id: '{{ lights[current_num] }}'
+ - wait_for_trigger:
+ - platform: state
+ entity_id: !input knob
+ to: 'hue_stop'
+ timeout:
+ milliseconds: !input hue_delay
+ continue_on_timeout: true
+
+ - conditions:
+ - condition: template
+ value_template: '{{ trigger.to_state.state == "toggle" }}'
+ - condition: template
+ value_template: '{{ last_trigger > 2 }}'
+ sequence:
+ - wait_for_trigger:
+ - platform: state
+ entity_id: !input knob
+ to:
+ - "toggle"
+ timeout: '2'
+ continue_on_timeout: true
+ - if:
+ - condition: template
+ value_template: '{{ wait.trigger == None }}'
+ then:
+ - if:
+ - condition: template
+ value_template: '{{ current_num < 0 }}'
+ then:
+ - service: media_player.media_play_pause
+ target:
+ entity_id: !input media_player
+
+ - choose: []
+ default: !input toggle_actions
+ else:
+ - service: input_number.increment
+ target:
+ entity_id: '{{ current }}'
+ - if:
+ - condition: template
+ value_template: '{{ states(current) | float > (lights | length) }}'
+ then:
+ - service: input_number.set_value
+ data:
+ value: 0
+ target:
+ entity_id: '{{ current }}'
+ else:
+ - service: light.turn_on
+ target:
+ entity_id: '{{ lights[(states(current) | int) - 1] }}'
+ data:
+ brightness: 255
+ - delay:
+ seconds: 1
+ - service: light.turn_off
+ target:
+ entity_id: '{{ lights[(states(current) | int) - 1] }}'
+ - delay:
+ seconds: 1
+ - service: light.turn_on
+ data:
+ kelvin: '{{ states("input_number." + name + "_temperature" + (((states(current) | int) - 1) | string)) }}'
+ brightness: '{{ states("input_number." + name + "_brightness" + (((states(current) | int) - 1) | string)) }}'
+# hs_color: '{{ states("input_number." + name + "_hue" + (((states(current) | int) - 1) | string)) }}, 100'
+ target:
+ entity_id: '{{ lights[(states(current) | int) - 1] }}'
diff --git a/blueprints/automation/lights/light_button.yaml b/blueprints/automation/lights/light_button.yaml
index 7aeb0ab..34116bc 100644
--- a/blueprints/automation/lights/light_button.yaml
+++ b/blueprints/automation/lights/light_button.yaml
@@ -15,6 +15,28 @@ blueprint:
selector:
entity:
domain: light
+ on_light:
+ name: On Light
+ description: Turn light on automatically or allow complex scenarios using 'on_click'
+ default: 'yes'
+ selector:
+ select:
+ options:
+ - label: Turn on lights automatically
+ value: 'yes'
+ - label: Manage lights using 'on_click' handler
+ value: 'no'
+ off_light:
+ name: Off Light
+ description: Turn light off automatically or allow complex scenarios using 'off_click'
+ default: 'yes'
+ selector:
+ select:
+ options:
+ - label: Turn off lights automatically
+ value: 'yes'
+ - label: Manage lights using 'off_click' handler
+ value: 'no'
temperature:
name: Temperature
description: Color Temperature
@@ -83,6 +105,8 @@ trigger:
variables:
state: !input state
hold: !input hold
+ light_on: !input on_light
+ light_off: !input off_light
# Can't do 'restart' since it will break wait_for_trigger
mode: single
@@ -104,19 +128,27 @@ action:
state: 'on'
then:
- parallel:
- - service: light.turn_off
- target:
- entity_id: !input light
+ - if:
+ - condition: template
+ value_template: '{{ light_off == "yes" }}'
+ then:
+ - service: light.turn_off
+ target:
+ entity_id: !input light
- choose: []
default: !input "off_click"
else:
- parallel:
- - service: light.turn_on
- data:
- brightness_pct: 100
- kelvin: !input temperature
- target:
- entity_id: !input light
+ - if:
+ - condition: template
+ value_template: '{{ light_on == "yes" }}'
+ then:
+ - service: light.turn_on
+ data:
+ brightness_pct: 100
+ kelvin: !input temperature
+ target:
+ entity_id: !input light
- choose: []
default: !input "on_click"
diff --git a/blueprints/automation/media/sven_scene_switch.yaml b/blueprints/automation/media/sven_scene_switch.yaml
new file mode 100644
index 0000000..8f54d8d
--- /dev/null
+++ b/blueprints/automation/media/sven_scene_switch.yaml
@@ -0,0 +1,149 @@
+blueprint:
+ name: Sven Scene Switch
+ description: Scene-switch (4-buttons) to control SmartPi media player
+ domain: automation
+ input:
+ switch_action:
+ name: switch_action
+ description: Scene Switch Action
+ selector:
+ entity:
+ domain: sensor
+ media_player:
+ name: Media Player
+ description: "Media Player"
+ selector:
+ entity:
+ domain: media_player
+ playlist_control:
+ name: Playlist Control
+ description: "Playlist Control Variable (input_number.smartpi_playlist)"
+ selector:
+ entity:
+ domain: input_number
+ power_scene:
+ name: Power Scene
+ description: "Scene controlling Sven Power On/Off"
+ selector:
+ entity:
+ domain: scene
+
+trigger:
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 1_single
+ id: single1
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 2_single
+ id: single2
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 3_single
+ id: single3
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 4_single
+ id: single4
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 1_double
+ id: double1
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 2_double
+ id: double2
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 3_double
+ id: double3
+ - platform: state
+ entity_id:
+ - !input switch_action
+ to: 4_dobule
+ id: double4
+
+mode: restart
+
+action:
+ - choose:
+ - conditions:
+ - condition: trigger
+ id: single1
+ sequence:
+ - service: media_player.media_play_pause
+ target:
+ entity_id: !input media_player
+ data: {}
+ - conditions:
+ - condition: trigger
+ id: double1
+ sequence:
+ - service: scene.turn_on
+ target:
+ entity_id: !input power_scene
+
+ - conditions:
+ - condition: trigger
+ id: single2
+ sequence:
+ - service: media_player.media_next_track
+ data: {}
+ target:
+ entity_id: !input media_player
+ - conditions:
+ - condition: trigger
+ id: double2
+ sequence:
+ - service: media_player.media_previous_track
+ data: {}
+ target:
+ entity_id: !input media_player
+
+ - conditions:
+ - condition: trigger
+ id: single3
+ sequence:
+ - service: script.play_playlist
+ data:
+ media_player: !input media_player
+ playlist: darksoft
+ - conditions:
+ - condition: trigger
+ id: double3
+ sequence:
+ - service: input_number.set_value
+ data:
+ value: 0
+ target:
+ entity_id: !input playlist_control
+ - service: script.play_playlist
+ data:
+ media_player: !input media_player
+ playlist: darksoft
+
+ - conditions:
+ - condition: trigger
+ id: single4
+ sequence:
+ - service: script.play_playlist
+ data:
+ media_player: !input media_player
+ playlist: asgard
+ - conditions:
+ - condition: trigger
+ id: double4
+ sequence:
+ - service: script.play_playlist
+ data:
+ media_player: !input media_player
+ playlist: downloads
+
+ default: []
diff --git a/blueprints/automation/motion/halabyan24.yaml b/blueprints/automation/motion/halabyan24.yaml
new file mode 100644
index 0000000..e06c26d
--- /dev/null
+++ b/blueprints/automation/motion/halabyan24.yaml
@@ -0,0 +1,234 @@
+blueprint:
+ name: Halabyan24 Global Motions
+ description: Global motion/tracking rules for Halabyan 24
+ domain: automation
+
+trigger:
+# We get home (we rather rely on motion sensor here)
+# - platform: state
+# id: home
+# entity_id:
+# - group.master_phones
+# from: not_home
+# to: home
+# for:
+# hours: 0
+# minutes: 1
+# seconds: 0
+
+# We get away from home (even near-by)
+ - platform: state
+ id: not_home
+ entity_id:
+ - group.master_phones
+ from: home
+ to: not_home
+ for:
+ hours: 1
+ minutes: 0
+ seconds: 0
+
+# We get in home area (from outside)
+ - platform: state
+ id: around_home
+ entity_id:
+ - device_tracker.lm_g810
+ from: not_home
+ to: HomeHalabyanExtended
+ for:
+ hours: 0
+ minutes: 5
+ seconds: 0
+
+# We get away from home area
+ - platform: state
+ id: away_from_home
+ entity_id:
+ - device_tracker.lm_g810
+ from: HomeHalabyanExtended
+ to: not_home
+ for:
+ hours: 1
+ minutes: 0
+ seconds: 0
+
+# No motions in the hall for a day
+ - platform: state
+ entity_id: binary_sensor.hall_motions_occupancy
+ from: "on"
+ to: "off"
+ for:
+ hours: 24
+ minutes: 0
+ seconds: 0
+ id: empty_day
+
+# No motions in the hall for a week
+ - platform: state
+ entity_id: binary_sensor.hall_motions_occupancy
+ from: "on"
+ to: "off"
+ for:
+ hours: 120
+ minutes: 0
+ seconds: 0
+ id: empty_week
+
+# Motions in the hall detected
+ - platform: state
+ entity_id: binary_sensor.hall_motions_occupancy
+ from: "off"
+ to: "on"
+ for:
+ hours: 0
+ minutes: 1
+ seconds: 0
+ id: motions
+
+# 'Away' security mode is turned off
+ - platform: state
+ entity_id:
+ - input_boolean.mode_away
+ from: 'on'
+ to: 'off'
+ id: away_gone
+
+
+condition: []
+action:
+ - choose:
+
+# Set 'away' security mode if no motions for 1 day (or for 2 hours if we are 'alone' and left 'home area')
+ - conditions:
+ - condition: state
+ entity_id: input_boolean.mode_away
+ state: 'off'
+ - condition: or
+ conditions:
+ - condition: trigger
+ id: empty_day
+ - condition: and
+ conditions:
+ - condition: trigger
+ id: away_from_home
+ - condition: state
+ entity_id: input_boolean.mode_house_sleep
+ state: 'on'
+ sequence:
+ - service: switch.turn_on
+ target:
+ entity_id: switch.hall_lights_right
+
+# Set house to 'sleep' if no motions for 1 day (or for 2 hours if we are 'alone' and left 'home')
+ - conditions:
+ - condition: state
+ entity_id: input_boolean.mode_house_sleep
+ state: 'off'
+ - condition: or
+ conditions:
+ - condition: trigger
+ id: empty_day
+ - condition: and
+ conditions:
+ - condition: trigger
+ id: not_home
+# - condition: state
+# entity_id: input_boolean.mode_alone
+# state: 'on'
+ - condition: state
+ entity_id: input_boolean.mode_guests
+ state: 'off'
+ - condition: state
+ entity_id: binary_sensor.hall_motions_occupancy
+ state: 'off'
+ for:
+ hours: 2
+ minutes: 0
+ seconds: 0
+ sequence:
+ - service: script.sleep_and_wake
+ data:
+ mode: sleep
+ target: house
+
+# Set house to 'hibernate' if no motions for a week
+ - conditions:
+ - condition: trigger
+ id: empty_week
+ - condition: state
+ entity_id: input_boolean.mode_house_hibernate
+ state: 'off'
+ sequence:
+ - service: script.sleep_and_wake
+ data:
+ mode: hibernate
+ target: house
+
+
+# Disable 'away' security mode if our phone is in vicinity
+ - conditions:
+ - condition: trigger
+ id: around_home
+ sequence:
+ - service: switch.turn_off
+ data: {}
+ target:
+ entity_id: switch.hall_lights_right
+
+# 'Wake' house if it was 'sleeping'/'hibernated' and
+# * either there are motions in hall and 'away' security mode is not set
+# * or 'away' security mode is just turned off
+
+ - conditions:
+ - condition: or
+ conditions:
+ - condition: state
+ entity_id: input_boolean.mode_house_sleep
+ state: 'on'
+ for:
+ hours: 0
+ minutes: 10
+ seconds: 0
+ - condition: state
+ entity_id: input_boolean.mode_house_hibernate
+ state: 'on'
+ for:
+ hours: 0
+ minutes: 10
+ seconds: 0
+ - condition: or
+ conditions:
+ - condition: and
+ conditions:
+ - condition: trigger
+ id: motions
+ - condition: state
+ entity_id: input_boolean.mode_away
+ state: 'off'
+ - condition: and
+ conditions:
+ - condition: trigger
+ id: away_gone
+ - type: is_motion
+ condition: device
+ device_id: 6deb0a6fb7a4a849ba22afc166cf9919
+ entity_id: binary_sensor.hall_motions_occupancy
+ domain: binary_sensor
+ sequence:
+ - if:
+ - condition: state
+ entity_id: input_boolean.mode_house_hibernate
+ state: 'on'
+ then:
+ - service: script.sleep_and_wake
+ data:
+ mode: wake
+ target: house
+ - service: input_boolean.turn_off
+ data: {}
+ target:
+ entity_id:
+ - input_boolean.mode_house_sleep
+ - input_boolean.mode_house_hibernate
+ default: []
+mode: single
diff --git a/blueprints/automation/motion/motion_switch.yaml b/blueprints/automation/motion/motion_switch.yaml
index c78e31f..e28d6da 100644
--- a/blueprints/automation/motion/motion_switch.yaml
+++ b/blueprints/automation/motion/motion_switch.yaml
@@ -8,7 +8,7 @@ blueprint:
selector:
entity:
domain: binary_sensor
- device_class: motion
+# device_class: motion
illumination_test:
name: Illumination Test
diff --git a/blueprints/automation/motion/occupancy_tracking.yaml b/blueprints/automation/motion/occupancy_tracking.yaml
new file mode 100644
index 0000000..c573bf9
--- /dev/null
+++ b/blueprints/automation/motion/occupancy_tracking.yaml
@@ -0,0 +1,166 @@
+# This can be used stand-alone or in combination with 'motion_switch' (to allow more complex light-on scenarios, e.g. based on current illumination level)
+# For this reason, 'light on' should be programmed in 'on_action' if necessary
+# We can use blueprint using the same entrance/inside sensors, however, this is least robust variant
+# Re-entry events (take a towel go back in) will break automation
+# We can try to prevent by ensuring there is no repeated motions for prolonged time (but, then, blueprint will fail if we do something at entrance)
+
+blueprint:
+ name: Occupancy tracking
+ description: Tries to track occupancy of single-person places (toilet bathroom)
+ domain: automation
+ input:
+ entrance:
+ name: Entrance
+ description: This can be door sensor or motion sensor monitoring passage via entrance area
+ selector:
+ entity:
+ domain: binary_sensor
+ inside:
+ name: Inside
+ description: Triggers when there is motion inside (this could be the same like entrance or additional sensor, e.g. we monitor motions as 'inside' and door sensor as 'entrance'). Independent sensors are much more robust
+ selector:
+ entity:
+ domain: binary_sensor
+ light:
+ name: Light
+ selector:
+ entity:
+ domain: [switch, light]
+ occupancy:
+ name: Occupancy
+ description: State variable (normally created via Helpers) tracking current state
+ selector:
+ entity:
+ domain: input_boolean
+
+ reentry_wait:
+ name: Re-entry Wait
+ description: Time without motions to handle re-entry events (seconds)
+ default: 1
+ selector:
+ number:
+ min: 0
+ max: 30
+ unit_of_measurement: seconds
+
+ reentry_timeout:
+ name: Re-entry Timeout
+ description: Timeout to assume re-entry if no 'no-motions' trigger were fired within timeout (seconds)
+ default: 10
+ selector:
+ number:
+ min: 1
+ max: 300
+ unit_of_measurement: seconds
+
+ on_action:
+ name: on_action
+ description: Actions to perform while occupancy is detected (lights will not be turned on automatically to allow more complex scenarios via motion-switch automation)
+ default: []
+ selector:
+ action:
+ off_action:
+ name: off_action
+ description: Additional actions to perform when place gets free
+ default: []
+ selector:
+ action:
+
+variables:
+ reentry_wait: !input reentry_wait
+
+# Lights are still on while we are waiting for re-entry. So, we don't need to allow re-trigger in this case and 'single' should do
+mode: single
+
+trigger:
+ # Either door is open or motion in the entrance area is detected
+ - platform: state
+ id: "entrance"
+ entity_id: !input entrance
+ from: "off"
+ to: "on"
+
+ - platform: state
+ id: "inside"
+ entity_id: !input inside
+ from: "off"
+ to: "on"
+
+ # Light is turned off
+ - platform: state
+ id: "light_off"
+ entity_id: !input light
+ from: "on"
+ to: "off"
+
+action:
+ - choose:
+ # Occupancy goes 'on' once movement inside is detected
+ - conditions:
+ - condition: state
+ entity_id: !input inside
+ state: 'on'
+ - condition: or
+ conditions:
+ - condition: state
+ entity_id: !input occupancy
+ state: 'off'
+ - condition: state
+ entity_id: !input light
+ state: 'off'
+ sequence:
+ - parallel:
+ - service: input_boolean.turn_on
+ target:
+ entity_id: !input occupancy
+ - choose: []
+ default: !input "on_action"
+
+ # Occupancy goes 'off' once entrance triggered while occapncy is 'on' and there are no movements inside for a while
+ - conditions:
+ - condition: state
+ entity_id: !input entrance
+ state: 'on'
+ - condition: state
+ entity_id: !input occupancy
+ state: 'on'
+ sequence:
+ - if:
+ - condition: template
+ value_template: '{{ (reentry_wait | float) > 0 }}'
+ then:
+ - wait_for_trigger:
+ - platform: state
+ entity_id: !input inside
+ to: 'off'
+ for:
+ seconds: !input reentry_wait
+ timeout:
+ seconds: !input reentry_timeout
+ continue_on_timeout: false
+
+ - parallel:
+ - service: input_boolean.turn_off
+ target:
+ entity_id: !input occupancy
+ - service: switch.turn_off
+ target:
+ entity_id: !input light
+ - choose: []
+ default: !input "off_action"
+
+ # Occupancy goes 'off' if lights are manually (or on timeout) switched off
+ # We can't do the same to turn occupancy 'on' as 'entrance' event might be fired after manually turning lights on (it will be interpreted as leaving)
+ # Will be retriggered back 'on' on any movement inside (so, it is not so critical if something is wrong)
+ - conditions:
+ - condition: trigger
+ id: "light_off"
+ sequence:
+ - parallel:
+ - service: input_boolean.turn_off
+ target:
+ entity_id: !input occupancy
+ - choose: []
+ default: !input "off_action"
+
+ default: []
diff --git a/configuration.yaml b/configuration.yaml
index 7310d24..f157cca 100644
--- a/configuration.yaml
+++ b/configuration.yaml
@@ -16,6 +16,18 @@ lovelace:
frontend:
themes: !include_dir_merge_named themes
+logbook:
+ exclude:
+ entities:
+ - sensor.internet_time
+ - sensor.time
+ - sensor.date
+ entity_globs:
+ - sensor.weather_*
+ - sensor.date_*
+ - sensor.time_*
+# domains:
+# - sun
# Trusted networks should go first or allow_bypass_login will be ignored
homeassistant:
diff --git a/custom/input_number.yaml b/custom/input_number.yaml
index 0fd1307..2d7ec1c 100644
--- a/custom/input_number.yaml
+++ b/custom/input_number.yaml
@@ -35,3 +35,8 @@
max: 360.0
step: 20.0
initial: 0.0
+ smartpi_playlist:
+ min: 0.0
+ max: 10.0
+ step: 1.0
+ initial: 0.0
diff --git a/custom/scripts/play-playlist.yaml b/custom/scripts/play-playlist.yaml
new file mode 100644
index 0000000..719958c
--- /dev/null
+++ b/custom/scripts/play-playlist.yaml
@@ -0,0 +1,144 @@
+# We can get media_content_id from kodi web interface on port 8080
+
+play_playlist:
+ alias: Play PlayList
+ description: Send one of pre-generated playlists to media player
+ fields:
+ media_player:
+ name: Media Player
+ description: "Media Player"
+ required: true
+ selector:
+ entity:
+ domain: media_player
+ volume:
+ name: Volume
+ description: "Audio Volume: 0 - 1"
+ default: 0.7
+ selector:
+ number:
+ min: 0
+ max: 1
+ step: 0.05
+ playlist:
+ name: Playlist
+ description: "PlayList to play"
+ default: darksoft
+ selector:
+ select:
+ options:
+ - label: DarkSoft Collections
+ value: darksoft
+ - label: Asgard Music
+ value: asgard
+ - label: Asgard Downloads
+ value: downloads
+ - label: Custom
+ value: custom
+ custom:
+ name: Custom
+ description: "Location of custom playlist"
+ default: []
+ selector:
+ media:
+
+ variables:
+ subfolders: [ "Best", "French", "Russian", "Armenian", "Slavic", "Power", "Irish", "Instrumental" ]
+ current: 'input_number.smartpi_playlist'
+ vol: '{{ volume | default(0.7) | float }}'
+ list: '{{ playlist | default("darksoft") }}'
+
+ mode: single
+
+ sequence:
+ - alias: Turn on player
+ service: media_player.turn_on
+ target:
+ entity_id: '{{ media_player }}'
+
+ - service: media_player.volume_set
+ data:
+ volume_level: '{{ vol }}'
+ target:
+ entity_id: '{{ media_player }}'
+
+ - choose:
+ - conditions:
+ - condition: template
+ value_template: '{{ list == "darksoft" }}'
+ sequence:
+ - if:
+ - condition: template
+ value_template: '{{ states(current) | float >= (subfolders | length) }}'
+ then:
+ - service: input_number.set_value
+ data:
+ value: 0
+ target:
+ entity_id: '{{ current }}'
+
+ - alias: Iterate Darksoft Playlists
+ service: media_player.play_media
+ target:
+ entity_id:
+ - '{{ media_player }}'
+ data:
+ media_content_type: DIRECTORY
+ enqueue: play
+ media_content_id: '{{ "/home/csa/Music/" + subfolders[states(current) | int] }}'
+
+ - service: input_number.increment
+ target:
+ entity_id: '{{ current }}'
+
+ - conditions:
+ - condition: template
+ value_template: '{{ list == "asgard" }}'
+ sequence:
+ - alias: Play Asgard Music
+ service: media_player.play_media
+ target:
+ entity_id:
+ - '{{ media_player }}'
+ data:
+ media_content_type: DIRECTORY
+ enqueue: play
+ media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%246%243/"
+
+ - conditions:
+ - condition: template
+ value_template: '{{ list == "download" }}'
+ sequence:
+ - alias: Play Asgard Downloads
+ service: media_player.play_media
+ target:
+ entity_id:
+ - '{{ media_player }}'
+ data:
+ media_content_type: DIRECTORY
+ enqueue: play
+ media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%241%240/"
+
+ - conditions:
+ - condition: template
+ value_template: '{{ list == "custom" }}'
+ sequence:
+ - alias: Play Asgard Downloads
+ service: media_player.play_media
+ target:
+ entity_id:
+ - '{{ media_player }}'
+ data: '{{ custom }}'
+
+
+ - service: media_player.shuffle_set
+ data:
+ shuffle: true
+ target:
+ entity_id: '{{ media_player }}'
+
+ - service: media_player.repeat_set
+ data:
+ repeat: true
+ target:
+ entity_id: '{{ media_player }}'
diff --git a/custom/scripts/sleep-and-wake.yaml b/custom/scripts/sleep-and-wake.yaml
index b737e8d..a71518a 100644
--- a/custom/scripts/sleep-and-wake.yaml
+++ b/custom/scripts/sleep-and-wake.yaml
@@ -48,7 +48,7 @@ sleep_and_wake:
value_template: '{{ mode == "hibernate" }}'
sequence:
- parallel:
- - service: media_player.media_stop
+ - service: media_player.media_pause
target:
entity_id: media_player.smartpi
# Wait until we fix both sleep and WOL on laptop
@@ -93,16 +93,22 @@ sleep_and_wake:
# - service: switch.turn_off
# target:
# entity_id: switch.plugs_office
+ - service: media_player.media_pause
+ target:
+ entity_id: media_player.smartpi
- service: switch.turn_off
target:
entity_id: switch.smart_power_strip_pro_socket_1
- service: switch.turn_off
target:
entity_id: switch.lights_all
- # Thats a better way to allow some time for leaving
- - service: switch.turn_on
- target:
- entity_id: switch.hall_lights_right
+# Don't do it here, but rather separately when leaving extended home zone
+# - service: switch.turn_on
+# target:
+# entity_id: switch.hall_lights_right
+ - service: input_boolean.turn_on
+ target:
+ entity_id: input_boolean.mode_house_sleep
- conditions:
- condition: template
@@ -114,9 +120,13 @@ sleep_and_wake:
- switch.lights_all
- switch.plugs_manual
- switch.plugs_controlled
+ # Thats a better way to allow some time for leaving
- service: switch.turn_on
target:
entity_id: switch.hall_lights_right
+ - service: input_boolean.turn_on
+ target:
+ entity_id: input_boolean.mode_house_hibernate
- conditions:
- condition: template
@@ -127,3 +137,8 @@ sleep_and_wake:
entity_id:
- switch.plugs_kitchen
- switch.bedroom_bedsidelampsocket
+ - service: input_boolean.turn_off
+ target:
+ entity_id:
+ - input_boolean.mode_house_sleep
+ - input_boolean.mode_house_hibernate
diff --git a/scripts.yaml b/scripts.yaml
index 59b3898..09cb932 100644
--- a/scripts.yaml
+++ b/scripts.yaml
@@ -95,3 +95,18 @@ kodi_sleep:
target:
entity_id: media_player.smartpi
mode: single
+turn_on_office_lights:
+ alias: turn_on_office_lights
+ sequence:
+ - parallel:
+ - service: light.turn_on
+ data:
+ brightness_pct: 100
+ kelvin: 6000
+ target:
+ entity_id: light.yeelight_color_0x7caaf86
+ - service: homeassistant.turn_off
+ data: {}
+ target:
+ entity_id: switch.lights_living_lustre
+ mode: single