@KingQuokka wrote:
Hi,
I’m trying to create a script that toggles groups of entities states from either all on to all off.
My code in scripts.yaml:
toggle_group: alias: 'Toggle Group On/Off' sequence: - service_template: > {% if is_state(group_id,'off') %} homeassistant.turn_on {% else %} homeassistant.turn_off {% endif %} service_data: entity_id: "{{ state_attr(group_id,'entity_id') | join(', ') }}"
My code in lovelace yaml
- cards: - entity: group.all_home_theatre_lights icon: 'mdi:lightbulb' name: All state: - color: 'rgb(253,216,53)' value: 'on' tap_action: action: call-service service: script.toggle_group service_data: group_id: 'group.all_home_theatre_lights' type: 'custom:button-card'
I’m also using the custom button-card.
The error I’m getting from home assistant is:
[homeassistant.config] Invalid config for [script]: [service_data] is an invalid option for [script]. Check: script->script->toggle_group->sequence->0->service_data. (See /config/configuration.yaml, line 26).
I’m not too sure what this means, I’m fairly new to home assistant.
My Home Assistant is running on Synology inside docker, latest build.
Please let me know if you have any suggestions. Thanks.
Posts: 1
Participants: 1