Z-Wave battery template error

I’m getting the following error appear all the time in the logs (after a restart I’m assuming).

2018-11-01 15:44:04 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: <state zwave.frontdoor_deadbolt=unknown; node_id=18, node_name=Assa Abloy Yale Key Free Touchscreen Deadbolt (YRD240), manufacturer_name=Assa Abloy, product_name=Yale Key Free Touchscreen Deadbolt (YRD240), friendly_name=Front Door Deadbolt @ 2018-11-01T15:44:04.242964+13:00> (Offending entity: )

I’m assuming it’s becuase I have a template sensor configured to read the battery level from the Yale deadbolt but after a HA restart, the template sensor is trying to read the battery level before the Z-Wave device is available in HA.

Is there a way to delay the read until the device is ready?

Here is my sensor:

sensor:
  platform: template
  sensors:
    deadbolt_batteries_front_door:
          friendly_name: Front Door Lock Battery Level
          value_template: "{% if states.zwave.frontdoor_deadbolt %}
              {{ states.zwave.frontdoor_deadbolt.attributes.battery_level }}
            {% else %}
              unknown
            {% endif %}"
          unit_of_measurement: '%'
          icon_template: >-
            {% set battery_level = states('sensor.deadbolt_batteries_front_door')|int('unknown') %}
            {% set battery_round = (battery_level|int / 10)|int * 10 %}
            {% if battery_level == 'unknown' %}
              mdi:battery-unknown
            {% else %}
              {% if battery_round >= 100 %}
                mdi:battery
              {% elif battery_round > 0 %}
                mdi:battery-{{ battery_round }}
              {% else %}
                mdi:battery-alert
              {% endif %}
            {% endif %}

Does the sensor come right within a reasonable time of startup? If so, why worry about a temporary warning? (It is not an error, it is a warning).

Agreed Nick, sensor actually works was just pondering as to whether there was a way to delay a sensor until an entity becomes available.