I updated my HAOS to the most recent core 2024.10.2. and now a working switch template is giving me all kinds of errors and I can’t seem to figure out why.
Logger: homeassistant.config
Source: config.py:1300
First occurred: 9:01:14 PM (1 occurrences)
Last logged: 9:01:14 PM
Invalid config for 'switch' from integration 'template' at configuration.yaml,
line 39: expected dictionary for dictionary value 'switches->value_template', got "{{ is_state('switch.source', 'on') }}",
please check the docs at https://www.home-assistant.io/integrations/template Invalid config for 'switch' from integration 'template' at configuration.yaml, line 40: expected dictionary for dictionary value 'switches->friendly_name', got 'relax time'
, please check the docs at https://www.home-assistant.io/integrations/template
Invalid config for 'switch' from integration 'template' at configuration.yaml, line 41: required key 'turn_off' not provided, please check the docs at https://www.home-
assistant.io/integrations/template Invalid config for 'switch' from integration 'template' at configuration.yaml, line 41: required key 'turn_on' not provided, please
check the docs at https://www.home-assistant.io/integrations/template Invalid config for 'switch' from integration 'template' at configuration.yaml, line 43: 'target' is an
invalid option for 'template.switch', check: switches->turn_on->target, please check the docs at https://www.home-assistant.io/integrations/template Invalid config for
'switch' from integration 'template' at configuration.yaml, line 51: 'action' is an invalid option for 'template.switch', check: switches->turn_on->action, please check
the docs at https://www.home-assistant.io/integrations/template Invalid config for 'switch' from integration 'template' at configuration.yaml, line 54: required key
'turn_off' not provided, please check the docs at https://www.home-assistant.io/integrations/template Invalid config for 'switch' from integration
'template' at configuration.yaml, line 54: required key 'turn_on' not provided, please check the docs at https://www.home-assistant.io/integrations/template Invalid config
for 'switch' from integration 'template' at configuration.yaml, line 56: 'target' is an invalid option for 'template.switch', check: switches->turn_off->target, please check
the docs at https://www.home-assistant.io/integrations/template Invalid config for 'switch' from integration 'template' at configuration.yaml, line 58: 'action' is an
invalid option for 'template.switch', check: switches->turn_off->action, please check the docs at https://www.home-assistant.io/integrations/templatetype or paste code
here
Here is my template when it worked.
switch:
- platform: template
switches:
copy:
value_template: "{{ is_state('switch.source', 'on') }}"
friendly_name: "relax time"
turn_on:
action: switch.turn_on
target:
entity_id: switch.hallway
action: switch.turn_off
target:
entity_id: switch.kitchen
action: light.turn_on
target:
entity_id: light.master_bedroom_light_group
action: switch.turn_on
target:
entity_id: switch.tv_josh_switch
turn_off:
action: switch.turn_off
target:
entity_id: switch.hallway
action: light.turn_off
target:
entity_id: light.master_bedroom_light_grouptype or paste code here