224 lines
6.3 KiB
YAML
224 lines
6.3 KiB
YAML
- id: androidtv_adb_ok_button
|
|
alias: AndroidTV ADB Ok Button
|
|
description: ''
|
|
triggers:
|
|
- trigger: webhook
|
|
allowed_methods:
|
|
- PUT
|
|
local_only: true
|
|
webhook_id: androidtv-ok
|
|
conditions: []
|
|
actions:
|
|
- action: androidtv.adb_command
|
|
metadata: {}
|
|
data:
|
|
command: input keyevent 23
|
|
target:
|
|
entity_id: media_player.ldk_android_tv
|
|
mode: single
|
|
- id: androidtv_adb_show_inputs
|
|
alias: AndroidTV ADB Show Inputs
|
|
description: ''
|
|
triggers:
|
|
- trigger: webhook
|
|
allowed_methods:
|
|
- PUT
|
|
local_only: true
|
|
webhook_id: androidtv-inputs
|
|
conditions: []
|
|
actions:
|
|
- action: androidtv.adb_command
|
|
metadata: {}
|
|
data:
|
|
command: am start -a com.android.tv.action.VIEW_INPUTS -n com.google.android.tvlauncher/.inputs.InputsPanelActivity
|
|
-f 0x10000000
|
|
target:
|
|
entity_id: media_player.ldk_android_tv
|
|
mode: single
|
|
- id: climate
|
|
alias: Climate
|
|
description: ''
|
|
triggers:
|
|
- trigger: calendar
|
|
entity_id: calendar.climate
|
|
event: start
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.vacation_mode
|
|
state: 'off'
|
|
actions:
|
|
- variables:
|
|
duration: "{% set start = trigger.calendar_event.start | as_datetime %} {% set\
|
|
\ next_midnight = (start + timedelta(days=1)).replace(hour=0, minute=0, second=0,\
|
|
\ microsecond=0) %} {% set end = trigger.calendar_event.end | as_datetime\
|
|
\ %}\n\n{% if end == next_midnight %}\n {{ None }}\n{% else %}\n {{ end\
|
|
\ - start }}\n{% endif %}\n"
|
|
summary: '{{ trigger.calendar_event.summary.split(" ") }}
|
|
|
|
'
|
|
entities: "{% set room = summary[0] | lower %}\n{{ \n { \n \"climate\":\
|
|
\ \"climate.{}_ac\".format(room),\n \"temperature\": \"sensor.{}_temperature_avg\"\
|
|
.format(room)\n } \n}}\n"
|
|
mode: '{{ summary[1] | lower }}
|
|
|
|
'
|
|
temp: "{% if mode == \"heat\" %}\n {{ \n {\n \"target\": 24,\n \
|
|
\ \"cmp\": \"lte\",\n \"cmp_target\": 20\n } \n }}\n{% elif mode\
|
|
\ == \"cool\" %}\n {{ \n {\n \"target\": 27,\n \"cmp\": \"gte\"\
|
|
,\n \"cmp_target\": 26\n } \n }}\n{% endif %}\n"
|
|
- alias: If temperature condition matches
|
|
if:
|
|
- condition: template
|
|
value_template: "{% if temp.cmp == \"lte\" %}\n {{ float(states(entities.temperature))\
|
|
\ <= temp.cmp_target }}\n{% elif temp.cmp == \"gte\" %}\n {{ float(states(entities.temperature))\
|
|
\ >= temp.cmp_target }}\n{% endif %}"
|
|
then:
|
|
- action: climate.set_temperature
|
|
metadata: {}
|
|
data:
|
|
hvac_mode: '{{ mode }}'
|
|
temperature: '{{ temp.target }}'
|
|
target:
|
|
entity_id: '{{ entities.climate }}'
|
|
alias: Enable climate
|
|
- alias: Maybe wait to turn off
|
|
if:
|
|
- condition: template
|
|
value_template: '{{ duration != None }}'
|
|
alias: If duration is not empty
|
|
then:
|
|
- alias: Wait for climate to turn off
|
|
wait_template: '{{ is_state(entities.climate, "off") }}
|
|
|
|
'
|
|
timeout: '{{ duration }}'
|
|
continue_on_timeout: true
|
|
- alias: Turn off if timed out
|
|
if:
|
|
- condition: template
|
|
value_template: '{{ not wait.completed }}'
|
|
alias: If timed out
|
|
then:
|
|
- action: climate.turn_off
|
|
metadata: {}
|
|
data: {}
|
|
target:
|
|
entity_id: '{{ entities.climate }}'
|
|
mode: parallel
|
|
max: 10
|
|
- id: hallway_wardrobe_light
|
|
alias: Hallway Wardrobe Light
|
|
description: ''
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: binary_sensor.hallway_wardrobe_door_sensor_1_contact
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id: binary_sensor.hallway_wardrobe_door_sensor_1_contact
|
|
to: 'off'
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ trigger.to_state.state == "on" }}
|
|
|
|
'
|
|
- condition: state
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
state: 'off'
|
|
sequence:
|
|
- action: light.turn_on
|
|
metadata: {}
|
|
data:
|
|
brightness_pct: 100
|
|
target:
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
- alias: Wait for door to close or timeout
|
|
wait_for_trigger:
|
|
- trigger: state
|
|
entity_id: binary_sensor.hallway_wardrobe_door_sensor_1_contact
|
|
to: 'off'
|
|
timeout:
|
|
hours: 0
|
|
minutes: 10
|
|
seconds: 0
|
|
milliseconds: 0
|
|
continue_on_timeout: true
|
|
- if:
|
|
- condition: state
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: binary_sensor.hallway_wardrobe_door_sensor_1_contact
|
|
state: 'on'
|
|
then:
|
|
- action: light.turn_on
|
|
metadata: {}
|
|
data:
|
|
brightness_pct: 30
|
|
target:
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
alias: Drop brightness
|
|
alias: If door is still open and the light is on
|
|
alias: If door is open
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ trigger.to_state.state == "off" }}
|
|
|
|
'
|
|
- condition: state
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
metadata: {}
|
|
data: {}
|
|
target:
|
|
entity_id: light.hallway_wardrobe_led_controller_1
|
|
alias: If door is closed
|
|
mode: parallel
|
|
max: 5
|
|
- id: humidifier_no_water
|
|
alias: Humidifier No water
|
|
description: ''
|
|
triggers:
|
|
- trigger: numeric_state
|
|
entity_id:
|
|
- sensor.ldk_humidifier_water_level
|
|
below: 25
|
|
conditions: []
|
|
actions:
|
|
- action: notify.notify
|
|
metadata: {}
|
|
data:
|
|
message: No water in Humidifier
|
|
mode: single
|
|
- id: humidifier_morning
|
|
alias: Humidifier Morning
|
|
description: ''
|
|
triggers:
|
|
- trigger: time
|
|
at: 07:00:00
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.vacation_mode
|
|
state: 'off'
|
|
- condition: not
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.ldk_humidifier_status
|
|
state: unavailable
|
|
alias: Humidifier is online
|
|
- condition: numeric_state
|
|
entity_id: sensor.ldk_humidity_avg
|
|
below: 45
|
|
actions:
|
|
- action: select.select_option
|
|
metadata: {}
|
|
data:
|
|
option: Auto
|
|
target:
|
|
entity_id: select.ldk_humidifier_operating_mode_select
|
|
mode: single
|