Template variable warning: 'zha_device' is undefined when rendering '{{ zha_device }}'

i’ve just started to work through cleaning up some HA errors/warnings that i know are definately a problem (old&dead config that has only partially cleaned up) in the logs and came across this one that i cannot find a solution for.

Logger: homeassistant.helpers.template
Source: helpers/template.py:230
First occurred: 7 May 2023 at 17:33:56 (43 occurrences)
Last logged: 08:00:09
Template variable warning: ‘zha_device’ is undefined when rendering ‘{{ zha_device }}’

It seemed clear enough to go poke around the Helpers , but i cannot find which helper it’s referring to, nore do i knowingly appear to have any issues with automations that use the helpers to indicate an issue that’d need looking at.

i’ve also looked at my config & templates yaml file and no reference to a {{ ZHA device }} either. Yes i do use ZHA, but nothing i can find relates to this warning message.
where do i need to look to fix this one?

If you looked for exactly what you wrote there then you likely wont find it.

The error is referring to {{zha_device}} not what you wrote above.

are you using blueprints? Seems like this is coming from a blueprint that has a zigbee device input.

Yes, and some use ZHA devices. I’ve checked the yaml files in config/blueprints/… path and found possible related lines with Dustin’s Hue smart dimmer & remote blueprint.
i’ll take a deeper look when i get a bit of time over the next few days…

There’s a bug in the blueprint.

  - service: logbook.log
    data:
      name: Device
      message: "{{ zha_device }}"

zha_device doesn’t exist. It should be

  - service: logbook.log
    data:
      name: Device
      message: "{{ device_id }}"

you could also just remove that all together.