Improve presence and lighting control in the basement
This commit is contained in:
@ -546,8 +546,8 @@ automation:
|
|||||||
# The delay is to prevent the boolean from re-running the automation if the lights were turned on manually
|
# The delay is to prevent the boolean from re-running the automation if the lights were turned on manually
|
||||||
|
|
||||||
- id: 47645bcf-a6ed-4c34-8ece-8daed4b10d9a
|
- id: 47645bcf-a6ed-4c34-8ece-8daed4b10d9a
|
||||||
alias: Basement Door Handling
|
alias: Basement Lights Handling
|
||||||
description: Turns on lights in basement when door is opened, if not already on
|
description: Handles the presence-related automation of lights in the basement
|
||||||
mode: restart
|
mode: restart
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
@ -566,12 +566,15 @@ automation:
|
|||||||
entity_id: timer.basement_studio_door_timer
|
entity_id: timer.basement_studio_door_timer
|
||||||
id: timer-finished
|
id: timer-finished
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id:
|
entity_id: binary_sensor.basement_unoccupied
|
||||||
- binary_sensor.tony_desktop_on
|
from: 'on'
|
||||||
- binary_sensor.kallen_desktop_on
|
to: 'off'
|
||||||
|
id: basement-occupied
|
||||||
|
- platform: state
|
||||||
|
entity_id: binary_sensor.basement_unoccupied
|
||||||
from: 'off'
|
from: 'off'
|
||||||
to: 'on'
|
to: 'on'
|
||||||
id: computers-on
|
id: basement-unoccupied
|
||||||
condition:
|
condition:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.studio_quiet
|
entity_id: input_boolean.studio_quiet
|
||||||
@ -598,14 +601,9 @@ automation:
|
|||||||
id: door-closed
|
id: door-closed
|
||||||
sequence:
|
sequence:
|
||||||
- if:
|
- if:
|
||||||
- condition: and
|
- condition: state
|
||||||
conditions:
|
entity_id: binary_sensor.basement_unoccupied
|
||||||
- condition: state
|
state: 'on'
|
||||||
entity_id: binary_sensor.tony_desktop_on
|
|
||||||
state: 'off'
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.kallen_desktop_on
|
|
||||||
state: 'off'
|
|
||||||
then:
|
then:
|
||||||
- service: timer.start
|
- service: timer.start
|
||||||
target:
|
target:
|
||||||
@ -614,11 +612,20 @@ automation:
|
|||||||
duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}"
|
duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}"
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: computers-on
|
id: basement-occupied
|
||||||
sequence:
|
sequence:
|
||||||
- service: timer.cancel
|
- service: timer.cancel
|
||||||
target:
|
target:
|
||||||
entity_id: timer.basement_studio_door_timer
|
entity_id: timer.basement_studio_door_timer
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: basement-unoccupied
|
||||||
|
sequence:
|
||||||
|
- service: timer.start
|
||||||
|
target:
|
||||||
|
entity_id: timer.basement_studio_door_timer
|
||||||
|
data:
|
||||||
|
duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}"
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: timer-finished
|
id: timer-finished
|
||||||
|
@ -265,6 +265,20 @@ template:
|
|||||||
false
|
false
|
||||||
{% endif %}
|
{% endif %}
|
||||||
device_class: presence
|
device_class: presence
|
||||||
|
- name: "Basement Unoccupied"
|
||||||
|
unique_id: 20039c29-8b9d-436d-ba6c-8f2c2bda1db0
|
||||||
|
state: >
|
||||||
|
{% if is_state('binary_sensor.tony_desktop_on','off') and is_state('binary_sensor.kallen_desktop_on','off') %}
|
||||||
|
true
|
||||||
|
{% elif is_state('binary_sensor.tony_desktop_idle','on') and is_state('binary_sensor.kallen_desktop_idle','on') %}
|
||||||
|
true
|
||||||
|
{% elif is_state('binary_sensor.tony_desktop_idle','on') and is_state('binary_sensor.kallen_desktop_on','off') %}
|
||||||
|
true
|
||||||
|
{% elif is_state('binary_sensor.kallen_desktop_idle','on') and is_state('binary_sensor.tony_desktop_on','off') %}
|
||||||
|
true
|
||||||
|
{% else %}
|
||||||
|
false
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
sensor:
|
sensor:
|
||||||
|
@ -104,7 +104,27 @@ template:
|
|||||||
state: "{{ states('sensor.basement_server_power') | int > 10 }}"
|
state: "{{ states('sensor.basement_server_power') | int > 10 }}"
|
||||||
device_class: power
|
device_class: power
|
||||||
attributes:
|
attributes:
|
||||||
power_usage: "{{ states('sensor.basement_server_power') }}"
|
power_usage: "{{ states('sensor.basement_server_power') | int }}W"
|
||||||
|
- name: Tony Desktop Idle
|
||||||
|
unique_id: f0ace986-a874-4fb0-ad29-8f3ebf95d8cc
|
||||||
|
state: "{{ states('sensor.tony_asus_system_idle_time') | int > 3600 }}"
|
||||||
|
attributes:
|
||||||
|
idle_time: "{{ states('sensor.tony_asus_system_idle_time') | int }}s"
|
||||||
|
- name: Tina Desktop Idle
|
||||||
|
unique_id: 1933c638-c94b-468e-bb7a-c1c5b36c3651
|
||||||
|
state: "{{ states('sensor.xia_desktop_system_idle_time') | int > 3600 }}"
|
||||||
|
attributes:
|
||||||
|
idle_time: "{{ states('sensor.xia_desktop_system_idle_time') | int }}s"
|
||||||
|
- name: Kallen Desktop Idle
|
||||||
|
unique_id: 680c6ae3-2ed2-451e-858b-2aee688af461
|
||||||
|
state: "{{ states('sensor.kallen_desktop_system_idle_time') | int > 3600 }}"
|
||||||
|
attributes:
|
||||||
|
idle_time: "{{ states('sensor.kallen_desktop_system_idle_time') | int }}s"
|
||||||
|
- name: Asus Laptop Idle
|
||||||
|
unique_id: 7d8eb80a-0a2e-48a9-84b3-33175304dd95
|
||||||
|
state: "{{ states('sensor.asus_laptop_system_idle_time') | int > 3600 }}"
|
||||||
|
attributes:
|
||||||
|
idle_time: "{{ states('sensor.asus_laptop_system_idle_time') }}s"
|
||||||
|
|
||||||
# - platform: influxdb
|
# - platform: influxdb
|
||||||
# host: 192.168.1.26
|
# host: 192.168.1.26
|
||||||
|
Reference in New Issue
Block a user