Import automations to ansible
This commit is contained in:
commit
b6a2fe33a5
41
automations/files/air-purifier.yaml
Normal file
41
automations/files/air-purifier.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
- alias: '[Living Room Air Purifier] mode change'
|
||||
trigger:
|
||||
entity_id: input_select.xiaomi_airpurifier_mode
|
||||
platform: state
|
||||
action:
|
||||
service: fan.set_speed
|
||||
data_template:
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
speed: '{{ states.input_select.xiaomi_airpurifier_mode.state }}'
|
||||
id: xiaomi_airpurifier_mode_change
|
||||
- alias: '[Living Room Air Purifier] mode changed'
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
action:
|
||||
service: input_select.select_option
|
||||
entity_id: input_select.xiaomi_airpurifier_mode
|
||||
data_template:
|
||||
option: '{{ states.fan.xiaomi_miio_device.attributes.speed }}'
|
||||
id: xiaomi_airpurifier_mode_changed
|
||||
- alias: '[Living Room Air Purifier] favorite level change'
|
||||
trigger:
|
||||
entity_id: input_number.xiaomi_airpurifier_favorite_level
|
||||
platform: state
|
||||
action:
|
||||
service: xiaomi_miio.fan_set_favorite_level
|
||||
data_template:
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
level: '{{ states.input_number.xiaomi_airpurifier_favorite_level.state | int
|
||||
}}'
|
||||
id: xiaomi_airpurifier_favorite_level
|
||||
- alias: '[Living Room Air Purifier] favorite level changed'
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: fan.xiaomi_miio_device
|
||||
action:
|
||||
service: input_number.set_value
|
||||
entity_id: input_number.xiaomi_airpurifier_favorite_level
|
||||
data_template:
|
||||
value: '{{ states.fan.xiaomi_miio_device.attributes.favorite_level }}'
|
||||
id: xiaomi_airpurifier_favorite_level_changed
|
46
automations/files/alarm-clock.yaml
Normal file
46
automations/files/alarm-clock.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
- id: wakeup
|
||||
alias: Wakeup automation
|
||||
description: ''
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.alarm
|
||||
condition:
|
||||
- condition: time
|
||||
weekday:
|
||||
- mon
|
||||
- tue
|
||||
- wed
|
||||
- thu
|
||||
- fri
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 2000
|
||||
brightness: 1
|
||||
entity_id:
|
||||
- light.bedroom_1
|
||||
- light.bedroom_2
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 5300
|
||||
transition: 1800
|
||||
brightness: 255
|
||||
entity_id:
|
||||
- light.bedroom_1
|
||||
- light.bedroom_2
|
||||
- delay: '10'
|
||||
- service: media_player.volume_set
|
||||
data:
|
||||
volume_level: 0.1
|
||||
entity_id: media_player.bedroom_speaker
|
||||
- delay: 0:30:00
|
||||
- service: media_player.volume_set
|
||||
data:
|
||||
volume_level: 0.6
|
||||
entity_id: media_player.bedroom_speaker
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
media_content_id: media-source://media_source/local/wake-the-f-up-samurai-we-have-a-city-to-burn.mp3
|
||||
media_content_type: music
|
||||
entity_id: media_player.bedroom_speaker
|
||||
mode: single
|
24
automations/files/modes.yaml
Normal file
24
automations/files/modes.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
- id: sleep_on
|
||||
alias: Turn on sleep time
|
||||
description: ''
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.sleep_mode
|
||||
condition: []
|
||||
action:
|
||||
- service: input_boolean.turn_on
|
||||
data: {}
|
||||
entity_id: input_boolean.sleep_mode
|
||||
mode: single
|
||||
- id: sleep_off
|
||||
alias: Turn off sleep time
|
||||
description: ''
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.day_mode
|
||||
condition: []
|
||||
action:
|
||||
- service: input_boolean.turn_off
|
||||
data: {}
|
||||
entity_id: input_boolean.sleep_mode
|
||||
mode: single
|
5
automations/tasks/main.yaml
Normal file
5
automations/tasks/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Build lights automations
|
||||
template:
|
||||
src: lights.yaml.j2
|
||||
dest: build/lights.yaml
|
58
automations/templates/lights.yaml.j2
Normal file
58
automations/templates/lights.yaml.j2
Normal file
@ -0,0 +1,58 @@
|
||||
{% for light in lights %}
|
||||
# {{ light.name }}
|
||||
- id: sleep_mode_{{ light.entityId }}
|
||||
alias: '[Sleep-Mode] {{ light.name }}'
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: {{ light.entityId }}
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: 'on'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 2000
|
||||
entity_id: {{ light.entityId }}
|
||||
mode: single
|
||||
- id: sleep_on_{{ light.entityId }}
|
||||
alias: '[Sleep-On] {{ light.name }}'
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.sleep_mode
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 2000
|
||||
entity_id: {{ light.entityId }}
|
||||
mode: single
|
||||
- id: day_mode_{{ light.entityId }}
|
||||
alias: '[Day-Mode] {{ light.name }}'
|
||||
trigger:
|
||||
- platform: time
|
||||
at: input_datetime.day_mode
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 3200
|
||||
entity_id: {{ light.entityId }}
|
||||
mode: single
|
||||
- id: day_on_{{ light.entityId }}
|
||||
alias: '[Day-On] {{ light.name }}'
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: {{ light.entityId }}
|
||||
to: 'on'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: 'off'
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data:
|
||||
kelvin: 3200
|
||||
entity_id: {{ light.entityId }}
|
||||
mode: single
|
||||
|
||||
{% endfor %}
|
38
automations/vars/main.yaml
Normal file
38
automations/vars/main.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
# vars file for automations
|
||||
|
||||
lights:
|
||||
- entityId: light.tv_left
|
||||
name: TV Left
|
||||
- entityId: light.tv_middle
|
||||
name: TV Middle
|
||||
- entityId: light.tv_right
|
||||
name: TV Right
|
||||
- entityId: light.kitchen_01
|
||||
name: Kitchen 01
|
||||
- entityId: light.kitchen_02
|
||||
name: Kitchen 02
|
||||
- entityId: light.kitchen_03
|
||||
name: Kitchen 03
|
||||
- entityId: light.kitchen_04
|
||||
name: Kitchen 04
|
||||
- entityId: light.kitchen_05
|
||||
name: Kitchen 05
|
||||
- entityId: light.kitchen_06
|
||||
name: Kitchen 06
|
||||
- entityId: light.kitchen_07
|
||||
name: Kitchen 07
|
||||
- entityId: light.kitchen_08
|
||||
name: Kitchen 08
|
||||
- entityId: light.kitchen_09
|
||||
name: Kitchen 09
|
||||
- entityId: light.kitchen_10
|
||||
name: Kitchen 10
|
||||
- entityId: light.kitchen_11
|
||||
name: Kitchen 11
|
||||
- entityId: light.kitchen_12
|
||||
name: Kitchen 12
|
||||
- entityId: light.kitchen_13
|
||||
name: Kitchen 13
|
||||
- entityId: light.kitchen_14
|
||||
name: Kitchen 14
|
4
home-assistant.yml
Normal file
4
home-assistant.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- automations
|
Loading…
Reference in New Issue
Block a user