hi, I’m trying to do my first automation, for the disposal of garbage, but I can’t go on as these errors result, could someone kindly help me, thanks in advance.
the sensors were created with Garbage Collection
2022-11-23 23:35:03.115 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: ‘dict object’ has no attribute ‘from_state’ when rendering ‘Attenzione: domani è giorno di ritiro frazione {{ trigger.from_state.attributes.friendly_name }}.’
2022-11-23 23:35:03.121 ERROR (MainThread) [homeassistant.components.automation.notifica_tts_ritiro_mastello] Notifica ritiro spazzatura: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘from_state’
2022-11-23 23:35:03.137 ERROR (MainThread) [homeassistant.components.automation.notifica_tts_ritiro_mastello] Error while executing automation automation.notifica_tts_ritiro_mastello: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘from_state’
ok perfect thank you, but wanting to add the notification via alexa? what should i put in the code? I’m sorry if I’m taking advantage but I’m a beginner
It’s possible but it’s not straightforward. It requires a connection between your Home Assistant and Amazon’s Alexa services and there’s more than one way to do it. You can send a Text-To-Speech message to an Echo via:
Home Assistant Cloud (paid service provided by Nabu Casa)
Alexa Media Player custom integration
Direct connection if your Home Assistant is accessible via the internet
There are other ways as well but the one via Nabu Casa is probably the simplest (but it’s not free).
It will fail to report trigger.to_state.name when it triggers at 20:30 for the reason I explained in my previous post. A Time Trigger only provides trigger.platform and trigger.now.
NOTE
Please format the YAML you post. Unformatted YAML is difficult to read.
Select the YAML and click the </> icon in the forum’s editing menu. For more information, refer to guideline 11 in the FAQ.
Based on your reply, you appear to have misunderstood my question.
The Time Trigger doesn’t produce trigger.to_state.name so it cannot use the same message as the one you have when the automation is triggered by its Numeric State Trigger.
The message it uses must reference different information. What is the information you want it to report? For example, do you want it to report the days value of each sensor or only the sensors that are below 1 or what?
I would like to have the notification both on the phone and on alexa of the ‘0’ which cyclically appears on the sensors I created with “Garbage Collection”, at a set time, for example 20:30