1
0
Fork 0
ha-config/config/packages/home.yaml

204 lines
5.3 KiB
YAML
Raw Normal View History

2022-05-11 16:41:13 +10:00
homeassistant:
customize_glob:
"input_boolean.*_in_bed":
templates: # custom-ui
icon: >
if (state === 'on')
return 'mdi:bed';
return 'mdi:bed-empty';
2022-08-24 13:50:56 +10:00
magic_areas:
2022-05-11 16:41:13 +10:00
proximity:
bo_home:
zone: home
unit_of_measurement: m
devices:
- person.bo_jeanes
ri_home:
zone: home
unit_of_measurement: m
devices:
- person.ri_liu
group:
family:
name: Family
entities:
- person.bo_jeanes
- person.ri_liu
anyone_in_bed:
name: Anyone in bed
entities:
- input_boolean.bo_in_bed
- input_boolean.ri_in_bed
everyone_in_bed:
name: Everyone in bed
all: true
entities:
- input_boolean.bo_in_bed
- input_boolean.ri_in_bed
automation:
2022-08-24 13:50:56 +10:00
- id: 29b7b074ebcbfa873522
alias: turn off lights when everyone is in bed
trigger:
- platform: state
entity_id: binary_sensor.everyone_in_bed
from: "off"
to: "on"
for:
minutes: 1
action:
- service: light.turn_off
target:
entity_id: all
- service: light.turn_on
data:
color_temp: 462
brightness_pct: 10
target:
entity_id: light.sconce
2022-05-11 16:41:13 +10:00
- id: not_in_bed
alias: No longer in bed when phone leaves room
trigger:
- platform: state
entity_id:
- sensor.ri_s_phone
from: "bedroom"
variables:
2022-05-27 09:27:40 +10:00
toggle: input_boolean.ri_in_bed
2022-05-11 16:41:13 +10:00
for:
minutes: 1
- platform: state
entity_id:
- sensor.ri_s_phone
variables:
2022-05-27 09:27:40 +10:00
toggle: input_boolean.bo_in_bed
2022-05-11 16:41:13 +10:00
from: "bedroom"
for:
minutes: 1
condition:
- "{{ trigger.to_state.state not in ['not_home', 'unknown', 'unavailable'] }}"
- "{{ is_state(toggle, 'on') }}"
action:
- service: input_boolean.turn_off
target:
entity_id: "{{ toggle }}"
- id: in_bed
alias: In bed detection (based on phone charging)
trigger:
- platform: state
entity_id: sensor.ris_iphone_hass_battery_state
variables:
# battery_state can be: Full, Charging, Not Charging.
target_state: '{% if is_state("sensor.ris_iphone_hass_battery_state", "Not Charging") %}off{% else %}on{% endif %}'
toggle: input_boolean.ri_in_bed
person: person.ri_liu
- platform: state
entity_id: sensor.bos_iphone_hass_battery_state
variables:
target_state: '{% if is_state("sensor.bos_iphone_hass_battery_state", "Not Charging") %}off{% else %}on{% endif %}'
toggle: input_boolean.bo_in_bed
person: person.bo_jeanes
condition:
- or:
2022-05-27 10:28:04 +10:00
# - "{{ target_state == 'off' }}"
2022-05-11 16:41:13 +10:00
- alias: "plausible sleep time"
condition: time
after: "21:00:00"
2022-05-27 09:27:40 +10:00
before: "08:30:00"
2022-05-11 16:41:13 +10:00
- "{{ trigger.to_state.state not in ['unknown', 'unavailable'] }}"
- "{{ not is_state(toggle, target_state) }}"
- "{{ is_state(person, 'home') }}"
action:
- service: "input_boolean.turn_{{ target_state }}"
data:
entity_id: "{{ toggle }}"
template:
- binary_sensor:
- unique_id: in_bed
name: In bed
state: |
{{ is_state('input_boolean.bo_in_bed', 'on') or is_state('input_boolean.ri_in_bed', 'on') }}
icon: |
{% if is_state("binary_sensor.in_bed", "on") %}
mdi:bed
{% else %}
mdi:bed-empty
{% endif %}
device_class: occupancy
- unique_id: sleeping
name: Sleeping
state: |
{{ is_state('input_boolean.bo_in_bed', 'on') and is_state('input_boolean.ri_in_bed', 'on') }}
icon: |
{% if is_state("binary_sensor.sleeping", "on") %}
mdi:bed
{% else %}
mdi:bed-empty
{% endif %}
lifx:
light:
- broadcast: !secret iot_broadcast
homekit:
- name: house
port: 21223
filter:
include_entities:
- vacuum.robot_vacuum
- fan.bedroom_purifier
- sensor.bedroom_purifier_humidity
- sensor.bedroom_purifier_pm2_5
- sensor.bedroom_purifier_temperature
- input_boolean.bo_in_bed
- input_boolean.ri_in_bed
# - binary_sensor.in_bed
- switch.bo_s_desk_plug
- switch.bo_s_office_plug
2022-05-19 16:27:09 +10:00
- switch.bos_office_heater
2022-05-11 16:41:13 +10:00
- switch.ri_s_desk_plug
2022-08-24 13:50:56 +10:00
2022-05-11 16:41:13 +10:00
include_entity_globs:
- binary_sensor.*_is_occupied
2022-05-19 16:27:09 +10:00
- binary_sensor.*_motion
- binary_sensor.*_presence
- binary_sensor.*_occupancy
2022-05-11 16:41:13 +10:00
- sensor.ble_temperature*
- sensor.ble_humidity*
- sensor.ble_illuminance*
include_domains:
- light
exclude_entities: []
exclude_entity_globs:
- "*.*tent*"
- "sensor.*fridge*"
- "sensor.*freezer*"
- "sensor.*cure*"
- "sensor.*stash*"
2022-08-24 13:50:56 +10:00
- light.shelly_*
2022-05-11 16:41:13 +10:00
- sensor.*garden*
- sensor.*battery_temperature*
- sensor.*forecast*
- sensor.*weather*
- sensor.nas_*
- sensor.*_nas_*
exclude_domains: []
entity_config:
vacuum.robot_vacuum:
linked_battery_sensor: sensor.robot_vacuum_battery_level
linked_battery_charging_sensor: binary_sensor.robot_vacuum_charging
2022-08-24 13:50:56 +10:00
- name: shelly
port: 21225
filter:
include_entity_globs:
- light.shelly_*