Trying to make a light toggle that includes data. This means that light.toggle cannot be used because it doesn’t accept data (except entity_id). So, light.turn_on and light.turn_off then. The last one also doesn’t accept data (except entity_id) so it requires variables. First to see which service to use (on or off), then to determine if data can be send along. Which in case of on could be brightness for example.
The service part works correctly. The data part ruins something.
In /dev-template it seems to render as in mind. However, when checking the config: Invalid config for [automation]: expected a dictionary for dictionary value @ data['action'][0]['data_template']. Got None. (See /config/configuration.yaml, line 423). Please check the docs at https://home-assistant.io/components/automation/
I tried lots of variants, which and without quotes, brackets, etc. etc. How to get this working?
What you are trying to do is not possible with in a template. Templates can only be applied to a single field, you cannot have multiple fields inside a template.
Next, you are going to run into issues with light.turn_off not accepting brightness as a field. So, you need to work around that. There’s 2 ways to handle this. 2 automations or 1 automation and 2 scripts. Personally, I think the 2 automations is easier to manage.