Skip to content

Instantly share code, notes, and snippets.

@oischinger
Created October 2, 2019 18:53
Show Gist options
  • Save oischinger/7483bc937dc36765a747a4c3cea42a40 to your computer and use it in GitHub Desktop.
Save oischinger/7483bc937dc36765a747a4c3cea42a40 to your computer and use it in GitHub Desktop.
Vacuum zones script
script:
vacuum_zones_erdgeschoss:
alias: "Erdgeschoss Zonen saugen"
sequence:
- service: vacuum.send_command
data_template:
entity_id: 'vacuum.rockrobo'
command: 'zoned_cleanup'
params:
'zone_ids':
- "{%- if states('input_boolean.flur_vacuum_zone') == 'on' %}flur{% endif %}"
- "{%- if states('input_boolean.kueche_vacuum_zone') == 'on' %}kueche{% endif %}"
- "{%- if states('input_boolean.essbereich_vacuum_zone') == 'on' %}essbereich{% endif %}"
- "{%- if states('input_boolean.sofa_vacuum_zone') == 'on' %}sofa{% endif %}"
- "{%- if states('input_boolean.wohnzimmerwand_vacuum_zone') == 'on' %}wohnzimmerwand{% endif %}"
- "{%- if states('input_boolean.wintergarten_vacuum_zone') == 'on' %}wintergarten{% endif %}"
@pax2011
Copy link

pax2011 commented Oct 15, 2019

Copied your config, but doesn't work. my input_booleans can trigger automations but no scripts

This automations works
auto

This scipt doesn't
script

I'm getting mad to solve this. The zone name is correct because with automation it works.
In homeassistant' register I can see boolean changed status, automations activations, but script isn't triggered.

@oischinger
Copy link
Author

I added the script to my lovelace ui as an entity and just trigger it from there manually. There is no automatic start when the input_booleans change state or similar

@pax2011
Copy link

pax2011 commented Oct 15, 2019

Sorry if I'm boring you. I use the raw unit editor, where and how should I insert the script? I tried in the map card but it still doesn't work. Could you send me your configuration as example?

@oischinger
Copy link
Author

oischinger commented Oct 15, 2019

No worries. My lovelace card is a vertical stack card in a card composed from an entities card (which only has a single script entity) and the picture-elements card which you already have.

So just add an independent entities card like this:

type: entities
entities:
  - entity: script.vacuum_zone_pulizia
    name: Zoned cleanup

I suggest to read this https://www.home-assistant.io/lovelace/vertical-stack/ if you then want to combine those two cards in one.

@pax2011
Copy link

pax2011 commented Oct 15, 2019

Finally it works, thanks for support!
I was helped here too. https://community.home-assistant.io/t/data-templates-input-boolean-in-scripts-i-cant-solve-this/142568/6
You are advised to replace
states('input_boolean.floor1camera_vacuum_zone') == 'on'
with:
is_state('input_boolean.floor1camera_vacuum_zone', 'on')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment