#actions not allowed for some reason
1 messages ยท Page 1 of 1 (latest)
template:
- trigger:
- platform: time_pattern
hours: /1
action:
- service: weather.get_forecast
data:
type: hourly
target:
entity_id: weather.home
response_variable: hourly
sensor:
- name: Weather Forecast Hourly
unique_id: weather_forecast_hourly
state: "{{ now().isoformat() }}"
attributes:
forecast: "{{ hourly.forecast }}"
this is what's in the manual... however, when i paste literally this in my templates.yaml file
it says: action not allowed
you need to remove the template: line if you just paste that in templates.yaml
i iknow that ๐
i have that , indeed ๐
just going on what you said
so I pasted the "paste" without template:
my guess is that you're using an old version of HA
it says; property action is not allowed
what is "it"?
hmm.... i will try again, with my actual goal ๐
is there a way i can manually trigger this?:
- trigger:
- platform: time_pattern
hours: /1
action:
- service: calendar.list_events
target:
entity_id: calendar.family
response_variable: agenda
sensor:
- name: agenda_items
unique_id: agenda_items
state: "{{ agenda.events | count() }}"
attributes:
scheduled_events: "{{ agenda.events }}"
if not, debugging will be a pita ๐
yes, with homeassistant.update_entity
it's a normal service call
service: homeassistant.update_entity
entity_id: sensor.agenda_items
i'll look for it in developer tools
it doesn't seem to work as expected ๐ฆ
- trigger:
- platform: time_pattern
hours: /1
action:
- service: calendar.list_events
data:
duration:
hours: 180
target:
entity_id: calendar.family
response_variable: agenda
sensor:
- name: agenda_items
unique_id: agenda_items
state: "{{ agenda.events | count() }}"
attributes:
scheduled_events: "{{ agenda.events }}"
i changed it from 48 hours to 180, but the value stays the same...
i would have expected more entries
ok
if i change it to 10 hours... so should only have 1 entry... it's still 6 (what was correct for 48 hours
any clue?
no
I think there's actually a bug there
if I call homeassistant.update_entity on a template sensor with a trigger defined, I get an error in the log:
- trigger:
platform: time_pattern
hours: /1
sensor:
- name: action_test_trigger
state: "{{ now() }}"
- sensor:
- name: action_test_no_trigger
state: "{{ now() }}"
Call homeassistant.update_entity on the first one and I get
2023-10-21 12:21:30.851 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.action_test_trigger fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 732, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 991, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 507, in async_update
await self.coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 240, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 93, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 266, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 356, in _async_refresh
raise err
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 245, in _async_update_data
raise NotImplementedError("Update method not implemented")
NotImplementedError: Update method not implemented
second one works fine
Filed an issue: https://github.com/home-assistant/core/issues/102488
hmm.... thanks
ahm... i'm lost...
- trigger:
- platform: time_pattern
hours: /3
action:
- service: weather.get_forecast
data:
type: daily
target:
entity_id: weather.openweathermap
response_variable: weathertoday
sensor:
- name: "today maximum temperature"
unique_id: today_maximum_temperature
state: "{{ weathertoday.forecast[0].temperature | float}}"
- name: "today precipitation"
unique_id: today_precipitation
state: "{{ weathertoday.forecast[0].precipitation | float }}"
can someone tell me what's wrong with this?
i really don't get it
i tried... for hours and nowhere an example to be found
this shouldn't be hard, but i failed...
should it be: state_attr('weathertoday.forecast[0]', 'temperature') ? i tried that too...