I try to setup automations for my heating system. In that case, I have put the target temperature in an input_number (1st automation) and I want to put the value into the heating thermostat (2nd automation).
I’m fighting with syntax at the last line. I’ve tried a lot of formalism without success. The last error is :
Error loading /config/configuration.yaml: invalid key: "OrderedDict([(‘states(input_number.temp_prevue_vanne_salon)’, None)])
Thanks for your help. Using your syntax, I can restart HA, but execution fails :
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/automation/init.py”, line 404, in async_trigger
await self.action_script.async_run(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1026, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 242, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 250, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 429, in _async_call_service_step
domain, service_name, service_data = service.async_prepare_call_from_config(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 190, in async_prepare_call_from_config
raise HomeAssistantError(f"Error rendering data template: {ex}") from ex
homeassistant.exceptions.HomeAssistantError: Error rendering data template: UndefinedError: ‘input_number’ is undefined
I’ve checked with Delevoper Tool. Value in the input number is 22.0
What seems strange to a newbye like me is that “temperature” need a float value. I would say syntax you gave would produce a string…
2021-01-31 16:19:45 ERROR (MainThread) [homeassistant.components.automation.automatisme_vanne_salon] Automatisme_Vanne-Salon: Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: UndefinedError: ‘input_number’ is undefined
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 353, in async_render
render_result = compiled.render(kwargs)
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 1090, in render
self.environment.handle_exception()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File “/usr/local/lib/python3.8/site-packages/jinja2/_compat.py”, line 28, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py”, line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘input_number’ is undefined
I take advantage of this topic to ask for your help. I can’t get my script to work properly.
I created an input_number entry with a slider to set the percentage battery I want. Once the script is executed, it must turn on my socket which my phone charger is plugged into, then (the problem is there), I ask to wait until the desired percentage is reached. I ended up turning off the phone socket. My problem, once the percentage is reached, my socket does not turn off. Can anyone help me?
Your wait_template is not a template, it’s a state trigger… and you can’t use templates within a state trigger. Also, you should define a timeout for your continue_on_timeout.
However, it’s generally best not to rely on waits. Instead, create an automation that triggers on your desired state or event, with conditions as appropriate.