From 2674a5226e13a68b1ee570aef552e78b7a7337b8 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 23 Jun 2023 04:44:16 +0400 Subject: Massive update: Few fixes, more new integrations & extensions --- .storage/core.area_registry | 5 + .storage/energy | 84 ++- .storage/input_boolean | 8 + .storage/lovelace.lovelace_climate | 127 +++- .storage/lovelace.lovelace_control | 51 +- .storage/lovelace.lovelace_kit | 101 +++ .storage/lovelace.lovelace_power | 212 ++++-- .storage/lovelace.lovelace_research | 62 +- .storage/lovelace.lovelace_status | 32 +- .storage/lovelace.lovelace_test | 421 +++++++++--- .storage/lovelace_dashboards | 8 + automations.yaml | 711 ++++++++++++++++++--- blueprints/automation/media/sven_scene_switch.yaml | 2 + blueprints/automation/motion/motion_switch.yaml | 3 +- .../motion/occupancy_tracking_restart.yaml | 170 +++++ blueprints/automation/motion/presence_switch.yaml | 256 ++++++++ blueprints/script/devices/aircon.yaml | 20 +- blueprints/script/devices/aircon_off.yaml | 37 ++ custom/scripts/play-playlist.yaml | 39 +- custom/scripts/sleep-and-wake.yaml | 16 +- custom/shell.yaml | 14 +- custom/template.yaml | 27 +- scripts.yaml | 16 + 23 files changed, 2079 insertions(+), 343 deletions(-) create mode 100644 .storage/lovelace.lovelace_kit create mode 100644 blueprints/automation/motion/occupancy_tracking_restart.yaml create mode 100644 blueprints/automation/motion/presence_switch.yaml create mode 100644 blueprints/script/devices/aircon_off.yaml diff --git a/.storage/core.area_registry b/.storage/core.area_registry index 4225896..cfdf7e7 100644 --- a/.storage/core.area_registry +++ b/.storage/core.area_registry @@ -43,6 +43,11 @@ "name": "Guestroom", "id": "guestroom", "picture": null + }, + { + "name": "KIT", + "id": "kit", + "picture": null } ] } diff --git a/.storage/energy b/.storage/energy index 5f2fb7e..ed73510 100644 --- a/.storage/energy +++ b/.storage/energy @@ -7,13 +7,6 @@ { "type": "grid", "flow_from": [ - { - "stat_energy_from": "sensor.living_office_energy", - "stat_cost": null, - "entity_energy_from": "sensor.living_office_energy", - "entity_energy_price": null, - "number_energy_price": null - }, { "stat_energy_from": "sensor.kitchen_oven_energy", "stat_cost": null, @@ -64,9 +57,9 @@ "number_energy_price": null }, { - "stat_energy_from": "sensor.living_tablelamp_energy", + "stat_energy_from": "sensor.living_tablelampsocket_energy", "stat_cost": null, - "entity_energy_from": "sensor.living_tablelamp_energy", + "entity_energy_from": "sensor.living_tablelampsocket_energy", "entity_energy_price": null, "number_energy_price": null }, @@ -83,6 +76,62 @@ "entity_energy_from": "sensor.bedroom_bedsidelampsocket_energy", "entity_energy_price": null, "number_energy_price": null + }, + { + "stat_energy_from": "sensor.kitchen_fridge_energy", + "stat_cost": null, + "entity_energy_from": "sensor.kitchen_fridge_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.hall_infra_energy", + "stat_cost": null, + "entity_energy_from": "sensor.hall_infra_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.office_smartpi_energy_total", + "stat_cost": null, + "entity_energy_from": "sensor.office_smartpi_energy_total", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.bedroom_router_energy", + "stat_cost": null, + "entity_energy_from": "sensor.bedroom_router_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.office_table_energy", + "stat_cost": null, + "entity_energy_from": "sensor.office_table_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.office_shelftop_energy", + "stat_cost": null, + "entity_energy_from": "sensor.office_shelftop_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.office_shelfbottom_energy", + "stat_cost": null, + "entity_energy_from": "sensor.office_shelfbottom_energy", + "entity_energy_price": null, + "number_energy_price": null + }, + { + "stat_energy_from": "sensor.office_aircon_energy", + "stat_cost": null, + "entity_energy_from": "sensor.office_aircon_energy", + "entity_energy_price": null, + "number_energy_price": null } ], "flow_to": [], @@ -105,9 +154,6 @@ { "stat_consumption": "sensor.office_aircon_energy" }, - { - "stat_consumption": "sensor.living_office_energy" - }, { "stat_consumption": "sensor.office_shelfbottom_energy" }, @@ -133,7 +179,19 @@ "stat_consumption": "sensor.bedroom_tablelamp_energy" }, { - "stat_consumption": "sensor.living_tablelamp_energy" + "stat_consumption": "sensor.kitchen_fridge_energy" + }, + { + "stat_consumption": "sensor.office_smartpi_energy_total" + }, + { + "stat_consumption": "sensor.living_tablelampsocket_energy" + }, + { + "stat_consumption": "sensor.bedroom_router_energy" + }, + { + "stat_consumption": "sensor.hall_infra_energy" } ] } diff --git a/.storage/input_boolean b/.storage/input_boolean index 6c81959..e302547 100644 --- a/.storage/input_boolean +++ b/.storage/input_boolean @@ -56,6 +56,14 @@ { "name": "Mode Office Hibernate", "id": "mode_office_hibernate" + }, + { + "name": "Mode Multiroom Manual", + "id": "mode_multiroom_manual" + }, + { + "name": "Mode Hall Manual", + "id": "mode_hall_manual" } ] } diff --git a/.storage/lovelace.lovelace_climate b/.storage/lovelace.lovelace_climate index b17f2fd..0eaa6df 100644 --- a/.storage/lovelace.lovelace_climate +++ b/.storage/lovelace.lovelace_climate @@ -6,7 +6,25 @@ "config": { "views": [ { - "title": "Home", + "theme": "Backend-selected", + "title": "Climate", + "type": "custom:grid-layout", + "layout": { + "max_cols": 4, + "grid-template-columns": "25% 25% 25% 25%", + "grid-template-rows": "auto", + "mediaquery": { + "(max-width: 600px)": { + "grid-template-columns": "100%" + }, + "(max-width: 1200px)": { + "grid-template-columns": "50% 50%" + }, + "(max-width: 1800px)": { + "grid-template-columns": "33% 33% 33%" + } + } + }, "cards": [ { "type": "vertical-stack", @@ -151,6 +169,113 @@ }, { "entity": "sensor.hall_smoke_temperature" + }, + { + "entity": "sensor.air_monitor_humidity" + }, + { + "entity": "sensor.air_monitor_temperature" + } + ] + } + ] + }, + { + "type": "vertical-stack", + "cards": [ + { + "type": "entities", + "entities": [ + { + "entity": "sensor.air_monitor_awair_score", + "name": "Score" + }, + { + "entity": "sensor.kitchen_gas_carbon_monoxide", + "name": "CO" + }, + { + "entity": "sensor.air_monitor_carbon_dioxide", + "name": "CO2" + }, + { + "entity": "sensor.air_monitor_pm2_5", + "name": "PM2.5" + }, + { + "entity": "sensor.air_monitor_volatile_organic_compounds", + "name": "VOCs" + }, + { + "entity": "sensor.air_monitor_humidity", + "name": "Humidity" + }, + { + "entity": "sensor.air_monitor_temperature", + "name": "Temperature" + } + ], + "title": "Air Quality" + }, + { + "type": "history-graph", + "title": "Air Quality (2h)", + "hours_to_show": 2, + "entities": [ + { + "entity": "sensor.air_monitor_awair_score", + "name": "Score" + }, + { + "entity": "sensor.kitchen_gas_carbon_monoxide", + "name": "CO" + }, + { + "entity": "sensor.air_monitor_carbon_dioxide", + "name": "CO2" + }, + { + "entity": "sensor.air_monitor_pm2_5", + "name": "PM2.5" + }, + { + "entity": "sensor.air_monitor_volatile_organic_compounds", + "name": "VOCs" + }, + { + "entity": "sensor.air_monitor_humidity", + "name": "Humidity" + }, + { + "entity": "sensor.air_monitor_temperature", + "name": "Temperature" + } + ] + }, + { + "type": "history-graph", + "title": "Air Quality (72h)", + "hours_to_show": 72, + "entities": [ + { + "entity": "sensor.air_monitor_awair_score", + "name": "Score" + }, + { + "entity": "sensor.kitchen_gas_carbon_monoxide", + "name": "CO" + }, + { + "entity": "sensor.air_monitor_carbon_dioxide", + "name": "CO2" + }, + { + "entity": "sensor.air_monitor_pm2_5", + "name": "PM2.5" + }, + { + "entity": "sensor.air_monitor_volatile_organic_compounds", + "name": "VOCs" } ] } diff --git a/.storage/lovelace.lovelace_control b/.storage/lovelace.lovelace_control index 6e87b1c..d8a9a6c 100644 --- a/.storage/lovelace.lovelace_control +++ b/.storage/lovelace.lovelace_control @@ -45,7 +45,18 @@ }, { "entity": "input_boolean.mode_bright", - "name": "Bright" + "name": "Bright Mode" + }, + { + "entity": "input_boolean.mode_multiroom_manual", + "name": "Multiroom/No Auto" + }, + { + "entity": "input_boolean.mode_hall_manual", + "name": "Keep Hall Lights" + }, + { + "type": "divider" }, { "entity": "input_boolean.mode_alone", @@ -69,18 +80,26 @@ "card": { "type": "entities", "entities": [ + { + "entity": "switch.smart_power_strip_pro_usb_1", + "name": "SmartPI" + }, + { + "entity": "switch.office_smartpi", + "name": "SmartPI/Monitor" + }, + { + "entity": "switch.bedroom_router", + "name": "Asgard" + }, { "entity": "switch.bedroom_roof", "name": "Roof" }, { - "entity": "switch.living_office", + "entity": "switch.hall_infra", "name": "Office" }, - { - "entity": "switch.smart_power_strip_pro_usb_1", - "name": "SmartPI" - }, { "entity": "switch.hall_camera", "name": "Camera" @@ -166,7 +185,7 @@ "name": "Bulb" }, { - "entity": "switch.living_tablelamp", + "entity": "switch.living_tablelampsocket", "name": "DeskLamp" } ], @@ -200,7 +219,11 @@ "type": "entities", "entities": [ { - "entity": "switch.smart_power_strip_pro_socket_1", + "entity": "switch.smart_power_strip_pro_socket_2", + "name": "UPS" + }, + { + "entity": "switch.smart_power_strip_pro_socket_2", "name": "Table" }, { @@ -211,6 +234,10 @@ "entity": "switch.smart_power_strip_pro_socket_4", "name": "Top" }, + { + "entity": "switch.office_svensocket", + "name": "Top/Sven" + }, { "entity": "switch.office_shelftop", "name": "Power" @@ -318,11 +345,15 @@ }, { "entity": "switch.kitchen_wash", - "title": "Wash" + "name": "Wash" }, { "entity": "switch.kitchen_teatable", - "title": "Table" + "name": "Table" + }, + { + "entity": "switch.kitchen_fridge", + "name": "Fridge" } ], "title": "Kitchen Plugs" diff --git a/.storage/lovelace.lovelace_kit b/.storage/lovelace.lovelace_kit new file mode 100644 index 0000000..5b24368 --- /dev/null +++ b/.storage/lovelace.lovelace_kit @@ -0,0 +1,101 @@ +{ + "version": 1, + "minor_version": 1, + "key": "lovelace.lovelace_kit", + "data": { + "config": { + "views": [ + { + "title": "KIT", + "cards": [ + { + "type": "vertical-stack", + "cards": [ + { + "type": "entities", + "entities": [ + { + "entity": "binary_sensor.kit_shelve_contact" + } + ], + "title": "KIT Security" + }, + { + "type": "history-graph", + "entities": [ + { + "entity": "binary_sensor.kit_shelve_contact", + "name": "Hall" + } + ], + "hours_to_show": 48, + "title": "Last 48 hours" + }, + { + "type": "logbook", + "entities": [ + "binary_sensor.kit_shelve_contact" + ], + "hours_to_show": 168, + "title": "Logs (week)" + } + ] + }, + { + "type": "vertical-stack", + "cards": [ + { + "type": "entities", + "title": "KIT Climate", + "entities": [ + { + "entity": "sensor.kit_temperature_temperature" + }, + { + "entity": "sensor.kit_temperature_humidity" + }, + { + "entity": "sensor.kit_temperature_pressure" + } + ] + }, + { + "type": "history-graph", + "entities": [ + { + "entity": "sensor.kit_temperature_temperature" + }, + { + "entity": "sensor.kit_temperature_humidity" + }, + { + "entity": "sensor.kit_temperature_pressure" + } + ], + "title": "Last 24 hours", + "hours_to_show": 24 + }, + { + "type": "history-graph", + "hours_to_show": 168, + "entities": [ + { + "entity": "sensor.kit_temperature_temperature" + }, + { + "entity": "sensor.kit_temperature_humidity" + }, + { + "entity": "sensor.kit_temperature_pressure" + } + ], + "title": "Last week" + } + ] + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/.storage/lovelace.lovelace_power b/.storage/lovelace.lovelace_power index b50b8ab..196e118 100644 --- a/.storage/lovelace.lovelace_power +++ b/.storage/lovelace.lovelace_power @@ -26,73 +26,97 @@ "cards": [ { "type": "entities", - "title": "Infrastructure", + "title": "Office", "entities": [ { - "entity": "sensor.bedroom_roof_power" + "entity": "sensor.office_table_power", + "name": "Table" }, { - "entity": "sensor.hall_camera_power" + "entity": "sensor.office_shelftop_power", + "name": "Top" }, { - "entity": "sensor.power_smartpi" + "entity": "sensor.office_shelfbottom_power", + "name": "Bottom" } ] }, { "type": "entities", - "title": "Office", + "title": "Appliances", "entities": [ { - "entity": "sensor.living_office_power" + "entity": "sensor.kitchen_oven_power", + "name": "Oven" + }, + { + "entity": "sensor.kitchen_wash_power", + "name": "Washers" + }, + { + "entity": "sensor.kitchen_teatable_power", + "name": "Tea Table" }, { - "entity": "sensor.office_shelfbottom_power" + "entity": "sensor.kitchen_fridge_power", + "name": "Fridge" }, { - "entity": "sensor.office_shelftop_power" + "entity": "sensor.office_aircon_power", + "name": "AirCon Office" }, { - "entity": "sensor.office_table_power" + "entity": "sensor.bedroom_aircon_power", + "name": "AirCon Bedroom" } ] }, { "type": "entities", - "title": "Appliances", + "title": "Lights", "entities": [ { - "entity": "sensor.kitchen_oven_power" - }, - { - "entity": "sensor.kitchen_wash_power" + "entity": "sensor.kitchen_ledlights_power", + "name": "Kitchen LEDs" }, { - "entity": "sensor.kitchen_teatable_power" + "entity": "sensor.bedroom_bedsidelampsocket_power", + "name": "Bedroom Bedside" }, { - "entity": "sensor.office_aircon_power" + "entity": "sensor.bedroom_tablelamp_power", + "name": "Bedroom Table" }, { - "entity": "sensor.bedroom_aircon_power" + "entity": "sensor.living_tablelampsocket_power", + "name": "Living Table" } ] }, { "type": "entities", - "title": "Lights", + "title": "Infrastructure", "entities": [ { - "entity": "sensor.kitchen_ledlights_power" + "entity": "sensor.office_smartpi_energy_power", + "name": "SmartPI" }, { - "entity": "sensor.bedroom_bedsidelampsocket_power" + "entity": "sensor.bedroom_router_power", + "name": "Asgard" }, { - "entity": "sensor.bedroom_tablelamp_power" + "entity": "sensor.bedroom_roof_power", + "name": "Roof" + }, + { + "entity": "sensor.hall_infra_power", + "name": "Hall" }, { - "entity": "sensor.living_tablelamp_power" + "entity": "sensor.hall_camera_power", + "name": "AubergineView" } ] }, @@ -103,35 +127,44 @@ "type": "history-graph", "entities": [ { - "entity": "sensor.bedroom_roof_power" + "entity": "sensor.office_table_power", + "name": "Table" + }, + { + "entity": "sensor.office_shelftop_power", + "name": "Top" }, { - "entity": "sensor.hall_camera_power" + "entity": "sensor.office_shelfbottom_power", + "name": "Bottom" } ], "hours_to_show": 24, - "title": "Infrastructure (24h)" + "title": "Office (24h)" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.bedroom_roof_power", - "detail": 2 + "entity": "sensor.office_table_power", + "detail": 2, + "name": "Table" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.hall_camera_power", - "detail": 2 + "entity": "sensor.office_shelftop_power", + "detail": 2, + "name": "Top" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.power_smartpi", - "detail": 2 + "entity": "sensor.office_shelfbottom_power", + "detail": 2, + "name": "Bottom" } ] }, @@ -142,45 +175,56 @@ "type": "history-graph", "entities": [ { - "entity": "sensor.office_shelfbottom_power" + "entity": "sensor.kitchen_oven_power", + "name": "Oven" }, { - "entity": "sensor.office_shelftop_power" + "entity": "sensor.kitchen_wash_power", + "name": "Washers" }, { - "entity": "sensor.office_table_power" + "entity": "sensor.kitchen_teatable_power", + "name": "Tea Table" + }, + { + "entity": "sensor.kitchen_fridge_power", + "name": "Fridge" } ], "hours_to_show": 24, - "title": "Office (24h)" + "title": "Kitchen (24h)" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.living_office_power", - "detail": 2 + "entity": "sensor.kitchen_oven_power", + "detail": 2, + "name": "Oven" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.office_shelfbottom_power", - "detail": 2 + "entity": "sensor.kitchen_wash_power", + "detail": 2, + "name": "Washers" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.office_shelftop_power", - "detail": 2 + "entity": "sensor.kitchen_teatable_power", + "detail": 2, + "name": "Tea Table" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.office_table_power", - "detail": 2 + "entity": "sensor.kitchen_fridge_power", + "detail": 2, + "name": "Fridge" } ] }, @@ -191,38 +235,32 @@ "type": "history-graph", "entities": [ { - "entity": "sensor.kitchen_oven_power" - }, - { - "entity": "sensor.kitchen_wash_power" + "entity": "sensor.office_aircon_power", + "name": "Office" }, { - "entity": "sensor.kitchen_teatable_power" + "entity": "sensor.bedroom_aircon_power", + "name": "Bedroom" } ], "hours_to_show": 24, - "title": "Kitchen (24h)" - }, - { - "hours_to_show": 24, - "graph": "line", - "type": "sensor", - "entity": "sensor.kitchen_oven_power", - "detail": 2 + "title": "Climate (24h)" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.kitchen_wash_power", - "detail": 2 + "entity": "sensor.office_aircon_power", + "detail": 2, + "name": "AirCon Office" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.kitchen_teatable_power", - "detail": 2 + "entity": "sensor.bedroom_aircon_power", + "detail": 2, + "name": "AirCon Bedroom" } ] }, @@ -233,28 +271,68 @@ "type": "history-graph", "entities": [ { - "entity": "sensor.office_aircon_power" + "entity": "sensor.office_smartpi_energy_power", + "name": "SmartPI" + }, + { + "entity": "sensor.bedroom_router_power", + "name": "Asgard" + }, + { + "entity": "sensor.bedroom_roof_power", + "name": "Roof" + }, + { + "entity": "sensor.hall_infra_power", + "name": "Hall" }, { - "entity": "sensor.bedroom_aircon_power" + "entity": "sensor.hall_camera_power", + "name": "AubergineView" } ], "hours_to_show": 24, - "title": "Climate (24h)" + "title": "Infrastructure (24h)" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.office_aircon_power", - "detail": 2 + "entity": "sensor.office_smartpi_energy_power", + "detail": 2, + "name": "SmartPI" }, { "hours_to_show": 24, "graph": "line", "type": "sensor", - "entity": "sensor.bedroom_aircon_power", - "detail": 2 + "entity": "sensor.bedroom_router_power", + "detail": 2, + "name": "Asgard" + }, + { + "hours_to_show": 24, + "graph": "line", + "type": "sensor", + "entity": "sensor.bedroom_roof_power", + "detail": 2, + "name": "Roof" + }, + { + "hours_to_show": 24, + "graph": "line", + "type": "sensor", + "entity": "sensor.hall_infra_power", + "detail": 2, + "name": "Hall Infra" + }, + { + "hours_to_show": 24, + "graph": "line", + "type": "sensor", + "entity": "sensor.hall_camera_power", + "detail": 2, + "name": "AubergineView" } ] } diff --git a/.storage/lovelace.lovelace_research b/.storage/lovelace.lovelace_research index 1e53158..c3178a7 100644 --- a/.storage/lovelace.lovelace_research +++ b/.storage/lovelace.lovelace_research @@ -43,6 +43,9 @@ { "entity": "sensor.entrance_vibrations_action" }, + { + "entity": "binary_sensor.balcony_doors" + }, { "entity": "binary_sensor.motions_all" }, @@ -63,12 +66,31 @@ }, { "entity": "binary_sensor.bathroom_leak_water_leak" + } + ], + "title": "Safety" + }, + { + "type": "entities", + "entities": [ + { + "entity": "binary_sensor.living_balcony_contact", + "name": "Living" + }, + { + "entity": "binary_sensor.kitchen_balcony_contact", + "name": "Kitchen" + }, + { + "entity": "binary_sensor.bedroom_balcony_contact", + "name": "Bedroom" }, { - "entity": "sensor.living_office_device_temperature" + "entity": "binary_sensor.guestroom_balcony_contact", + "name": "Guestroom" } ], - "title": "Safety" + "title": "Balcony" } ] }, @@ -102,8 +124,7 @@ "name": "Entrance Door" }, { - "entity": "binary_sensor.kitchen_door_contact", - "name": "Kitchen Door" + "entity": "binary_sensor.balcony_doors" }, { "entity": "binary_sensor.entrance_vibrations_vibration", @@ -137,13 +158,17 @@ "name": "Office" }, { - "entity": "binary_sensor.living_motions_occupancy", + "entity": "binary_sensor.presence_presence", "name": "Living" }, { "entity": "binary_sensor.bedroom_motions_occupancy", "name": "Bedroom" }, + { + "entity": "binary_sensor.guestroom_motions_occupancy", + "name": "Guestroom" + }, { "entity": "binary_sensor.kitchen_motions_occupancy", "name": "Kitchen" @@ -158,9 +183,36 @@ "type": "vertical-stack", "cards": [ { + "type": "entities", + "title": "Doors", + "entities": [ + { + "entity": "switch.hall_speakerphone", + "name": "Building Door" + } + ] + }, + { + "show_state": true, + "show_name": true, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.192_168_50_132" + }, + { + "show_state": true, + "show_name": true, + "camera_view": "auto", "type": "picture-entity", "entity": "camera.192_168_50_51" }, + { + "show_state": true, + "show_name": true, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.ovenview" + }, { "type": "logbook", "entities": [ diff --git a/.storage/lovelace.lovelace_status b/.storage/lovelace.lovelace_status index b259dfc..2e2faf3 100644 --- a/.storage/lovelace.lovelace_status +++ b/.storage/lovelace.lovelace_status @@ -11,6 +11,16 @@ { "type": "vertical-stack", "cards": [ + { + "type": "entities", + "title": "Locks", + "entities": [ + { + "entity": "switch.hall_speakerphone", + "name": "Halabyan24" + } + ] + }, { "type": "custom:restriction-card", "restrictions": { @@ -90,7 +100,7 @@ "name": "Office All" }, { - "entity": "switch.smart_power_strip_pro_socket_1", + "entity": "switch.smart_power_strip_pro_socket_2", "name": "Office Desk" }, { @@ -176,9 +186,17 @@ "entity": "binary_sensor.entrance_door_contact", "name": "Entrance" }, + { + "entity": "binary_sensor.balcony_doors", + "name": "Balconies" + }, { "entity": "binary_sensor.toilet_door_contact", "name": "Toilet" + }, + { + "entity": "binary_sensor.kit_shelve_contact", + "name": "KIT Shelve" } ] }, @@ -191,7 +209,7 @@ }, { "entity": "binary_sensor.kitchen_motions_occupancy", - "name": "Kitchen1" + "name": "Kitchen" }, { "entity": "binary_sensor.bathroom_motions_occupancy", @@ -219,13 +237,21 @@ { "type": "history-graph", "entities": [ + { + "entity": "binary_sensor.entrance_door_contact", + "name": "Entrance" + }, + { + "entity": "binary_sensor.balcony_doors", + "name": "Balconies" + }, { "entity": "binary_sensor.hall_motions_occupancy", "name": "Hall" }, { "entity": "binary_sensor.kitchen_motions_occupancy", - "name": "Kitchen1" + "name": "Kitchen" }, { "entity": "binary_sensor.bathroom_motions_occupancy", diff --git a/.storage/lovelace.lovelace_test b/.storage/lovelace.lovelace_test index fcdba8e..47039a9 100644 --- a/.storage/lovelace.lovelace_test +++ b/.storage/lovelace.lovelace_test @@ -147,6 +147,20 @@ { "type": "vertical-stack", "cards": [ + { + "type": "entities", + "entities": [ + { + "entity": "input_boolean.occupancy_toilet", + "name": "Toilet" + }, + { + "entity": "input_boolean.occupancy_bathroom", + "name": "Bathroom" + } + ], + "title": "Occupancy" + }, { "type": "entities", "entities": [ @@ -161,13 +175,21 @@ "entity": "binary_sensor.kitchen_motions_occupancy", "name": "Kitchen" }, + { + "entity": "binary_sensor.kitchen_presence_presence", + "name": "Presence" + }, { "type": "divider" }, { - "entity": "binary_sensor.bathroom_motions_occupancy", + "entity": "binary_sensor.bathroom_motions2_occupancy", "name": "Bathroom" }, + { + "entity": "binary_sensor.bathroom_motions_occupancy", + "name": "Door" + }, { "type": "divider" }, @@ -197,6 +219,10 @@ "entity": "binary_sensor.bedroom_motions_occupancy", "name": "Bedroom" }, + { + "entity": "binary_sensor.bedroom_presence_presence", + "name": "Presence" + }, { "entity": "binary_sensor.guestroom_motions_occupancy", "name": "Guestroom" @@ -215,25 +241,37 @@ "name": "Kitchen" }, { - "entity": "binary_sensor.bathroom_motions_occupancy", + "entity": "binary_sensor.kitchen_presence_presence", + "name": "Presence" + }, + { + "entity": "binary_sensor.bathroom_motions2_occupancy", "name": "Bathroom" }, + { + "entity": "binary_sensor.bathroom_motions_occupancy", + "name": "Door" + }, { "entity": "binary_sensor.toilet_motions_occupancy", "name": "Toilet" }, { "entity": "binary_sensor.toilet_door_contact", - "name": "Toilet Door" + "name": "Door" }, { - "entity": "binary_sensor.presence_occupancy", + "entity": "binary_sensor.presence_presence", "name": "Living" }, { "entity": "binary_sensor.bedroom_motions_occupancy", "name": "Bedroom" }, + { + "entity": "binary_sensor.bedroom_presence_presence", + "name": "Presence" + }, { "entity": "binary_sensor.guestroom_motions_occupancy", "name": "Guestroom" @@ -254,25 +292,37 @@ "name": "Kitchen" }, { - "entity": "binary_sensor.bathroom_motions_occupancy", + "entity": "binary_sensor.kitchen_presence_presence", + "name": "Presence" + }, + { + "entity": "binary_sensor.bathroom_motions2_occupancy", "name": "Bathroom" }, + { + "entity": "binary_sensor.bathroom_motions_occupancy", + "name": "Door" + }, { "entity": "binary_sensor.toilet_motions_occupancy", "name": "Toilet" }, { "entity": "binary_sensor.toilet_door_contact", - "name": "Toilet Door" + "name": "Door" }, { - "entity": "binary_sensor.presence_occupancy", + "entity": "binary_sensor.presence_presence", "name": "Living" }, { "entity": "binary_sensor.bedroom_motions_occupancy", "name": "Bedroom" }, + { + "entity": "binary_sensor.bedroom_presence_presence", + "name": "Presence" + }, { "entity": "binary_sensor.guestroom_motions_occupancy", "name": "Guestroom" @@ -286,11 +336,27 @@ "entities": [ { "entity": "binary_sensor.presence_presence", - "name": "Prsence" + "name": "Living" }, { "entity": "sensor.presence_target_distance", - "name": "Distance" + "name": "Living" + }, + { + "entity": "binary_sensor.bedroom_presence_presence", + "name": "Bedroom" + }, + { + "entity": "sensor.bedroom_presence_target_distance", + "name": "Bedroom" + }, + { + "entity": "binary_sensor.kitchen_presence_presence", + "name": "Kitchen" + }, + { + "entity": "sensor.kitchen_presence_target_distance", + "name": "Kitchen" } ], "hours_to_show": 1, @@ -301,11 +367,27 @@ "entities": [ { "entity": "binary_sensor.presence_presence", - "name": "Presence" + "name": "Living" }, { "entity": "sensor.presence_target_distance", - "name": "Distance" + "name": "Living" + }, + { + "entity": "binary_sensor.bedroom_presence_presence", + "name": "Bedroom" + }, + { + "entity": "sensor.bedroom_presence_target_distance", + "name": "Bedroom" + }, + { + "entity": "binary_sensor.kitchen_presence_presence", + "name": "Kitchen" + }, + { + "entity": "sensor.kitchen_presence_target_distance", + "name": "Kitchen" } ], "hours_to_show": 12, @@ -313,6 +395,158 @@ } ] }, + { + "type": "vertical-stack", + "cards": [ + { + "type": "entities", + "entities": [ + { + "entity": "sensor.bedroom_tablelamp_voltage", + "name": "L1/Lamp" + }, + { + "entity": "sensor.living_tablelampsocket_voltage", + "name": "L2/Lamp" + }, + { + "type": "divider" + }, + { + "entity": "sensor.hall_camera_voltage", + "name": "L1/Camera" + }, + { + "entity": "sensor.hall_infra_voltage", + "name": "L1/Infra" + }, + { + "type": "divider" + }, + { + "entity": "sensor.kitchen_oven_voltage", + "name": "L2/Kitchen/Oven" + }, + { + "entity": "sensor.kitchen_wash_voltage", + "name": "L2/Kitchen/Washers" + }, + { + "entity": "sensor.kitchen_teatable_voltage", + "name": "L2/Kitchen/Tea" + }, + { + "entity": "sensor.office_table_voltage", + "name": "L2/Office/Table" + }, + { + "entity": "sensor.office_shelftop_voltage", + "name": "L2/Office/Top" + }, + { + "entity": "sensor.office_shelfbottom_voltage", + "name": "L2/Office/Bottom" + }, + { + "entity": "sensor.office_smartpi_energy_voltage", + "name": "L2/Office/SmartPI" + }, + { + "type": "divider" + }, + { + "entity": "sensor.bedroom_aircon_voltage", + "name": "L1/AirCon" + }, + { + "entity": "sensor.office_aircon_voltage", + "name": "L2/AirCon" + } + ], + "title": "Voltages" + }, + { + "type": "history-graph", + "hours_to_show": 24, + "title": "L1 vs L2 (24h)", + "entities": [ + { + "entity": "sensor.bedroom_tablelamp_voltage", + "name": "L1/Lamp" + }, + { + "entity": "sensor.living_tablelampsocket_voltage", + "name": "L2/Lamp" + } + ] + }, + { + "type": "history-graph", + "hours_to_show": 24, + "title": "L1 (24h)", + "entities": [ + { + "entity": "sensor.bedroom_tablelamp_voltage", + "name": "L1/Lamp" + }, + { + "entity": "sensor.hall_camera_voltage", + "name": "L1/Camera" + }, + { + "entity": "sensor.hall_infra_voltage", + "name": "L1/Infra" + } + ] + }, + { + "type": "history-graph", + "hours_to_show": 24, + "title": "L2 (24h)", + "entities": [ + { + "entity": "sensor.living_tablelampsocket_voltage", + "name": "L2/Lamp" + }, + { + "entity": "sensor.kitchen_oven_voltage", + "name": "L2/Kitchen/Oven" + }, + { + "entity": "sensor.kitchen_wash_voltage", + "name": "L2/Kitchen/Washers" + }, + { + "entity": "sensor.kitchen_teatable_voltage", + "name": "L2/Kitchen/Tea" + }, + { + "entity": "sensor.office_table_voltage", + "name": "L2/Office/Table" + }, + { + "entity": "sensor.office_shelftop_voltage", + "name": "L2/Office/Top" + }, + { + "entity": "sensor.office_shelfbottom_voltage", + "name": "L2/Office/Bottom" + } + ] + }, + { + "type": "history-graph", + "hours_to_show": 24, + "title": "Strange (24h)", + "entities": [ + { + "entity": "sensor.office_smartpi_energy_voltage", + "name": "L2/Office/SmartPI" + } + ] + } + ] + }, { "type": "vertical-stack", "cards": [ @@ -359,6 +593,86 @@ } ] }, + { + "type": "entities", + "entities": [ + { + "entity": "sensor.hall_motions_illuminance_lux", + "name": "Hall" + }, + { + "entity": "sensor.kitchen_motions_illuminance_lux", + "name": "Kitchen" + }, + { + "entity": "sensor.presence_illuminance_lux", + "name": "Living" + }, + { + "entity": "sensor.bedroom_motions_illuminance_lux", + "name": "Bedroom" + }, + { + "entity": "sensor.guestroom_motions_illuminance_lux", + "name": "Guestroom" + } + ], + "title": "Illuminance" + }, + { + "type": "history-graph", + "entities": [ + { + "entity": "sensor.hall_motions_illuminance_lux", + "name": "Hall" + }, + { + "entity": "sensor.kitchen_motions_illuminance_lux", + "name": "Kitchen" + }, + { + "entity": "sensor.presence_illuminance_lux", + "name": "Living" + }, + { + "entity": "sensor.bedroom_motions_illuminance_lux", + "name": "Bedroom" + }, + { + "entity": "sensor.guestroom_motions_illuminance_lux", + "name": "Guestroom" + } + ], + "hours_to_show": 1, + "title": "Illuminance (1h)" + }, + { + "type": "history-graph", + "entities": [ + { + "entity": "sensor.hall_motions_illuminance_lux", + "name": "Hall" + }, + { + "entity": "sensor.kitchen_motions_illuminance_lux", + "name": "Kitchen" + }, + { + "entity": "sensor.presence_illuminance_lux", + "name": "Living" + }, + { + "entity": "sensor.bedroom_motions_illuminance_lux", + "name": "Bedroom" + }, + { + "entity": "sensor.guestroom_motions_illuminance_lux", + "name": "Guestroom" + } + ], + "hours_to_show": 12, + "title": "Illuminance (12h)" + }, { "type": "history-graph", "entities": [ @@ -573,91 +887,6 @@ } ] } - }, - { - "type": "vertical-stack", - "cards": [ - { - "type": "entities", - "entities": [ - { - "entity": "sensor.hall_motions_illuminance_lux", - "name": "Hall" - }, - { - "entity": "sensor.kitchen_motions_illuminance_lux", - "name": "Kitchen" - }, - { - "entity": "sensor.presence_illuminance_lux", - "name": "Living" - }, - { - "entity": "sensor.bedroom_motions_illuminance_lux", - "name": "Bedroom" - }, - { - "entity": "sensor.guestroom_motions_illuminance_lux", - "name": "Guestroom" - } - ], - "title": "Illuminance" - }, - { - "type": "history-graph", - "entities": [ - { - "entity": "sensor.hall_motions_illuminance_lux", - "name": "Hall" - }, - { - "entity": "sensor.kitchen_motions_illuminance_lux", - "name": "Kitchen" - }, - { - "entity": "sensor.presence_illuminance_lux", - "name": "Living" - }, - { - "entity": "sensor.bedroom_motions_illuminance_lux", - "name": "Bedroom" - }, - { - "entity": "sensor.guestroom_motions_illuminance_lux", - "name": "Guestroom" - } - ], - "hours_to_show": 1, - "title": "Illuminance (1h)" - }, - { - "type": "history-graph", - "entities": [ - { - "entity": "sensor.hall_motions_illuminance_lux", - "name": "Hall" - }, - { - "entity": "sensor.kitchen_motions_illuminance_lux", - "name": "Kitchen" - }, - { - "entity": "sensor.presence_illuminance_lux", - "name": "Living" - }, - { - "entity": "sensor.bedroom_motions_illuminance_lux", - "name": "Bedroom" - }, - { - "entity": "sensor.guestroom_motions_illuminance_lux", - "name": "Guestroom" - } - ], - "hours_to_show": 12, - "title": "Illuminance (12h)" - } - ] } ] } diff --git a/.storage/lovelace_dashboards b/.storage/lovelace_dashboards index 4e4a887..1e3e35f 100644 --- a/.storage/lovelace_dashboards +++ b/.storage/lovelace_dashboards @@ -57,6 +57,14 @@ "mode": "storage", "url_path": "lovelace-test", "id": "lovelace_test" + }, + { + "show_in_sidebar": true, + "title": "KIT", + "require_admin": false, + "mode": "storage", + "url_path": "lovelace-kit", + "id": "lovelace_kit" } ] } diff --git a/automations.yaml b/automations.yaml index 38cc979..1b14bd5 100644 --- a/automations.yaml +++ b/automations.yaml @@ -42,7 +42,10 @@ minutes: 0 seconds: 0 id: Away - condition: [] + condition: + - condition: state + entity_id: input_boolean.mode_hall_manual + state: 'off' action: - choose: - conditions: @@ -94,8 +97,8 @@ entity_id: switch.kitchen_lights_left domain: switch - type: turn_off - device_id: 558ce3c924f9478aad68cb5b98f05ecc - entity_id: switch.kitchen_lights_center + device_id: dd315d1369ab360867d7daba78d2aebd + entity_id: switch.kitchen_ledlights domain: switch - if: - condition: state @@ -156,7 +159,7 @@ device_id: bf45f1d630db6e2aa1307866603f548a entity_id: light.smart_light domain: light - - service: shell_command.sound_living + - service: shell_command.sound_bedroom_off data: {} off_click: - type: turn_off @@ -338,6 +341,30 @@ - condition: trigger id: left_hold sequence: + - service: script.bedroom_aircon + data: {} + - conditions: + - condition: trigger + id: right + sequence: + - service: shell_command.sound_bedroom_on + data: {} + - service: media_player.media_play_pause + target: + entity_id: media_player.smartpi + data: {} + - conditions: + - condition: trigger + id: right_dbl + sequence: + - service: script.play_playlist + data: + media_player: media_player.smartpi + playlist: darksoft + - conditions: + - condition: trigger + id: right_hold + sequence: - service: input_button.press data: {} target: @@ -370,30 +397,6 @@ media_content_id: media-source://dlna_dms/asgard/:64$0$5$1 - media_content_type: object.container.storageFolder media_content_id: media-source://dlna_dms/asgard/:64$0$5$1$0 - - conditions: - - condition: trigger - id: right - sequence: - - service: shell_command.sound_combined - data: {} - - service: media_player.media_play_pause - target: - entity_id: media_player.smartpi - data: {} - - conditions: - - condition: trigger - id: right_dbl - sequence: - - service: script.play_playlist - data: - media_player: media_player.smartpi - playlist: darksoft - - conditions: - - condition: trigger - id: right_hold - sequence: - - service: script.bedroom_aircon - data: {} default: - service: input_button.press data: {} @@ -538,12 +541,101 @@ - condition: template value_template: '{{ trigger.event.data.command == "/camera" }} ' sequence: - - service: telegram_bot.send_photo - data: - disable_notification: true - caption: AubergineView - url: http://smartpi:8123{{ state_attr("camera.192_168_50_51", "entity_picture") - }} + - choose: + - conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 1 }}' + - condition: template + value_template: '{{ trigger.event.data.args[0] in ["hall", "aubergine", + "aubergineview" ] }}' + sequence: + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: AubergineView + url: http://smartpi:8123{{ state_attr("camera.192_168_50_51", "entity_picture") + }} + - conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 1 }}' + - condition: template + value_template: '{{ trigger.event.data.args[0] in ["door", "peep", "peepview" + ] }}' + sequence: + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: PeepView + url: http://smartpi:8123{{ state_attr("camera.192_168_50_132", "entity_picture") + }} + - conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 1 }}' + - condition: template + value_template: '{{ trigger.event.data.args[0] in ["kitchen", "oven", + "kitchenview", "ovenview" ] }}' + sequence: + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: OvenView + url: http://smartpi:8123{{ state_attr("camera.ovenview", "entity_picture") + }} + - conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 0 }}' + sequence: + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: PeepView + url: http://smartpi:8123{{ state_attr("camera.192_168_50_132", "entity_picture") + }} + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: OvenView + url: http://smartpi:8123{{ state_attr("camera.ovenview", "entity_picture") + }} + - service: telegram_bot.send_photo + data: + disable_notification: true + caption: AubergineView + url: http://smartpi:8123{{ state_attr("camera.192_168_50_51", "entity_picture") + }} + default: + - service: notify.smartpi + data: + message: 'Unknown camera: {{ trigger.event.data.args[0] }}' + - conditions: + - condition: template + value_template: '{{ trigger.event.data.command == "/open" }} ' + sequence: + - choose: + - conditions: + - condition: or + conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 0 }}' + - condition: and + conditions: + - condition: template + value_template: '{{ trigger.event.data.args|length == 1 }}' + - condition: template + value_template: '{{ trigger.event.data.args[0] in ["h24", "halabyan24", + "building", "home" ] }}' + sequence: + - service: switch.turn_on + data: {} + target: + entity_id: switch.hall_speakerphone + - service: notify.smartpi + data: + message: Openning Halabyan 24 building door + default: + - service: notify.smartpi + data: + message: 'Unknown lock: {{ trigger.event.data.args[0] }}' default: - service: notify.smartpi data: @@ -551,7 +643,7 @@ {{ trigger.event.data.args }}' mode: single - id: '1672608894803' - alias: 'Hall: Camera Switch' + alias: 'Hall: Hall Camera Switch' description: '' use_blueprint: path: lights/light_switch.yaml @@ -578,10 +670,42 @@ data: mode: sleep target: house - - service: input_button.press - data: {} + - if: + - condition: state + entity_id: binary_sensor.balcony_doors + state: 'on' + then: + - service: light.turn_on + target: + entity_id: light.aqara_hub_m1s_426c + data: + brightness: 100 + rgb_color: + - 255 + - 0 + - 0 + - service: input_button.press + data: {} + target: + entity_id: input_button.button_confirm + else: + - service: light.turn_on + target: + entity_id: light.aqara_hub_m1s_426c + data: + brightness: 100 + rgb_color: + - 0 + - 255 + - 0 + - delay: + hours: 0 + minutes: 0 + seconds: 30 + milliseconds: 0 + - service: light.turn_off target: - entity_id: input_button.button_confirm + entity_id: light.aqara_hub_m1s_426c - id: '1672627582279' alias: 'Hall: Kitchen Combo' description: '' @@ -604,7 +728,7 @@ - switch.entrance_lights_center data: {} - id: '1672629824242' - alias: 'Hall: Away/Security Mode Switch' + alias: 'Hall: Hall Away/Security Mode Switch' description: '' use_blueprint: path: lights/light_switch.yaml @@ -616,6 +740,7 @@ - service: switch.turn_on target: entity_id: switch.hall_lights_center + data: {} - service: input_button.press data: {} target: @@ -674,20 +799,18 @@ knob: sensor.office_knob_action toggle: - if: - - condition: device - type: is_on - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - condition: state + entity_id: switch.living_tablelampsocket + state: 'on' then: - service: switch.turn_off data: {} target: entity_id: switch.lights_living_lustre - - type: toggle - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - service: switch.toggle + data: {} + target: + entity_id: switch.living_tablelampsocket brightness: input_number.knob_office_brightness0 temperature: input_number.knob_office_temperature0 hue: input_number.knob_office_hue0 @@ -721,10 +844,9 @@ entity_id: switch.lights_living_lustre state: 'on' then: - - type: turn_off - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - service: switch.turn_off + target: + entity_id: switch.living_tablelampsocket - service: homeassistant.toggle data: {} target: @@ -747,17 +869,17 @@ on_click: - if: - condition: state - entity_id: switch.living_tablelamp + entity_id: switch.living_tablelampsocket state: 'on' then: - - type: turn_off - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - service: switch.turn_off + data: {} + target: + entity_id: switch.living_tablelampsocket else: - if: - condition: state - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 state: 'off' then: - parallel: @@ -777,20 +899,19 @@ - service: script.turn_on_office_lights data: {} off_click: - - type: turn_on - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - service: switch.turn_on + data: {} + target: + entity_id: switch.living_tablelampsocket dblclick: - if: - condition: state entity_id: switch.lights_living_lustre state: 'on' then: - - type: turn_off - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - service: switch.turn_off + target: + entity_id: switch.living_tablelampsocket - service: homeassistant.toggle data: {} target: @@ -800,7 +921,7 @@ longclick: - if: - condition: state - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 state: 'off' then: - service: script.sleep_and_wake @@ -859,7 +980,7 @@ input: light_target: - switch.kitchen_lights_left - - switch.kitchen_lights_center + - switch.kitchen_ledlights motion_entity: binary_sensor.motions_kitchen illumination_test: sensor illuminance_entity: sensor.kitchen_motions_illuminance_lux @@ -900,10 +1021,15 @@ brightness_pct: 100 off_click: - parallel: - - type: turn_off - device_id: 5c1c363a6825ad5a006f3bb84bb104ce - entity_id: switch.hall_lights_left - domain: switch + - if: + - condition: state + entity_id: input_boolean.mode_hall_manual + state: 'off' + then: + - type: turn_off + device_id: 5c1c363a6825ad5a006f3bb84bb104ce + entity_id: switch.hall_lights_left + domain: switch - type: turn_off device_id: 87071fc9d8fb9ebbccb145f5642c7404 entity_id: light.aqara_hub_m1s_426c @@ -1086,14 +1212,23 @@ minutes: 0 seconds: 0 id: sleep - condition: [] + condition: + - type: is_not_present + condition: device + device_id: 363c35226e1deea236d4a555c465522d + entity_id: binary_sensor.presence_presence + domain: binary_sensor + for: + hours: 0 + minutes: 5 + seconds: 0 action: - choose: - conditions: - condition: trigger id: sleep - condition: state - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 state: 'on' sequence: - service: script.sleep_and_wake @@ -1107,16 +1242,26 @@ description: '' trigger: - platform: device - type: turned_off + type: changed_states device_id: 558ce3c924f9478aad68cb5b98f05ecc entity_id: switch.kitchen_lights_left domain: switch condition: [] action: - - type: turn_off - device_id: 558ce3c924f9478aad68cb5b98f05ecc - entity_id: switch.kitchen_lights_center - domain: switch + - if: + - condition: state + entity_id: switch.kitchen_lights_left + state: 'on' + then: + - type: turn_on + device_id: dd315d1369ab360867d7daba78d2aebd + entity_id: switch.kitchen_ledlights + domain: switch + else: + - type: turn_off + device_id: dd315d1369ab360867d7daba78d2aebd + entity_id: switch.kitchen_ledlights + domain: switch mode: single - id: '1673212686198' alias: 'Office: Sven' @@ -1204,21 +1349,19 @@ value_template: '{{ current_num == 0 }}' sequence: - if: - - condition: device - type: is_on - device_id: 32787706a8ff87380633b7c817057935 - entity_id: switch.living_tablelamp - domain: switch + - condition: state + entity_id: switch.living_tablelampsocket + state: 'on' 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 + - service: switch.toggle + target: + entity_id: switch.living_tablelampsocket + data: {} default: [] - id: '1674510035217' alias: 'Network: Backup' @@ -1275,6 +1418,8 @@ no_motion_wait: 60 on_cond_should_be_off: - switch.lights_guest + off_cond_should_be_off: + - input_boolean.mode_hall_manual - id: '1680829267506' alias: 'Motions: Living' description: '' @@ -1314,6 +1459,8 @@ target: entity_id: media_player.smartpi data: {} + - service: shell_command.sound_living + data: {} off_click: - parallel: - service: script.sleep_and_wake @@ -1337,11 +1484,17 @@ - platform: state entity_id: - input_boolean.mode_alone + id: alone + - platform: state + entity_id: - input_boolean.mode_guests + id: guests condition: [] action: - choose: - conditions: + - condition: trigger + id: guests - condition: state entity_id: input_boolean.mode_guests state: 'on' @@ -1351,6 +1504,8 @@ target: entity_id: automation.motions_guestroom - conditions: + - condition: trigger + id: guests - condition: state entity_id: input_boolean.mode_guests state: 'off' @@ -1360,24 +1515,35 @@ target: entity_id: automation.motions_guestroom - conditions: + - condition: trigger + id: alone - condition: state entity_id: input_boolean.mode_alone state: 'on' sequence: - - service: automation.turn_on - data: {} - target: - entity_id: automation.motions_bedroom + - parallel: + - service: automation.turn_on + data: {} + target: + entity_id: + - automation.motions_bedroom_v2 - conditions: + - condition: trigger + id: alone - condition: state entity_id: input_boolean.mode_alone state: 'off' sequence: - - service: automation.turn_off - data: {} - target: - entity_id: automation.motions_bedroom - mode: single + - parallel: + - service: input_boolean.turn_on + data: {} + target: + entity_id: input_boolean.mode_multiroom_manual + - service: automation.turn_off + data: {} + target: + entity_id: + - automation.motions_bedroom_v2 - id: '1680923844207' alias: 'Motions: Bedroom from Hall' description: '' @@ -1395,9 +1561,6 @@ - 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.bedroom_bedsidelamp @@ -1532,10 +1695,10 @@ entity_id: media_player.smartpi type: is_playing then: - - service: shell_command.sound_living + - service: shell_command.sound_bedroom_off data: {} else: - - service: shell_command.sound_combined + - service: shell_command.sound_bedroom_on data: {} - service: media_player.media_play_pause target: @@ -1563,3 +1726,347 @@ target: entity_id: input_button.button_confirm mode: single +- id: '1686356828884' + alias: 'Motions: Kitchen Music' + description: '' + trigger: + - type: motion + platform: device + device_id: c021c60965f213e2de888cadc3c48a8a + entity_id: binary_sensor.kitchen_motions_occupancy + domain: binary_sensor + id: 'on' + - type: no_motion + platform: device + device_id: c021c60965f213e2de888cadc3c48a8a + entity_id: binary_sensor.kitchen_motions_occupancy + domain: binary_sensor + for: + hours: 0 + minutes: 4 + seconds: 0 + id: 'off' + - type: not_present + platform: device + device_id: f669195bbff38ba24c6cbe552fc9f180 + entity_id: binary_sensor.bedroom_presence_presence + domain: binary_sensor + for: + hours: 0 + minutes: 2 + seconds: 0 + id: bedroom + condition: + - condition: state + entity_id: input_boolean.mode_multiroom_manual + state: 'off' + action: + - choose: + - conditions: + - condition: trigger + id: 'on' + sequence: + service: shell_command.sound_kitchen_on + data: {} + - conditions: + - condition: trigger + id: 'off' + sequence: + - if: + - condition: state + entity_id: binary_sensor.presence_multiroom_sound + state: 'off' + then: + - service: shell_command.sound_kitchen_off + data: {} + - conditions: + - condition: trigger + id: bedroom + sequence: + - if: + - condition: state + entity_id: binary_sensor.presence_multiroom_sound + state: 'off' + then: + - service: shell_command.sound_bedroom_off + data: {} + mode: single +- id: '1686359598932' + alias: 'Hall: Kitchen Music' + description: '' + use_blueprint: + path: lights/light_switch.yaml + input: + switch: switch.kitchen_lights_center + light: switch.lights_dummy + on_click: + - service: shell_command.sound_kitchen_on + data: {} + off_click: + - service: shell_command.sound_kitchen_off + data: {} + dblclick: + - service: input_boolean.turn_on + data: {} + target: + entity_id: input_boolean.mode_multiroom_manual +- id: '1686693695647' + alias: 'Motions: Bedroom v2' + description: '' + use_blueprint: + path: motion/presence_switch.yaml + input: + light_target: + - switch.bedroom_lights_left + - switch.bedroom_lights_center + motion_entity: binary_sensor.bedroom_motions_occupancy + presence_entity: binary_sensor.bedroom_presence_presence + illumination_test: sun + illuminance_entity: sensor.kitchen_motions_illuminance_lux + lux_threshold: 60 + no_motion_wait: 300 + on_cond_should_be_off: + - switch.lights_bedroom + on_cond_should_be_on: + - binary_sensor.hall_motions_occupancy + off_cond_should_be_off: [] + on_click: + - service: automation.turn_on + data: {} + target: + entity_id: automation.motions_bedroom_from_hall + off_click: + - service: script.turn_off_bedroom_lights + data: {} + off_cond_should_be_on: + - switch.lights_bedroom + - switch.lights_bedroom_manual +- id: '1686879286738' + alias: Time + description: '' + trigger: + - platform: time + at: '11:00:00' + id: morning + - platform: time + at: '21:00:00' + id: evening + condition: [] + action: + - choose: + - conditions: + - condition: trigger + id: morning + sequence: + - parallel: + - if: + - condition: state + entity_id: input_boolean.mode_alone + state: 'on' + then: + - service: input_boolean.turn_off + data: {} + target: + entity_id: input_boolean.mode_multiroom_manual + - conditions: + - condition: trigger + id: evening + sequence: + - parallel: + - service: input_boolean.turn_on + data: {} + target: + entity_id: input_boolean.mode_multiroom_manual + mode: single +- id: '1687120402112' + alias: 'Hall: Hall Manual Mode' + description: '' + use_blueprint: + path: lights/light_switch.yaml + input: + switch: switch.hall_lights_center + light: input_boolean.mode_hall_manual + delay: 0 + on_click: + - service: switch.turn_on + data: {} + target: + entity_id: + - switch.entrance_lights_center + - switch.hall_lights_left + post_action: [] +- id: '1687206114066' + alias: Speakerphone + description: '' + trigger: + - platform: device + type: turned_on + device_id: 529c8fc6c1f99633f26bb254c97f2ab7 + entity_id: switch.hall_speakerphone + domain: switch + for: + hours: 0 + minutes: 0 + seconds: 40 + condition: [] + action: + - type: turn_off + device_id: 529c8fc6c1f99633f26bb254c97f2ab7 + entity_id: switch.hall_speakerphone + domain: switch + mode: single +- id: '1687208079529' + alias: 'Motions: Bedroom AirCon' + description: '' + trigger: + - type: not_present + platform: device + device_id: f669195bbff38ba24c6cbe552fc9f180 + entity_id: binary_sensor.bedroom_presence_presence + domain: binary_sensor + for: + hours: 0 + minutes: 30 + seconds: 0 + condition: [] + action: + - service: scene.turn_on + target: + entity_id: scene.hyundai_aircon2_off + metadata: {} + mode: single +- id: '1687227285061' + alias: 'Hall: Hall Camera ' + description: '' + trigger: + - platform: state + entity_id: + - input_boolean.mode_away + condition: [] + action: + - choose: + - conditions: + - condition: state + entity_id: input_boolean.mode_away + state: 'on' + sequence: + - parallel: + - type: turn_on + device_id: 26d4f61d01f392350cd4375fcc3dbf50 + entity_id: switch.hall_camera + domain: switch + - conditions: + - condition: state + entity_id: input_boolean.mode_away + state: 'off' + sequence: + - parallel: + - type: turn_off + device_id: 26d4f61d01f392350cd4375fcc3dbf50 + entity_id: switch.hall_camera + domain: switch + mode: single +- id: '1687256985181' + alias: Power Outtage + description: '' + trigger: + - platform: state + entity_id: + - switch.hall_camera + from: unavailable + id: hall_camera + for: + hours: 0 + minutes: 2 + seconds: 0 + - platform: state + entity_id: + - light.yeelight_color_0x7caaf86 + from: unavailable + id: office_bulb + for: + hours: 0 + minutes: 2 + seconds: 0 + condition: [] + action: + - choose: + - conditions: + - condition: or + conditions: + - condition: trigger + id: hall_camera + - condition: trigger + id: office_bulb + sequence: + - service: homeassistant.turn_on + data: {} + target: + entity_id: switch.plugs_infrastructure + - type: turn_off + device_id: 95931a9049849e575f2de543adf111eb + entity_id: light.yeelight_color_0x7caaf86 + domain: light + - type: turn_off + device_id: bf45f1d630db6e2aa1307866603f548a + entity_id: light.smart_light + domain: light + - if: + - condition: state + entity_id: input_boolean.mode_away + state: 'on' + then: + - type: turn_on + device_id: 26d4f61d01f392350cd4375fcc3dbf50 + entity_id: switch.hall_camera + domain: switch + else: + - type: turn_off + device_id: 26d4f61d01f392350cd4375fcc3dbf50 + entity_id: switch.hall_camera + domain: switch + default: [] + mode: single +- id: '1687314395271' + alias: 'Motions: Bathroom v2' + description: '' + use_blueprint: + path: motion/occupancy_tracking_restart.yaml + input: + entrance: binary_sensor.bathroom_motions_occupancy + inside: binary_sensor.bathroom_motions2_occupancy + light: switch.bathroom_lights_left + occupancy: input_boolean.occupancy_bathroom + on_action: + - service: switch.turn_on + data: {} + target: + entity_id: switch.bathroom_lights_left + reentry_wait: 10 + reentry_timeout: 90 +- id: '1687317165822' + alias: Infrastructure + description: '' + trigger: + - platform: state + entity_id: + - switch.plugs_infrastructure + to: 'off' + id: 'off' + for: + hours: 0 + minutes: 5 + seconds: 0 + condition: [] + action: + - choose: + - conditions: + - condition: trigger + id: 'off' + sequence: + - service: homeassistant.turn_on + data: {} + target: + entity_id: switch.plugs_infrastructure + default: [] + mode: single diff --git a/blueprints/automation/media/sven_scene_switch.yaml b/blueprints/automation/media/sven_scene_switch.yaml index 8f54d8d..fe51918 100644 --- a/blueprints/automation/media/sven_scene_switch.yaml +++ b/blueprints/automation/media/sven_scene_switch.yaml @@ -78,6 +78,7 @@ action: - condition: trigger id: single1 sequence: + - service: shell_command.sound_living - service: media_player.media_play_pause target: entity_id: !input media_player @@ -86,6 +87,7 @@ action: - condition: trigger id: double1 sequence: + - service: shell_command.sound_living - service: scene.turn_on target: entity_id: !input power_scene diff --git a/blueprints/automation/motion/motion_switch.yaml b/blueprints/automation/motion/motion_switch.yaml index dbc5374..67e62b6 100644 --- a/blueprints/automation/motion/motion_switch.yaml +++ b/blueprints/automation/motion/motion_switch.yaml @@ -1,5 +1,5 @@ blueprint: - name: Motion-activated Switch + name: Motion-activated Switch (obsolete by presensece_switch) description: Turn on a light when motion is detected and surroundings are dark domain: automation input: @@ -215,6 +215,7 @@ action: match: any state: 'off' sequence: +# Race here: state might change between 'condition' check and 'wait_for_trigger'. We might be better to just finish the loop and check once more before the actions... - wait_for_trigger: - platform: state entity_id: !input on_cond_should_be_on diff --git a/blueprints/automation/motion/occupancy_tracking_restart.yaml b/blueprints/automation/motion/occupancy_tracking_restart.yaml new file mode 100644 index 0000000..27855b9 --- /dev/null +++ b/blueprints/automation/motion/occupancy_tracking_restart.yaml @@ -0,0 +1,170 @@ +# 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 with restart mode + description: Only mode differs, intended for cases where new inside trigger unlikely after exit triggered (this might happen in small places like e.g. toilet where motion might be detected after we have already openned the door) + 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: restart + +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 '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" + + # Occupancy goes 'on' once movement inside is detected (we can't rely on trigger as inside & entrance might coincide) + - conditions: +# - condition: trigger +# id: "inside" + - 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: trigger +# id: "entrance" + - 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" + + default: [] diff --git a/blueprints/automation/motion/presence_switch.yaml b/blueprints/automation/motion/presence_switch.yaml new file mode 100644 index 0000000..eaaf1a6 --- /dev/null +++ b/blueprints/automation/motion/presence_switch.yaml @@ -0,0 +1,256 @@ +blueprint: + name: Switch controlled by combination of motion and presence sensors + description: Turns on light only on large movements, but turns off only if no movements in the room detected + domain: automation + input: + motion_entity: + name: Motion Sensor (or presence sensor if separate motion sensor is not available) + selector: + entity: + domain: binary_sensor +# device_class: motion + + presence_entity: + name: Presence Sensor + description: Presence sensor (or motion sensor if presence sensor is not available) + selector: + entity: + domain: binary_sensor +# device_class: motion + + door_entity: + name: Door Contact + description: Additionally trigger if door opens while no motion detected + default: [] + selector: + entity: + multiple: true + domain: binary_sensor +# device_class: contact + + light_target: + name: Light Target + default: [] + selector: + entity: + multiple: true + domain: [switch, light] + + no_motion_wait: + name: Wait time + description: Time to leave the light on after last motion is detected. + default: 120 + selector: + number: + min: 0 + max: 3600 + unit_of_measurement: seconds + + +############## Light based ########################## + illumination_test: + name: Illumination Test + description: Select how to check if existing illumination is sufficient + default: sun + selector: + select: + options: + - label: Illuminance Sensor + value: sensor + - label: Sun Elevation + value: sun + - label: Always turn on lights + value: none + illuminance_entity: + name: Illuminance Sensor + description: Sensor providing information about illumination in the room (keep empty to rely on sun position) + selector: + entity: + domain: sensor + device_class: illuminance + lux_threshold: + name: LUX threshold + description: Threshold bellow which we consider that lighting is needed + default: 40 + selector: + number: + min: 10 + max: 1000 + unit_of_measurement: lux + sun_elevation: + name: Sun Elevation + description: Sun elevation (suggested between 0 and -6) when dusks settles and we need to turn on lights) + default: 0 + selector: + number: + min: -30 + max: 30 + unit_of_measurement: ° + +############################# Preconditions ######################################### + +# Also should be off for some time, otherwise it can get switched back on once we turn light off + on_cond_should_be_off: + name: Switch-on precondition - entities which must be off + description: E.g. all lights should be off in the room + default: [] + selector: + entity: + multiple: true + domain: [ input_boolean, binary_sensor, switch, light ] + +# We can wait a bit if events slightly desynchronized and motion in hall noticed later than in the room + on_cond_should_be_on: + name: Switch-on precondition - entities which must be on + description: E.g. we only turn light if entering from the hall + default: [] + selector: + entity: + multiple: true + domain: [ input_boolean, binary_sensor, switch, light ] + + off_cond_should_be_off: + name: Switch-off precondition - entities which must be off + description: E.g. if some lights or devices are on, we assume room is still occupied + default: [] + selector: + entity: + multiple: true + domain: [ input_boolean, binary_sensor, switch, light ] + + off_cond_should_be_on: + name: Switch-off precondition - entities which must be on + description: E.g. motion in coridor should be detected + default: [] + selector: + entity: + multiple: true + domain: [ input_boolean, binary_sensor, switch, light ] + + +############################# Custom Actions ##################################### + + on_click: + name: on_click + description: Additional actions to perform while turning on master light + default: [] + selector: + action: + off_click: + name: off_click + description: Additional actions to perform while turning off master light + default: [] + selector: + action: + + + +variables: + lux_threshold: !input lux_threshold + illuminance_entity: !input illuminance_entity + test: !input illumination_test + + current_lux: '{{ (states(illuminance_entity) | float) }}' + +# If motion is detected within the delay, +# we restart the script. +mode: restart +max_exceeded: silent + +trigger: + - platform: state + id: "turn_on" + entity_id: !input motion_entity + from: "off" + to: "on" + - platform: state + id: "door" + entity_id: !input door_entity + from: "off" + to: "on" + - platform: state + id: "turn_off" + entity_id: !input presence_entity + from: "on" + to: "off" + for: + seconds: !input no_motion_wait + +action: + - choose: + - conditions: + - condition: or + conditions: + - condition: trigger + id: "turn_on" + - condition: and + conditions: + - condition: trigger + id: "door" + - condition: state + entity_id: !input motion_entity + state: 'off' + - condition: or + conditions: + - condition: and + conditions: + - condition: template + value_template: '{{ test == "sensor" }}' + - condition: template + value_template: '{{ (states(illuminance_entity) | float) < lux_threshold }}' + - condition: and + conditions: + - condition: template + value_template: '{{ test == "sun" }}' + - condition: numeric_state + entity_id: sun.sun + attribute: elevation + below: !input sun_elevation + - condition: template + value_template: '{{ test == "none" }}' + - condition: state + entity_id: !input on_cond_should_be_off + state: 'off' + for: + hours: 0 + minutes: 0 + seconds: 10 + sequence: + - repeat: + while: + - condition: state + entity_id: !input on_cond_should_be_on + match: any + state: 'off' + sequence: +# Race here: state might change between 'condition' check and 'wait_for_trigger'. We might be better to just finish the loop and check once more before the actions... + - wait_for_trigger: + - platform: state + entity_id: !input on_cond_should_be_on + to: 'on' + timeout: + seconds: 2 + continue_on_timeout: false + + - choose: [] + default: !input "on_click" + - service: switch.turn_on + target: + entity_id: !input light_target + + - conditions: + - condition: trigger + id: "turn_off" + - condition: state + entity_id: !input off_cond_should_be_off + state: 'off' + - condition: state + entity_id: !input off_cond_should_be_on + state: 'on' + sequence: + - choose: [] + default: !input "off_click" + - service: switch.turn_off + target: + entity_id: !input light_target + default: [] diff --git a/blueprints/script/devices/aircon.yaml b/blueprints/script/devices/aircon.yaml index b2641be..1677c69 100644 --- a/blueprints/script/devices/aircon.yaml +++ b/blueprints/script/devices/aircon.yaml @@ -1,6 +1,6 @@ blueprint: name: AirCon - description: Stream photos from security camera + description: Automatically on/off Air Condition (current state and temperature based) domain: script input: power: @@ -114,22 +114,4 @@ sequence: - choose: [] default: !input "confirm" -# - if: -# - condition: state -# entity_id: switch.bedroom_aircon -# state: 'off' -# then: -# - service: switch.turn_on -# data: {} -# target: -# entity_id: switch.bedroom_aircon -# - delay: -# hours: 0 -# minutes: 0 -# seconds: 5 -# milliseconds: 0 - - service: scene.turn_on - target: - entity_id: scene.hyundai_aircon_cool_18 - metadata: {} mode: single diff --git a/blueprints/script/devices/aircon_off.yaml b/blueprints/script/devices/aircon_off.yaml new file mode 100644 index 0000000..f0132f1 --- /dev/null +++ b/blueprints/script/devices/aircon_off.yaml @@ -0,0 +1,37 @@ +blueprint: + name: AirCon Off + description: Turn off Air Condition + domain: script + input: + power: + name: Power + description: Aircon Smart Power Plug + selector: + entity: + domain: switch + off_scene: + name: Off Scene + description: Off scene of Aircon + selector: + entity: + domain: scene + +alias: AirCon +sequence: + - if: + - condition: state + entity_id: !input power + state: 'on' + then: + - service: scene.turn_on + target: + entity_id: !input off_scene + - delay: + hours: 0 + minutes: 0 + seconds: 5 + milliseconds: 0 + - service: switch.turn_off + target: + entity_id: !input power +mode: single diff --git a/custom/scripts/play-playlist.yaml b/custom/scripts/play-playlist.yaml index 719958c..0823878 100644 --- a/custom/scripts/play-playlist.yaml +++ b/custom/scripts/play-playlist.yaml @@ -91,6 +91,15 @@ play_playlist: target: entity_id: '{{ current }}' + - service: media_player.shuffle_set + data: + shuffle: true + entity_id: '{{ media_player }}' +# - service: media_player.repeat_set +# data: +# repeat: all +# entity_id: '{{ media_player }}' + - conditions: - condition: template value_template: '{{ list == "asgard" }}' @@ -105,6 +114,15 @@ play_playlist: enqueue: play media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%246%243/" + - service: media_player.shuffle_set + data: + shuffle: true + entity_id: '{{ media_player }}' +# - service: media_player.repeat_set +# data: +# repeat: all +# entity_id: '{{ media_player }}' + - conditions: - condition: template value_template: '{{ list == "download" }}' @@ -119,6 +137,15 @@ play_playlist: enqueue: play media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%241%240/" + - service: media_player.shuffle_set + data: + shuffle: false + entity_id: '{{ media_player }}' +# - service: media_player.repeat_set +# data: +# repeat: off +# entity_id: '{{ media_player }}' + - conditions: - condition: template value_template: '{{ list == "custom" }}' @@ -130,15 +157,3 @@ play_playlist: - '{{ 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 c8e180d..0fe478d 100644 --- a/custom/scripts/sleep-and-wake.yaml +++ b/custom/scripts/sleep-and-wake.yaml @@ -36,9 +36,12 @@ sleep_and_wake: value_template: '{{ mode == "sleep" }}' sequence: - parallel: + - service: scene.turn_on + target: + entity_id: scene.lg_aircon_power_off - service: switch.turn_off target: - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 - service: switch.turn_off target: entity_id: switch.living_lights_right @@ -60,7 +63,7 @@ sleep_and_wake: # entity_id: switch.plugs_office - service: switch.turn_off target: - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 - service: switch.turn_off target: entity_id: switch.living_lights_right @@ -104,6 +107,13 @@ sleep_and_wake: value_template: '{{ mode == "sleep" }}' sequence: - parallel: + - service: script.bedroom_aircon_off +# - service: scene.turn_on +# target: +# entity_id: scene.hyundai_aircon2_off + - service: scene.turn_on + target: + entity_id: scene.lg_aircon_power_off # Wait until we fix both sleep and WOL on laptop # - service: switch.turn_off # target: @@ -113,7 +123,7 @@ sleep_and_wake: entity_id: media_player.smartpi - service: switch.turn_off target: - entity_id: switch.smart_power_strip_pro_socket_1 + entity_id: switch.smart_power_strip_pro_socket_2 - service: switch.turn_off target: entity_id: switch.lights_all diff --git a/custom/shell.yaml b/custom/shell.yaml index 6c05d1b..a890c80 100644 --- a/custom/shell.yaml +++ b/custom/shell.yaml @@ -1,2 +1,12 @@ -sound_combined: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink combined' -sound_living: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink 0' +sound_kitchen_on: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen on" +sound_kitchen_off: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen off" +sound_kitchen_switch: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen switch" +sound_bedroom_on: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom on" +sound_bedroom_off: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom off" +sound_bedroom_switch: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom switch" +sound_living: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh living on" + + +#sound_combined: "ssh -i /config/keys/id_rsa csa@localhost '(pacmd set-default-sink combined; pacmd set-card-profile alsa_card.usb-0a12_Avantree_DG60_ABCDEF0123456789-00 output:iec958-stereo)'" +#sound_living: "ssh -i /config/keys/id_rsa csa@localhost pacmd set-card-profile alsa_card.usb-0a12_Avantree_DG60_ABCDEF0123456789-00 off" +#sound_living: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink 0' diff --git a/custom/template.yaml b/custom/template.yaml index 710b936..f5c7c99 100644 --- a/custom/template.yaml +++ b/custom/template.yaml @@ -12,14 +12,6 @@ {{ is_state("switch.bedroom_bedsidelampsocket", "on") and ((states("sensor.bedroom_bedsidelampsocket_power") | float) > 1) }} - sensor: - - name: "Power SmartPI" - unit_of_measurement: "W" - state: > - {% set readings = [ states('sensor.living_office_power'), - states('sensor.office_shelftop_power') | float(0), states('sensor.office_shelfbottom_power') | float(0), - states('sensor.office_table_power') | float(0), states('sensor.office_aircon_power') | float(0) ] %} - {{ 'unavailable' if readings[0] == 'unavailable' else readings[0] | float - readings[1] - readings[2] - readings[3] - readings[4] }} - - name: "Power Office" unit_of_measurement: "W" state: > @@ -27,12 +19,29 @@ | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") | selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }} + +# - name: "Power SmartPI" +# unit_of_measurement: "W" +# state: > +# {% set readings = [ states('sensor.living_office_power'), +# states('sensor.office_shelftop_power') | float(0), states('sensor.office_shelfbottom_power') | float(0), +# states('sensor.office_table_power') | float(0), states('sensor.office_aircon_power') | float(0) ] %} +# {{ 'unavailable' if readings[0] == 'unavailable' else readings[0] | float - readings[1] - readings[2] - readings[3] - readings[4] }} + +# - name: "Power Infrastructure" +# unit_of_measurement: "W" +# state: > +# {{ states('sensor.power_smartpi') | float + expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id') +# | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") +# | selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }} + - name: "Power Infrastructure" unit_of_measurement: "W" state: > - {{ states('sensor.power_smartpi') | float + expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id') + {{ expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id') | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined") | selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }} + - name: "Power Kitchen" unit_of_measurement: "W" state: > diff --git a/scripts.yaml b/scripts.yaml index bf0740b..e43517d 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -110,3 +110,19 @@ turn_on_office_lights: target: entity_id: switch.lights_living_lustre mode: single +bedroom_aircon_off: + alias: Bedroom AirCon Off + use_blueprint: + path: devices/aircon_off.yaml + input: + power: switch.bedroom_aircon + off_scene: scene.hyundai_aircon2_off + mode: single +office_aircon_off: + alias: Office AirCon Off + use_blueprint: + path: devices/aircon_off.yaml + input: + power: switch.office_aircon + off_scene: scene.lg_aircon_power_off + mode: single -- cgit v1.2.1