AutomationDataset/pascaliske/pascaliske_automations.yaml

226 lines
6.0 KiB
YAML

- alias: Check Home Assistant Version once a day
triggers:
- platform: homeassistant
event: start
- platform: time
at: 08:00:00
conditions:
condition: template
value_template: '{{ states(''sensor.latest_version'') > states(''sensor.current_version'')
}}
'
actions:
- action: notify.home_assistant
data_template:
target:
- secret discord_channel
title: Update available
message: Theres a new version of Home Assistant Core available
data:
embed:
title: '{{ states(''sensor.current_version'') }}
'
color: 15105570
url: 'https://www.home-assistant.io/latest-release-notes
'
fields:
- name: Current Version
value: '{{ states(''sensor.current_version'') }}
'
inline: false
- name: Latest Version
value: '{{ states(''sensor.latest_version'') }}
'
inline: false
- name: Release Notes
value: 'https://www.home-assistant.io/latest-release-notes
'
inline: false
- name: Source Code
value: 'https://github.com/home-assistant/core/releases/tag/{{ states(''sensor.latest_version'')
}}
'
inline: false
- action: persistent_notification.create
data_template:
title: Update available
notification_id: Update available
message: 'New version available: [{{ states(''sensor.latest_version'') }}](https://github.com/home-assistant/core/releases/tag/{{
states(''sensor.latest_version'') }}) | [Releases](https://www.home-assistant.io/blog/categories/release-notes/)
'
- alias: Good Night
triggers:
- platform: time
at: 00:00
- platform: event
event_type: ios.action_fired
event_data:
actionName: Good Night
- platform: state
entity_id: input_boolean.vacation_mode
to: 'on'
actions:
- action: switch.turn_off
target:
entity_id: group.all_switches
- action: light.turn_off
target:
entity_id: group.all_lights
- alias: Office Desk Turn Off After Sunrise
description: This automation turns off the Office Desk light around 10 minutes after
sunrise depending on the actual sun elevation in degrees.
triggers:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: 2.5
actions:
- action: light.turn_off
target:
entity_id: light.office_desk_wled
data:
transition: 30
- alias: Startup Checks
triggers:
- platform: homeassistant
event: start
actions:
- action: frontend.set_theme
data:
name: Google - Dark
- action: notify.home_assistant
data:
target:
- secret discord_channel
title: Home Assistant
message: ':white_check_mark: System has been started successfully
'
- alias: Travel Log Tag
mode: single
triggers:
- platform: tag
tag_id: d8011321-ba8d-482b-81ad-41f5dfbedd74
conditions:
condition: not
conditions:
- condition: state
entity_id: device_tracker.pascals_iphone
state: home
actions:
- variables:
latitude: '{{ state_attr("device_tracker.pascals_iphone", "latitude") }}'
longitude: '{{ state_attr("device_tracker.pascals_iphone", "longitude") }}'
- action: rest_command.travel_log
data:
latitude: '{{ latitude }}'
longitude: '{{ longitude }}'
- action: notify.mobile_app_pascals_iphone
data:
title: Travel Log Created
message: 'Current position logged to Travel Log: {{ latitude }}, {{ longitude
}}
'
- alias: Vacation Mode Notification
triggers:
platform: state
entity_id:
- binary_sensor.hallway_entrance_door_lumi_contact
- binary_sensor.kitchen_balcony_door_lumi_contact
- binary_sensor.guest_bathroom_window_lumi_contact
from: 'off'
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
actions:
- action: notify.home_assistant
data_template:
target:
- secret discord_channel
title: Vacation Mode Notification
message: ':door: The {{ trigger.to_state.attributes.friendly_name }} was opened
'
- alias: Vacation Mode Tag
mode: single
triggers:
- platform: tag
tag_id: 598a8118-a5e4-4610-9078-ee90a1dda05b
actions:
- action: notify.home_assistant
data:
target:
- secret discord_channel
title: Vacation Mode
message: ':palm_tree: Vacation Mode will be {{ ''enabled in 3 minutes'' if is_state(''switch.vacation_mode'',
''off'') else ''disabled immediately'' }}.
'
- delay: '{{ ''00:03'' if is_state(''switch.vacation_mode'', ''off'') else ''00:00''
}}'
- action: switch.toggle
data:
entity_id: switch.vacation_mode
- alias: Vacation Mode was turned off
condition: state
entity_id: switch.vacation_mode
state: 'on'
- action: homeassistant.turn_off
data:
entity_id:
- group.all_switches
- group.all_lights
- alias: Window Close Reminder
triggers:
platform: state
entity_id:
- binary_sensor.guest_bathroom_window_lumi_contact
to: 'on'
for:
minutes: 5
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: numeric_state
entity_id: weather.home
attribute: temperature
below: 16
actions:
- action: notify.home_assistant
data_template:
target:
- secret discord_channel
title: Close Reminder
message: ':window: The {{ trigger.to_state.attributes.friendly_name }} is open
for 5 minutes with {{ state_attr(''weather.home'', ''temperature'') }}°C outside
- close it now
'
- alias: Work
triggers:
- platform: event
event_type: ios.action_fired
event_data:
actionName: Work
actions:
- action: script.turn_on
target:
entity_id: script.office_desk_activate
data:
variables:
preset: Morning