Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- homeassistant:
- customize:
- ################################################
- ## Node Anchors
- ################################################
- package.node_anchors:
- customize: &customize
- package: 'alarmclock'
- exposed: &exposed
- <<: *customize
- emulated_hue_hidden: true
- homebridge_hidden: false
- critical: true
- not_exposed: ¬_exposed
- <<: *customize
- emulated_hue_hidden: false
- homebridge_hidden: true
- critical: false
- hidden: &hidden
- <<: *customize
- hidden: true
- critical: false
- automation.alarm_clock:
- icon: mdi:alarm-check
- input_number:
- slider_hours:
- name: Godziny
- initial: 4
- min: 0
- max: 11
- step: 1
- slider_minutes:
- name: Minuty
- initial: 15
- min: 0
- max: 59
- step: 5
- input_boolean:
- alarm_clock:
- name: Alarm On
- initial: on
- icon: mdi:alarm-multiple
- week_day_only:
- name: Tylko W Dni Powszednie
- initial: on
- icon: mdi:calendar-check
- am:
- name: AM
- initial: on
- icon: mdi:weather-sunny
- pm:
- name: PM
- initial: off
- icon: mdi:weather-night
- boolean_extra_work_day:
- name: Extra Workday
- initial: off
- icon: mdi:calendar-check
- input_text:
- alarm_current_time:
- name: Aktualny Czas Alarmu
- icon: mdi:timer
- sensor:
- - platform: time_date
- display_options:
- - 'time'
- - 'date'
- - 'date_time'
- - 'time_date'
- - 'time_utc'
- - 'beat'
- binary_sensor:
- - platform: workday
- country: PL
- workdays: [mon, tue, wed, thu, fri, sat, sun]
- # excludes: [fri, sat, sun, holiday]
- automation:
- - alias: update current alarm time
- initial_state: true
- # hide_entity: true
- trigger:
- - platform: homeassistant
- event: start
- - platform: state
- entity_id:
- - input_boolean.am
- - input_boolean.pm
- - input_number.slider_hours
- - input_number.slider_minutes
- action:
- - service: input_text.set_value
- entity_id: input_text.alarm_current_time
- data_template:
- value: >
- {%- if states.input_number.slider_hours.state | int < 10 -%}
- {%- if states.input_number.slider_hours.state|int == 0 %}
- 12
- {%- else -%}
- {{- 0 ~ states.input_number.slider_hours.state|int -}}
- {%- endif -%}
- {%- else -%}
- {{- states.input_number.slider_hours.state |int -}}
- {% endif -%}:
- {%- if states.input_number.slider_minutes.state | int < 10 -%}
- {{- 0 ~ states.input_number.slider_minutes.state |int -}}
- {%- else -%}
- {{- states.input_number.slider_minutes.state|int -}}
- {%- endif -%}{%- if states.input_boolean.am.state == "on" %} AM{%- else %} PM{%- endif -%}
- - alias: am change off
- initial_state: true
- # hide_entity: true
- trigger:
- platform: state
- entity_id: input_boolean.am
- from: 'on'
- to: 'off'
- action:
- - service: input_boolean.turn_on
- entity_id: input_boolean.pm
- - service: input_boolean.turn_off
- entity_id: input_boolean.am
- - alias: am change on
- initial_state: true
- # hide_entity: true
- trigger:
- platform: state
- entity_id: input_boolean.am
- from: 'off'
- to: 'on'
- action:
- - service: input_boolean.turn_off
- entity_id: input_boolean.pm
- - service: input_boolean.turn_on
- entity_id: input_boolean.am
- - alias: pm change off
- initial_state: true
- # hide_entity: true
- trigger:
- platform: state
- entity_id: input_boolean.pm
- from: 'on'
- to: 'off'
- action:
- - service: input_boolean.turn_on
- entity_id: input_boolean.am
- - service: input_boolean.turn_off
- entity_id: input_boolean.pm
- - alias: pm change on
- initial_state: true
- # hide_entity: true
- trigger:
- platform: state
- entity_id: input_boolean.pm
- from: 'off'
- to: 'on'
- action:
- - service: input_boolean.turn_off
- entity_id: input_boolean.am
- - service: input_boolean.turn_on
- entity_id: input_boolean.pm
- - alias: alarm clock
- initial_state: true
- # hide_entity: true
- trigger:
- platform: time_pattern
- minutes: '/1'
- seconds: 00
- condition:
- - condition: template
- value_template: >-
- {{ is_state('binary_sensor.workday_sensor', 'on') or is_state('input_boolean.boolean_extra_work_day', 'on') }}
- - condition: template
- value_template: '{{ states.input_boolean.alarm_clock.state == "on" }}'
- - condition: template
- value_template: >
- {% if states.input_boolean.am.state == "on" %}
- {% set hour = (states.input_number.slider_hours.state | int) %}
- {% else %}
- {% set hour = (states.input_number.slider_hours.state | int) + 12 %}
- {% endif %}
- {{ 'true' if states.sensor.time.state.split(':')[0] |int == hour else 'false' }}
- - condition: template
- value_template: "{{ 'true' if (states.sensor.time.state.split(':')[1] |int == states.input_number.slider_minutes.state |int) else 'false' }}"
- action:
- - service: tts.google_say
- data:
- entity_id: media_player.googlehome4300
- message: 'Dzień Dobry Pora Wstawać'
- wait: 00:00:05
- - service: light.turn_on
- data:
- entity_id: light.downlight_z_komputer
- transition: 90
- - delay: '00:00:90'
- - service: script.start_playlist2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement