fix
continuous-integration/drone/push Build is passing Details

states/02
thest1tch 1 year ago
parent ff531b9ad1
commit 24924d3150

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

@ -7,55 +7,52 @@
- [custom:stack-in-card](https://github.com/custom-cards/stack-in-card) - [custom:stack-in-card](https://github.com/custom-cards/stack-in-card)
- [custom:button-card](https://github.com/custom-cards/button-card) - [custom:button-card](https://github.com/custom-cards/button-card)
## Внешний вид карточки ## Карточка
![](../../../images/software/hass/card-budilnik-1.png) ![](../../../images/software/hass/card-budilnik-1.png)
![](../../../images/software/hass/card-budilnik-2.png) ![](../../../images/software/hass/card-budilnik-2.png)
## Код карточки ??? example "Код карточки"
??? example ```yaml title="card-budilnik.yaml"
type: custom:stack-in-card
```yaml title="card-budilnik.yaml" title: Будильник
type: custom:stack-in-card cards:
title: Будильник - cards:
cards: - entity: input_boolean.alarm_weekday
- cards: name: Будни
- entity: input_boolean.alarm_weekday size: 30px
name: Будни icon: mdi:alarm
size: 30px tap_action:
icon: mdi:alarm action: toggle
tap_action: type: custom:button-card
action: toggle - entity: input_boolean.alarm_weekend
type: custom:button-card name: Выходные
- entity: input_boolean.alarm_weekend icon: mdi:party-popper
name: Выходные size: 30px
icon: mdi:party-popper tap_action:
size: 30px action: toggle
tap_action: type: custom:button-card
action: toggle type: horizontal-stack
type: custom:button-card - type: conditional
type: horizontal-stack conditions:
- type: conditional - entity: input_boolean.alarm_weekday
conditions: state: 'on'
- entity: input_boolean.alarm_weekday card:
state: 'on' type: entities
card: entities:
type: entities - entity: input_datetime.alarm_weekday
entities: name: По будням
- entity: input_datetime.alarm_weekday - type: conditional
name: По будням conditions:
- type: conditional - entity: input_boolean.alarm_weekend
conditions: state: 'on'
- entity: input_boolean.alarm_weekend card:
state: 'on' type: entities
card: entities:
type: entities - entity: input_datetime.alarm_weekend
entities: name: В выходные
- entity: input_datetime.alarm_weekend ```
name: В выходные
```
## Как это работает ## Как это работает
@ -74,269 +71,269 @@
??? example ??? example
```yaml ```yaml
#ДОБАВЛЯЕМ ЭЛЕМЕНТЫ ВВОД И УПРАВЛЕНИЯ #ДОБАВЛЯЕМ ЭЛЕМЕНТЫ ВВОД И УПРАВЛЕНИЯ
input_datetime: input_datetime:
alarm_weekday: alarm_weekday:
has_date: false has_date: false
has_time: true has_time: true
alarm_weekend: alarm_weekend:
has_date: false has_date: false
has_time: true has_time: true
#ПЕРЕКЛЮЧАТЕЛИ #ПЕРЕКЛЮЧАТЕЛИ
input_boolean: input_boolean:
alarm_weekday: alarm_weekday:
alarm_weekend: alarm_weekend:
#СЕНСОРЫ ДЛЯ ПОДСЧЕТА ВРЕМЕНИ В ОТЛОЖЕННЫХ ФУНКЦИЯХ #СЕНСОРЫ ДЛЯ ПОДСЧЕТА ВРЕМЕНИ В ОТЛОЖЕННЫХ ФУНКЦИЯХ
sensor: sensor:
- platform: template - platform: template
sensors: sensors:
input_alarm_weekday: input_alarm_weekday:
friendly_name: Будильник будни friendly_name: Будильник будни
value_template: "{{ (((state_attr('input_datetime.alarm_weekday' , 'timestamp')) - (5 * 60))|timestamp_custom('%H:%M', false)) }}" value_template: "{{ (((state_attr('input_datetime.alarm_weekday' , 'timestamp')) - (5 * 60))|timestamp_custom('%H:%M', false)) }}"
input_alarm_weekend: input_alarm_weekend:
friendly_name: Будильник выходные friendly_name: Будильник выходные
value_template: "{{ (((state_attr('input_datetime.alarm_weekend' , 'timestamp')) - (5 * 60))|timestamp_custom('%H:%M', false)) }}" value_template: "{{ (((state_attr('input_datetime.alarm_weekend' , 'timestamp')) - (5 * 60))|timestamp_custom('%H:%M', false)) }}"
binary_sensor: binary_sensor:
- platform: template - platform: template
sensors: sensors:
alarm_weekday_start: alarm_weekday_start:
friendly_name: Будильник будни friendly_name: Будильник будни
value_template: "{{ states('sensor.time') == states('sensor.input_alarm_weekday_start') }}" value_template: "{{ states('sensor.time') == states('sensor.input_alarm_weekday_start') }}"
alarm_weekend_start: alarm_weekend_start:
friendly_name: Будильник выходные friendly_name: Будильник выходные
value_template: "{{ states('sensor.time') == states('sensor.input_alarm_weekend_start') }}" value_template: "{{ states('sensor.time') == states('sensor.input_alarm_weekend_start') }}"
automation: automation:
# ВКЛЮЧЕНИЕ БУДИЛЬНИКА ПРИ ЗАПУСКЕ HA # ВКЛЮЧЕНИЕ БУДИЛЬНИКА ПРИ ЗАПУСКЕ HA
- id: 'startup_on_alarm_clock' - id: 'startup_on_alarm_clock'
alias: Включение будильника при запуске HA alias: Включение будильника при запуске HA
trigger: trigger:
platform: homeassistant platform: homeassistant
event: start event: start
condition: condition:
condition: time condition: time
after: '09:00:00' after: '09:00:00'
before: '00:00:00' before: '00:00:00'
action: action:
- delay: 0:01 - delay: 0:01
# ВКЛЮЧЕНИЕ КЛАВИШАМИ. ПРОСТО ЗВУКОВОЕ СООБЩЕНИЕ О ВКЛЮЧЕНИИ # ВКЛЮЧЕНИЕ КЛАВИШАМИ. ПРОСТО ЗВУКОВОЕ СООБЩЕНИЕ О ВКЛЮЧЕНИИ
- id: 'on_alarm_clock' - id: 'on_alarm_clock'
alias: "Включение будильника клавишей" alias: "Включение будильника клавишей"
trigger: trigger:
platform: state platform: state
entity_id: entity_id:
- input_boolean.alarm_weekday - input_boolean.alarm_weekday
- input_boolean.alarm_weekend - input_boolean.alarm_weekend
to: 'on' to: 'on'
action: action:
- service: yandex_tts_alarm_on - service: yandex_tts_alarm_on
# ВЫКЛЮЧЕНИЕ КЛАВИШАМИ. ПРОСТО ЗВУКОВОЕ СООБЩЕНИЕ О ВЫКЛЮЧЕНИИ # ВЫКЛЮЧЕНИЕ КЛАВИШАМИ. ПРОСТО ЗВУКОВОЕ СООБЩЕНИЕ О ВЫКЛЮЧЕНИИ
- id: 'off_alarm_clock' - id: 'off_alarm_clock'
alias: "Выключение будильника клавишей" alias: "Выключение будильника клавишей"
trigger: trigger:
platform: state platform: state
entity_id: entity_id:
- input_boolean.alarm_1_weekday - input_boolean.alarm_1_weekday
- input_boolean.alarm_1_weekend - input_boolean.alarm_1_weekend
to: 'off' to: 'off'
action: action:
- service: yandex_tts_alarm_off - service: yandex_tts_alarm_off
# Запуск будильника по будням # Запуск будильника по будням
- id: 'alarm_weekday' - id: 'alarm_weekday'
alias: Wake me up (weekday) alias: Wake me up (weekday)
trigger: trigger:
- platform: time_pattern - platform: time_pattern
minutes: "/1" minutes: "/1"
seconds: 0 seconds: 0
condition: condition:
- condition: state - condition: state
entity_id: input_boolean.alarm_weekday entity_id: input_boolean.alarm_weekday
state: 'on' state: 'on'
- condition: time - condition: time
weekday: weekday:
- mon - mon
- tue - tue
- wed - wed
- thu - thu
- fri - fri
- condition: template - condition: template
value_template: >- value_template: >-
{{ now().strftime("%H:%M") == states.sensor.input_alarm_weekday.state }} {{ now().strftime("%H:%M") == states.sensor.input_alarm_weekday.state }}
- condition: state - condition: state
entity_id: person.thest1tch entity_id: person.thest1tch
state: 'home' state: 'home'
action: action:
- data: {} - data: {}
service: script.wakeup_sequence service: script.wakeup_sequence
# Запуск будильника по выходным # Запуск будильника по выходным
- id: 'alarm_weekend' - id: 'alarm_weekend'
alias: Wake me up (weekend) alias: Wake me up (weekend)
trigger: trigger:
- platform: time_pattern - platform: time_pattern
minutes: "/1" minutes: "/1"
seconds: 0 seconds: 0
condition: condition:
- condition: state - condition: state
entity_id: input_boolean.alarm_weekend entity_id: input_boolean.alarm_weekend
state: 'on' state: 'on'
- condition: time - condition: time
weekday: weekday:
- sat - sat
- sun - sun
- condition: template - condition: template
value_template: >- value_template: >-
{{ now().strftime("%H:%M") == states.sensor.input_alarm_weekend.state }} {{ now().strftime("%H:%M") == states.sensor.input_alarm_weekend.state }}
- condition: state - condition: state
entity_id: person.thest1tch entity_id: person.thest1tch
state: 'home' state: 'home'
action: action:
- data: {} - data: {}
service: script.wakeup_sequence service: script.wakeup_sequence
script: script:
# Включение люстры, если солнце еще не встало # Включение люстры, если солнце еще не встало
wakeup_celib_start: wakeup_celib_start:
alias: wakeup_celib_start alias: wakeup_celib_start
sequence: sequence:
- condition: state - condition: state
entity_id: sun.sun entity_id: sun.sun
state: below_horizon state: below_horizon
for: for:
hours: 0 hours: 0
minutes: 1 minutes: 1
seconds: 0 seconds: 0
- service: light.turn_on - service: light.turn_on
data: data:
brightness: '3' brightness: '3'
brightness_step: 2 brightness_step: 2
entity_id: entity_id:
- light.yeelight_ceilb_0x17879e8e_nightlight - light.yeelight_ceilb_0x17879e8e_nightlight
# Открывание штор, если солнце уже встало # Открывание штор, если солнце уже встало
wakeup_cover_start: wakeup_cover_start:
alias: wakeup_cover_start alias: wakeup_cover_start
sequence: sequence:
- condition: state - condition: state
entity_id: sun.sun entity_id: sun.sun
state: above_horizon state: above_horizon
for: for:
hours: 0 hours: 0
minutes: 1 minutes: 1
seconds: 0 seconds: 0
- service: cover.open_cover - service: cover.open_cover
data: data:
position: 10 position: 10
target: target:
entity_id: cover.yeelink_ctmt1_c8c9_curtain entity_id: cover.yeelink_ctmt1_c8c9_curtain
- delay: 00:02:00 - delay: 00:02:00
- service: cover.open_cover - service: cover.open_cover
data: data:
position: 30 position: 30
target: target:
entity_id: cover.yeelink_ctmt1_c8c9_curtain entity_id: cover.yeelink_ctmt1_c8c9_curtain
- delay: 00:02:00 - delay: 00:02:00
- service: cover.open_cover - service: cover.open_cover
data: data:
position: 50 position: 50
target: target:
entity_id: cover.yeelink_ctmt1_c8c9_curtain entity_id: cover.yeelink_ctmt1_c8c9_curtain
- delay: 00:02:00 - delay: 00:02:00
- service: cover.open_cover - service: cover.open_cover
data: data:
position: 70 position: 70
target: target:
entity_id: cover.yeelink_ctmt1_c8c9_curtain entity_id: cover.yeelink_ctmt1_c8c9_curtain
- delay: 00:02:00 - delay: 00:02:00
- service: cover.open_cover - service: cover.open_cover
data: data:
position: 100 position: 100
target: target:
entity_id: cover.yeelink_ctmt1_c8c9_curtain entity_id: cover.yeelink_ctmt1_c8c9_curtain
# Главный скрипт будильника # Главный скрипт будильника
wakeup_sequence: wakeup_sequence:
alias: wakeup_sequence alias: wakeup_sequence
sequence: sequence:
- data: {} - data: {}
#сбрасываем параметры освещения #сбрасываем параметры освещения
service: wakeup_celib_start service: wakeup_celib_start
- delay: 00:00:02 - delay: 00:00:02
#включаем плавное наращивание освещения #включаем плавное наращивание освещения
- service: script.wakeup_celib_start - service: script.wakeup_celib_start
- service: script.wakeup_cover_start - service: script.wakeup_cover_start
- data: {} - data: {}
#Включение музыки на яндекс станции #Включение музыки на яндекс станции
service: yandex_tts_alarm_start service: yandex_tts_alarm_start
# TTS YANDEX # TTS YANDEX
yandex_tts_alarm_start: yandex_tts_alarm_start:
alias: "YaStation Запуск будильника" alias: "YaStation Запуск будильника"
sequence: sequence:
- service: media_player.volume_set - service: media_player.volume_set
data: data:
entity_id: entity_id:
- media_player.yandex_station_m0017y300grsqb - media_player.yandex_station_m0017y300grsqb
volume_level: 0.1 volume_level: 0.1
- delay: 00:00:01 - delay: 00:00:01
- service: yandex_station.send_command - service: yandex_station.send_command
data: data:
entity_id: media_player.yandex_station_m0017y300grsqb
command: sendText
text: Включи фоновую музыку
- delay: 00:01:00
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.2
- delay: 00:00:30
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.3
- delay: 00:00:30
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.4
yandex_tts_alarm_on:
alias: "YaStation Включение будильника"
sequence:
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.4
- delay: 00:00:01
- service: media_player.play_media
entity_id: media_player.yandex_station_m0017y300grsqb entity_id: media_player.yandex_station_m0017y300grsqb
command: sendText data:
text: Включи фоновую музыку media_content_id: Включаю будильник.
- delay: 00:01:00 media_content_type: text
- service: media_player.volume_set
data: yandex_tts_alarm_off:
entity_id: alias: YaStation_Выключение будильника
- media_player.yandex_station_m0017y300grsqb sequence:
volume_level: 0.2 - service: media_player.volume_set
- delay: 00:00:30 data:
- service: media_player.volume_set entity_id:
data: - media_player.yandex_station
entity_id: volume_level: 0.4
- media_player.yandex_station_m0017y300grsqb - service: media_player.play_media
volume_level: 0.3 entity_id: media_player.yandex_station_m0017y300grsqb
- delay: 00:00:30 data:
- service: media_player.volume_set media_content_id: Будильник выключен.
data: media_content_type: text
entity_id: ```
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.4
yandex_tts_alarm_on:
alias: "YaStation Включение будильника"
sequence:
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station_m0017y300grsqb
volume_level: 0.4
- delay: 00:00:01
- service: media_player.play_media
entity_id: media_player.yandex_station_m0017y300grsqb
data:
media_content_id: Включаю будильник.
media_content_type: text
yandex_tts_alarm_off:
alias: YaStation_Выключение будильника
sequence:
- service: media_player.volume_set
data:
entity_id:
- media_player.yandex_station
volume_level: 0.4
- service: media_player.play_media
entity_id: media_player.yandex_station_m0017y300grsqb
data:
media_content_id: Будильник выключен.
media_content_type: text
```
Loading…
Cancel
Save