Skip to content

Instantly share code, notes, and snippets.

@pavax
Last active December 24, 2020 13:43
Show Gist options
  • Save pavax/23a2c0eaed37d6ee0a25600ee46f2354 to your computer and use it in GitHub Desktop.
Save pavax/23a2c0eaed37d6ee0a25600ee46f2354 to your computer and use it in GitHub Desktop.
home-ssistant script: [vacuum] room dispatcher
alias: '[vacuum] room dispatcher'
sequence:
- variables:
room_name: >-
{{room_name|lower|replace('ä','ae')|replace('ü','ue')|replace('ö','oe')
}}
room_last_trigger: 'input_datetime.vacuum_{{room_name}}_last_schedule_triggered'
room_zone: '{{ state_attr(room_last_trigger,''zone'') }}'
- condition: template
value_template: '{{ room_zone != null }}'
- service: input_datetime.set_datetime
data:
entity_id: '{{ room_last_trigger }}'
timestamp: '{{ now().timestamp() }}'
- service: vacuum.send_command
data:
entity_id: vacuum.xiaomi_vacuum_cleaner
command: app_zoned_clean
params: '{{ room_zone }}'
- service: input_select.select_option
data:
entity_id: input_select.vacuum_room
option: '{{ state_attr(room_last_trigger, ''room_name'') }}'
mode: single
variables:
room_name: '{{ room_name }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment