Entities not available

I’ve noticed recently that entities i’ve been using for quite some time now are “randomly” becoming unavailable.

I currently create some entities based on data from influxdb in my configutation.yaml, ie.

sensor:
  - platform: influxdb
    host: localhost
    username: !secret influxdb_username
    password: !secret influxdb_password
    queries:
    - name: Cost for last hour
      unit_of_measurement: '£'
      group_function: mean
      where: '"entity_id" = ''aeon_labs_zw095_home_energy_meter_gen5_power'' and time > now() - 1h'
      measurement: '"W"'
      field: value
      database: homeassistant
      value_template: >-
        {% set cost_for_last_hour = (((( value | int ) * 1 ) / 1000) * 0.1697 ) | round(2) %}
        {{ '%.2f' | format (cost_for_last_hour) }}

the zwave devices are always available on reboot, but the sensor.cost_for_last_hour randomly becomes unavailable when rebooting.

Currently running Home Assistant 0.111.0 & HassOS 4.10 via VM/Docker on unraid.

Any pointers to possible solutions would be appreciated :slight_smile: