Remove the Garbage Collection component
This commit is contained in:
@ -533,30 +533,6 @@
|
|||||||
else:
|
else:
|
||||||
- stop: Tornado alert re-activated
|
- stop: Tornado alert re-activated
|
||||||
mode: single
|
mode: single
|
||||||
- id: '1666474050350'
|
|
||||||
alias: Garbage Collection Update
|
|
||||||
description: ''
|
|
||||||
use_blueprint:
|
|
||||||
path: bruxy70/holiday_in_week.yaml
|
|
||||||
input:
|
|
||||||
garbage_collection_entity: sensor.garbage_collection
|
|
||||||
holiday_entity: calendar.holidays
|
|
||||||
- id: '1666474068445'
|
|
||||||
alias: Holiday in week
|
|
||||||
description: ''
|
|
||||||
use_blueprint:
|
|
||||||
path: bruxy70/holiday_in_week.yaml
|
|
||||||
input:
|
|
||||||
garbage_collection_entity: sensor.garbage_collection_large_pickup
|
|
||||||
holiday_entity: calendar.holidays
|
|
||||||
- id: '1666474091107'
|
|
||||||
alias: Large Garbage Collection Update
|
|
||||||
description: ''
|
|
||||||
use_blueprint:
|
|
||||||
path: bruxy70/holiday_in_week.yaml
|
|
||||||
input:
|
|
||||||
garbage_collection_entity: sensor.garbage_collection_large_pickup
|
|
||||||
holiday_entity: calendar.holidays
|
|
||||||
- id: '1667341156218'
|
- id: '1667341156218'
|
||||||
alias: White Noise Volume
|
alias: White Noise Volume
|
||||||
description: ''
|
description: ''
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
blueprint:
|
|
||||||
name: Move on holiday with include and exclude dates
|
|
||||||
description: "This automation is triggered from the `garbage_collection` integration
|
|
||||||
by event `garbage_collection_loaded`, during the device state update. \nIt PROCESSES
|
|
||||||
DATA SENT WITH THE EVENT, and then FINISHES THE UPDATE. DO NOT CALL THIS SERVICE
|
|
||||||
MANUALLY, IT WON'T WORK (it won't have the data).\nAlso, make sure the INTEGRATION
|
|
||||||
IS CONFIGURED FOR `manual_update` (that will disable the state update by the integration
|
|
||||||
and pass it to this automation).\n\nFirst, it excludes events on the provided
|
|
||||||
dated. Enter them one date per line. For example:\n2022-01-03\n2022-04-04\n\nThen,
|
|
||||||
it loops through the calculated dates and checks for a public holiday on the calculated
|
|
||||||
collection date. If found, it will move the event to the next day. It will keep
|
|
||||||
moving if the new collection date also falls on a public holiday.\n\nFinally,
|
|
||||||
it will add the events provided in the second list. Agaon, one date per line.\n\nThe
|
|
||||||
sensors are normally updated once a day, or when Home Assistant starts. The update
|
|
||||||
can be triggered by updating the integration configuration (just hit configure
|
|
||||||
and submit)."
|
|
||||||
domain: automation
|
|
||||||
source_url: https://github.com/bruxy70/Garbage-Collection/blob/master/blueprints/move_on_holiday_with_include_exclude.yaml
|
|
||||||
input:
|
|
||||||
garbage_collection_entity:
|
|
||||||
name: Garbage Collection Entity
|
|
||||||
description: Triggered by the event for this entity.
|
|
||||||
selector:
|
|
||||||
entity:
|
|
||||||
integration: garbage_collection
|
|
||||||
multiple: false
|
|
||||||
exclude:
|
|
||||||
name: Set of dates to exclude
|
|
||||||
description: List of dates in format yyyy-mm-dd, one date per line.
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
multiline: true
|
|
||||||
holiday_entity:
|
|
||||||
name: Holidays
|
|
||||||
description: Entity containing the holidays - an instance of Holidays custom
|
|
||||||
integration (available through HACS)
|
|
||||||
selector:
|
|
||||||
entity:
|
|
||||||
integration: holidays
|
|
||||||
multiple: false
|
|
||||||
include:
|
|
||||||
name: Set of dates to include
|
|
||||||
description: List of dates in format yyyy-mm-dd, one date per line.
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
multiline: true
|
|
||||||
mode: parallel
|
|
||||||
trigger:
|
|
||||||
- platform: event
|
|
||||||
event_type: garbage_collection_loaded
|
|
||||||
event_data:
|
|
||||||
entity_id: !input garbage_collection_entity
|
|
||||||
action:
|
|
||||||
- variables:
|
|
||||||
holiday_entity: !input holiday_entity
|
|
||||||
exclude: !input exclude
|
|
||||||
include: !input include
|
|
||||||
- alias: Iterate through the list of dates to exclude
|
|
||||||
repeat:
|
|
||||||
for_each: '{{ exclude.split(''
|
|
||||||
|
|
||||||
'') }}'
|
|
||||||
sequence:
|
|
||||||
- alias: Remove the date
|
|
||||||
service: garbage_collection.remove_date
|
|
||||||
data:
|
|
||||||
entity_id: '{{ trigger.event.data.entity_id }}'
|
|
||||||
date: '{{ repeat.item }}'
|
|
||||||
- alias: Iterate through the dates
|
|
||||||
repeat:
|
|
||||||
for_each: '{{ trigger.event.data.collection_dates }}'
|
|
||||||
sequence:
|
|
||||||
- alias: Is this date a public holiday?
|
|
||||||
condition: template
|
|
||||||
value_template: '{{ (repeat.item in state_attr(holiday_entity,''holidays''))
|
|
||||||
and (repeat.item not in exclude) }}'
|
|
||||||
- alias: Move the date
|
|
||||||
service: garbage_collection.offset_date
|
|
||||||
data:
|
|
||||||
entity_id: '{{ trigger.event.data.entity_id }}'
|
|
||||||
date: '{{ repeat.item }}'
|
|
||||||
offset: "{%- set collection_date = as_datetime(repeat.item) %} {%- set ns
|
|
||||||
= namespace(offset=1, found=false) %} {# Increase offset until we find a
|
|
||||||
date that is not public holiday #} {%- for _ in range(7) if not ns.found
|
|
||||||
%}\n {%- set d = ( collection_date + timedelta( days=ns.offset) ) | as_timestamp
|
|
||||||
| timestamp_custom(\"%Y-%m-%d\") %}\n {%- if d in state_attr(holiday_entity,'holidays')
|
|
||||||
%}\n {%- set ns.offset = ns.offset + 1 %}\n {% else %}\n {%- set
|
|
||||||
ns.found = true %}\n {%- endif %}\n{% endfor %} {{ ns.offset }}"
|
|
||||||
- alias: Iterate through the dates to include
|
|
||||||
repeat:
|
|
||||||
for_each: '{{ include.split(''
|
|
||||||
|
|
||||||
'') }}'
|
|
||||||
sequence:
|
|
||||||
- alias: Add the date
|
|
||||||
service: garbage_collection.add_date
|
|
||||||
data:
|
|
||||||
entity_id: '{{ trigger.event.data.entity_id }}'
|
|
||||||
date: '{{ repeat.item }}'
|
|
||||||
- alias: Update the garbage_collection entity
|
|
||||||
service: garbage_collection.update_state
|
|
||||||
data:
|
|
||||||
entity_id: '{{ trigger.event.data.entity_id }}'
|
|
Reference in New Issue
Block a user