Suppress Template Sensor Warning in 0.81.1?

I’ve created some template sensors to report battery levels of door and motion sensors. I’ve had to make the sensors in a runabout way to prevent an error when booting up HA (the zwave state isn’t available for a few minutes).

This is my template sensor code (if anyone can think of a better way to do this, please let me know):

kitchen_motion_battery:
  friendly_name: "Kitchen Motion Battery"
  icon_template: mdi:battery-outline
  value_template: >
    {% if states('zwave.dome_motion_detector_kitchen') == 'initializing' or states('zwave.dome_motion_detector_kitchen') == 'sleeping' %} {{ states.zwave.dome_motion_detector_kitchen.attributes.battery_level }}%
    {% else %} Unknown
    {% endif %}

With 0.81, I’ve also created an automation that updates the template sensor every 30 minutes.

- id: update_window_door_battery_sensors
  alias: Maintenance- Update Window Door Battery Sensors
  trigger:
    - platform: time
      minutes: '/30'
  action:
    - service: homeassistant.update_entity
      entity_id:
        - sensor.kitchen_motion_battery

Everything is working as expected. :smiley:

However, I still receive a warning when booting up HA, the warning is:

Template sensor kitchen_motion_battery has no entity ids configured to track nor were we able to extract the entities to track from the icon template(s). This entity will only be able to be updated manually.

How do I suppress or dismiss this warning or does someone know a better way to get the battery level that wouldn’t cause the warning? Just an a FYI, I tried using the following but still got the same error.

value_template: >
    {{ state_attr('zwave.dome_motion_detector_kitchen', 'battery_level') }}

My template sensor also got this error. I fixed it by adding an entity_id: section.

It was solved by looking at

Thank you, that seems to have removed the warning!

Also, it looks like i don’t need the update_window_door_battery_sensors automation anymore.

You can use entity_id: [] in your templates to avoid this message.
Check the official doc.

    kitchen_motion_battery:
       friendly_name: "Kitchen Motion Battery"
       entity_id: []
       icon_template: mdi:battery-outline
       value_template: >
         {% if states('zwave.dome_motion_detector_kitchen') == 'initializing' or states('zwave.dome_motion_detector_kitchen') == 'sleeping' %} {{ states.zwave.dome_motion_detector_kitchen.attributes.battery_level }}%
         {% else %} Unknown
         {% endif %}
1 Like