Nest thermostat broken in 2023.2.5

Nest was working on 2023.2.4. Updated to .5, rebooted and Nest entities are unavailable. reloading integration or total system reboot doesn’t resolve.

Home Assistant 2023.2.5
Supervisor 2023.01.1
Operating System 9.5

From the logs:

2023-02-16 18:52:23.786 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{ '%0.1f'|format(state_attr('climate.hallway', 'temperature')) }}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 457, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1984, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.10/site-packages/jinja2/filters.py", line 1002, in do_format
    return soft_str(value) % (kwargs or args)
TypeError: must be real number, not NoneType

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 575, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 459, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: must be real number, not NoneType
2023-02-16 18:52:23.794 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('TypeError: must be real number, not NoneType') while processing template 'Template("{{ '%0.1f'|format(state_attr('climate.hallway', 'temperature')) }}")' for attribute '_attr_native_value' in entity 'sensor.hallwaynest_target'

Rolled back to 2023.2.4 and it’s working again - so seems broken in 2023.2.4

Weird. Mine are fine on 2023.2.5

That error is reporting a problem with a template you created.

Are there other errors in the log? Was all the NEST data unavailable?

That’s the thing - I didn’t create any templates. SImply installed the add-in and let it create the entities. Going to upgrade, remove and re-add the integration

You have this:[

quote=“madmic1314, post:1, topic:536167”]
Template("{{ '%0.1f'|format(state_attr('climate.hallway', 'temperature')) }}")' for attribute '_attr_native_value' in entity 'sensor.hallwaynest_target'
[/quote]

Ah - I see now, yep, there it was deep in a yaml file from time gone by. Removed it now and all working ok - thanks for the pointer

So this is odd - removed the below from a yaml file (sensor.yaml)

  - platform: template
    sensors:
      hallwaynest_target:
        friendly_name: "Hallway Nest Target"
        value_template: "{{ '%0.1f'|format(state_attr('climate.hallway', 'temperature')) }}"
      hallwaynest_mode:
        friendly_name: "Hallway Nest Mode"
        value_template: "{{ '%s'|format(state_attr('climate.hallway', 'hvac_action')) }}"  

and all was working on a reboot on 2023.2.5. The issue is I use those entities elsewhere, decided to look into what was wrong. They passed through the template checker with no issues. Put them back into the yaml, no changes to the formatting / code, rebooted HA and it’s working again :confused:

It’s like there was something that needed to run between 2023.2.4 and .5 that couldn’t with this templating??? Allowing it to go through and then adding back in sorted it… weird.

If those sensors are unavailable that template will fail. This could occur at startup.