I want to share my automation for the christmas lights
here is a pictue of the group:
and here the code:
configuration.yaml:
input_boolean:
weihnachtsbeleuchtung:
name: Weihnachtsbeleuchtung
initial: off
weihnachtsbeleuchtung_nur_wenn_zuhause:
name: Weihnachtsbeleuchtung nur wenn einer zu Hause
initial: on
input_number:Weihnachtsbeleuchtung
weihnachtsbeleuchtung_ein:
name: Uhrzeit einschalten
initial: 18
min: 16
max: 20
step: 1
unit_of_measurement: ‘:00’
weihnachtsbeleuchtung_aus:
name: Uhrzeit ausschalten
initial: 21
min: 17
max: 23
step: 1
unit_of_measurement: ‘:00’
and the setup for google calendar
sensor.yaml:
# Zeit für Trigger
- platform: time_date
display_options:
- 'time'
scripts.yaml:
# Weihnachtsbeleuchtung über Funksteckdosen
weihnachtsbeleuchtung_einschalten:
sequence:
- service: light.turn_on
entity_id: light.funkstecker1_1
- delay: 00:00:01
- service: light.turn_on
entity_id: light.funkstecker1_2
- delay: 00:00:01
- service: light.turn_on
entity_id: light.funkstecker1_3
- delay: 00:00:01
- service: light.turn_on
entity_id: light.funkstecker1_4
weihnachtsbeleuchtung_ausschalten:
sequence:
- service: light.turn_off
entity_id: light.funkstecker1_1
- delay: 00:00:01
- service: light.turn_off
entity_id: light.funkstecker1_2
- delay: 00:00:01
- service: light.turn_off
entity_id: light.funkstecker1_3
- delay: 00:00:01
- service: light.turn_off
entity_id: light.funkstecker1_4
automations.yaml:
# Weihnachtsbeleuchtung
- alias: weihnachtsbeleuchtung_einschalten_input_boolean
initial_state: 'on'
trigger:
platform: state
entity_id: input_boolean.weihnachtsbeleuchtung
to: 'on'
# condition:
# - condition: state
# entity_id: group.anwesenheitssensoren
# state: 'home'
action:
- service: notify.Pushbullet
data:
message: 'Die Weihnachtsbeleuchtung wird eingeschaltet'
- service: script.turn_on
entity_id: script.weihnachtsbeleuchtung_einschalten
#
- alias: weihnachtsbeleuchtung_ausschalten_input_boolean
initial_state: 'on'
trigger:
platform: state
entity_id: input_boolean.weihnachtsbeleuchtung
to: 'off'
action:
- service: notify.Pushbullet
data:
message: 'Die Weihnachtsbeleuchtung wird ausgeschaltet'
- service: script.turn_on
entity_id: script.weihnachtsbeleuchtung_ausschalten
# Weihnachtsbeleuchtung Zeitsteuerung #####################
# Einschalten
- alias: 'Weihnachtsbeleuchtung zeitgesteuert einschalten'
initial_state: 'off'
trigger:
platform: template
value_template: '{{ states.sensor.time.state == states.sensor.einschaltzeit_weihnachtsbeleuchtung.state }}'
condition:
condition: or
conditions:
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung_nur_wenn_zuhause
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: 'group.all_devices'
state: 'home'
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung_nur_wenn_zuhause
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.weihnachtsbeleuchtung
# Ausschalten
- alias: 'Weihnachtsbeleuchtung zeitgesteuert ausschalten'
initial_state: 'off'
trigger:
platform: template
value_template: '{{ states.sensor.time.state == states.sensor.ausschaltzeit_weihnachtsbeleuchtung.state }}'
condition:
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.weihnachtsbeleuchtung
# Weihnachtsbeleuchtung über Kalender #####################
- alias: weihnachtsbeleuchtung_einschalten_kalender
initial_state: 'on'
trigger:
platform: state
entity_id: calendar.hassio
to: 'on'
condition:
condition: and
conditions:
- condition: template
value_template: "{{states.calendar.hassio.attributes.message == 'Weihnachtsbeleuchtung'}}"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung_nur_wenn_zuhause
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: 'group.all_devices'
state: 'home'
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung_nur_wenn_zuhause
state: 'on'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.weihnachtsbeleuchtung
# - service: notify.Pushbullet
# data:
# message: 'Google Kalender schaltet die Weihnachtsbeleuchtung ein'
# - service: script.turn_on
# entity_id: script.weihnachtsbeleuchtung_einschalten
# Weihnachtsbeleuchtung über Kalender
- alias: weihnachtsbeleuchtung_ausschalten_kalender
initial_state: 'on'
trigger:
platform: state
entity_id: calendar.hassio
to: 'off'
condition:
- condition: template
value_template: "{{states.calendar.hassio.attributes.message == 'Weihnachtsbeleuchtung' }}"
- condition: state
entity_id: input_boolean.weihnachtsbeleuchtung
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.weihnachtsbeleuchtung
# - service: notify.Pushbullet
# data:
# message: 'Google Kalender schaltet die Weihnachtsbeleuchtung aus'
# - service: script.turn_on
# entity_id: script.weihnachtsbeleuchtung_ausschalten
# Ende Weihnachtsbeleuchtung ##############################