I have template switches for my TVs. These have been working for a long time (years). Turning on the TV via the template switch works, but Since 2024.9, when I try to turn off the TV, I get the following error:
AttributeError: 'str' object has no attribute 'async_render_to_info'
I have narrowed it down to the wait_template in my switch definition:
switch:
- platform: template
switches:
bedroom_tv:
unique_id: 9F8E6127-9825-4667-B3CE-0C6FFC5B2BE2
value_template: "{{ not is_state('media_player.bedroom_atv', 'standby') }}"
turn_on:
service: media_player.turn_on
target:
entity_id: media_player.bedroom_atv
turn_off:
- service: remote.send_command
target:
entity_id: remote.bedroom_atv
data:
delay_secs: 2
command:
- top_menu
- top_menu
- wait_template: "{{ is_state('media_player.bedroom_atv', 'idle' )}}"
timeout: "00:00:10"
- service: media_player.turn_off
target:
entity_id: media_player.bedroom_atv
If I remove or disable the wait_template, then everything works. As I said, this all worked until 2024.9 (or maybe 2024.9.1 or .2 - I can’t remember which version I updated to from 2024.8.x). For reference, the full error is below:
2024-09-14 12:21:12.385 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140417301943136] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/template/switch.py", line 218, in async_turn_off
await self.async_run_script(self._off_script, context=self._context)
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 563, in async_run_script
await script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 283, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1245, in _async_sequence_step
await self._async_run_script(sequence)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1268, in _async_run_script
result = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 674, in _async_wait_template_step
if condition.async_template(self._hass, wait_template, self._variables, False):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 773, in async_template
info = value_template.async_render_to_info(variables, parse_result=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'async_render_to_info'