Skip to content

Instantly share code, notes, and snippets.

@kai-zer-ru
Created May 22, 2024 09:37
Show Gist options
  • Save kai-zer-ru/7e34d0a7dbd86e25c0409fb3ce8463cc to your computer and use it in GitHub Desktop.
Save kai-zer-ru/7e34d0a7dbd86e25c0409fb3ce8463cc to your computer and use it in GitHub Desktop.
Пакет скриптов и автоматизация для стиральной машины
stirka:
####################################
automation:
####################################
- id: stirka_start
alias: Стирка
description: ""
trigger:
- type: power
platform: device
device_id: 12e34fa53d1f5af20e7f63392dfb8494
entity_id: sensor.washing_machine_power
domain: sensor
above: 10
id: Washing Machine On
for:
hours: 0
minutes: 0
seconds: 30
- type: power
platform: device
device_id: 12e34fa53d1f5af20e7f63392dfb8494
entity_id: sensor.washing_machine_power
domain: sensor
below: 2
id: Washing Machine Off
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Washing Machine On
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.washing_machine_status
- conditions:
- condition: trigger
id:
- Washing Machine Off
- condition: state
entity_id: input_boolean.washing_machine_status
state: "on"
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.washing_machine_status
- service: script.stirka_stop
data: {}
mode: single
####################################
- id: alisa_timer_stirka
alias: Таймер для алисы после стирки
description: ""
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.alisa_stirka
action:
- service: script.stirka_stop
data: {}
####################################
- id: stop_timer_from_alisa
alias: Остановить таймер стиралки
description: ""
trigger:
- platform: event
event_type: yandex_intent
event_data:
text: Стирка
condition: []
action:
- service: timer.cancel
entity_id: timer.alisa_stirka
####################################
script:
####################################
set_50_volume_station_2:
alias: Установить громкость 50 на станции
sequence:
- service: input_number.set_value
data:
value: >-
{{ state_attr('media_player.yandex_station_u1111111',
'volume_level') * 100 }}
target:
entity_id: input_number.volume_station_2
- service: media_player.volume_set
data:
volume_level: 0.5
target:
entity_id: media_player.yandex_station_u1111111
####################################
stirka_stop:
alias: Конец стирки
sequence:
- service: timer.cancel
entity_id: timer.alisa_stirka
- service: timer.start
entity_id: timer.alisa_stirka
- service: notify.telegram_id_1
data:
message: Стиралка закончила стирку, пора доставать бельё!
- service: script.set_50_volume_station_2
- service: media_player.play_media
target:
entity_id: media_player.yandex_station_u1111111
data:
media_content_id: Стиралка закончила стирку, пора доставать бельё!
media_content_type: text
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: script.reset_volume_station_2
####################################
reset_volume_station_2:
alias: Вернуть громкость на станции 2
sequence:
- service: media_player.volume_set
data:
volume_level: "{{ (states('input_number.volume_station_2') | int / 100) | round(1) }}"
target:
entity_id: media_player.yandex_station_u1111111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment