The release notes show how to use the weather.get_forecast
for both automations and template sensors, but each has it’s own requirements… they are not interchangeable or combine-able. The allowed configuration keys are listed in the docs for each under the heading “Configuration Variables”
Automations: Allowed Configuration Keys
Template Sensor: Allowed Configuration Keys
If you get the Message malformed: extra keys not allowed...
error, check your configuration to make sure you don’t have keys in your configuration that aren’t in the related allowed list.
The first step is to identify the problem you are trying to solve or the goal you are trying to accomplish.
Template sensors are used when you need an entity to hold a dynamic value which is derived from other data; especially in cases where you need to have access to that value in multiple places such as automations, scripts, or in dashboard cards. As of 2023.9, basic template sensors can be created in Settings > Devices & Services > Helpers menu; more advanced template sensors like those with triggers must be set up using YAML in configuration.yaml
, templates.yaml
, or other properly included files.
In HA, a script is a sequence of actions. The sequence can include conditional and branching logic. You can think of scripts kind of like sub-routines that can be called by automations, dashboard cards, or other scripts.
Automations are essentially a script with at least one defined trigger.
The template editor tool only renders templates, it does not understand yaml at all. In the example service call posted, data
is not indented properly. It should be at the same depth as service
.
If you are just starting out, you may want to use the UI automation and script editors to build the “skeleton” of your automations, then switch over to YAML to add templates where necessary. There is a good (but slightly dated) video available on the ResinChem youtube channel that covers converting YAML automations to UI automations.