cataseven
(Cataseven)
August 10, 2022, 10:08pm
1
Hi all,
What I am looking for but couldn’t find is to open only closed covers or close only open covers. Right now, I am using open_cover services and use “entity: all” however this method triggers all covers whether they are open or not.
Can we say open only closed covers and do nothing for open ones?
tom_l
August 10, 2022, 10:18pm
2
action:
- service: cover.open_cover
target:
entity_id: "{{ states.cover | selectattr('state','eq','closed') | map(attribute='entity_id') | list | join(', ') }}"
cataseven
(Cataseven)
August 10, 2022, 10:58pm
3
Thank you so much
This worked if I call from service tool on developer page however not working for button tap action.
Errorcode is
Failed to call service cover/close_cover. Templates are not supported here. Got {‘type’: ‘call_service’, ‘domain’: ‘cover’, ‘service’: ‘close_cover’, ‘target’: {‘entity_id’: Template("{{ states.cover | selectattr(‘state’,‘eq’,‘open’) | map(attribute=‘entity_id’) | list | join(’, ') }}")}, ‘service_data’: {}, ‘id’: 1155}
type: custom:mushroom-template-card
primary: CLOSE
secondary: All Shutters
icon: mdi:window-shutter
tap_action:
action: call-service
service: cover.close_cover
data: {}
target:
entity_id: >-
{{ states.cover | selectattr('state','eq','open') |
map(attribute='entity_id') | list | join(', ') }}
badge_icon: mdi:arrow-down-bold
badge_color: red
fill_container: true
multiline_secondary: false
icon_color: white
layout: horizontal
card_mod:
style: |
ha-card {
height: 73px !important;
--icon-size: 48px;
}
tom_l
August 10, 2022, 11:46pm
4
You can’t use templates in nearly all core dashboard cards.
Unless you use something like this:
Lovelace Templates
I’ve gone and made a crazy card that allows you to pretty much template anything in Lovelace for your card configurations using any information available on the frontend; states, attributes, user, etc.
Want state/attribute-based icons? DONE!
Want dynamic stacks; vertical vs horizontal based on user? DONE!
Want OR conditionals? DONE!
The list is pretty much endless and I’m sure you all will come up with some crazy stuff. Be sure to share.
Go nuts! Enjoy!
The other option is to put the action in a script and call the script as the tap action.
cataseven
(Cataseven)
August 11, 2022, 11:34am
6
Thank you so much. One last question. How can i say “open covers which are not open”
I mean it can be open, closed, closing, unavailable… etc
tom_l
August 11, 2022, 11:36am
7
action:
- service: cover.open_cover
target:
entity_id: "{{ states.cover | rejectattr('state','eq','open') | map(attribute='entity_id') | list | join(', ') }}"
3 Likes
Using the following to close any open garage doors at 1:30 am via Ratgdo.
alias: Close open GDOs at night
description: close at open garage doors late at night
trigger:
- platform: time
at: "01:30:00"
condition: []
action:
- service: cover.close_cover
target:
entity_id: >-
{{ states.cover | rejectattr('state','eq','closed') |
map(attribute='entity_id') | list | join(', ') }}
data: {}
mode: single