Trigger an automation when a value does NOT change?

Hey Everyone!

I have a Govee Bluetooth thermometer that sometimes loses connection but Home Assistant does not register the thermometer as “unavailable”. Reloading the Bluetooth integration will fix the connection.

I would like to create an automation to reload Bluetooth if there is no temperature change over five minutes. How would I set that up?

image

Thanks for your help!!

The following automation notifies you when the sensor’s state value hasn’t changed in the past 30 minutes and then reloads the integration associated with the sensor entity (change sensor.your_temperature_sensor to your temperature sensor).

alias: example abc123
trigger:
- platform: template
  value_template: "{{ now() - states.sensor.your_temperature_sensor.last_changed >= timedelta (minutes=30) }}"
action:
- service: notify.persistent_notification
  data:
    title: Stale Temperature
    message: "{{ now().timestamp() | timestamp_local }} Value unchanged for the past 30 minutes."
  - service: homeassistant.reload_config_entry
    target:
      entity_id: sensor.your_temperature_sensor

NOTE

Currently there’s no explicit “integration reload” service call. However homeassistant.reload_config_entry should do the same thing provided the entity’s integration is configured via the config flow process and not via YAML. I believe the Bluetooth integration is handled by config flow.

8 Likes

This looks fantastic! Thank you for the pointers!!

1 Like

That I need to do an automation with a script… because a problem since 2022.8 the Switchbot bot doesn’t work without reload the bluetooth integration in RPI4, the problem is that bluetooth integration doesn’t have any device and reloading the Switchbot device doesn’t work at all…so have to reload manually the bluetooth integration and work… or have to do with a shell command to reload before want to use them…

However don’t know the config entry id of this bluetooth integration…

Do you know the bluetooth id integration?

Thanks in advance

You could also use a state trigger with nothing in to or from and just for: 30 minutes

1 Like