leofabri / hassio_appliance-status-monitor

🔌 Detect the state of your appliances based on their power consumption ✨
238 stars 18 forks source link

Errors around 'appliance_socket' in template #35

Open scottfridwin opened 4 months ago

scottfridwin commented 4 months ago

Not sure when this started or why, but I am seeing these errors and the associated automated have stopped working:

2024-05-10 15:31:49.089 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'appliance_socket' is undefined when rendering '{{ states(appliance_socket) == 'off' }}' 2024-05-10 15:31:49.090 WARNING (MainThread) [homeassistant.helpers.script] Error in 'choose[0]' evaluation: In 'template' condition: UndefinedError: 'appliance_socket' is undefined

I was able to find and fix the issue in the source yaml. I'll create a PR with the changes and link it here so others who run into the same issue might be able to fix it.

scottfridwin commented 4 months ago

PR: #36 Targeting the dev branch (I assume that is where new changes go).

If anyone sees this and is trying to fix their own implementation you will want to edit the blueprints/automation/leofabri/appliance-status-monitor.yaml file manually and replace the template conditions with state conditions like I show in the PR.