I’m tearing my hair out over a stupid simple task - add a notif if tomorrow’s forecast is below 2 celsius. Studio Code finds no issues with this. In the logs there are 6 undecipherable “required key not provided @ data[‘triggers’]. Got None” messages.
In all searches and ai chat suggestions I only got old syntax both for templating and also for the usages of get_forecasts…
I tested the get_forecasts in the Developer/Actions tab (what every post still called “Services”, also recently changed).
The result format is like:
Is there a reason why you are not using the UI Automation Editor?
By adding hyphens in front of triggers: and actions: you have separated each of those into individual items… in essence creating 3 separate automations, each of which is missing critical parts.
The YAML interpreter sees it like this:
Automation 1: This one is missing the required keys triggers and actions
- id: "notif"
alias: "notif"
Automation 2: This one is missing the required key actions
ChatGPT and other LLMs are bullshit engines that are very bad at anything beyond the most basic Home Assistant configuration. They regularly fail to correctly configure even the simplest automations. Using them is a waste of your time and a guaranteed way to end up frustrated.
As an example, the template condition in the automation provided above is pure nonsense. The state_attr() function requires an entity ID as it’s first argument… result['weather.myweather'] will never return an entity ID.
Thanks a lot for this extensive reply!!! The most important part was the “-” separation, I never knew that they cut the whole template off in hass/jinja! <3
As for AI, I found it really useful for languages in general, but yeah, for HA templating it’s downright unusable sadly.
However, there is one error remaining and whatever I search for, there is no answer
Trigger Update Coordinator: Error executing script. Service not found for call_service at pos 1: Action weather.get_forecast not found
I tried with multiple weather providers and this error remains, even if the syntax seems to be correct everwhere - also, it’s the same syntax that the Developer tools/Actions yaml gives, where it works.
Look closer. Your error message says weather.get_forecast not found. All the previous code on this page (both your own AI-generated or whatever it was and Didgeridrew’s example) says weather.get_forecasts as in plural with a trailing s.
Yes, exactly. But it’s written nowhere without an s. The error also appears if I remove the automation completely.
There is no automation or config where get_forecast is present. Even if I try to disable the weather integration the error still appears when I reload Template Entities.
Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/template/coordinator.py", line 115, in _handle_triggered_with_script
if script_result := await self._script.async_run(run_variables, script_context):
homeassistant.exceptions.ServiceNotFound: Action weather.get_forecast not found
I always just reloaded all YAML configurations before, after I restarted HA completely, this error now went away. Maybe somehow an older version of the automation stuck in memory, regardless of later changes?
Anyway, thank you everyone in this thread. This community is great!