Automation to detect a sensor not sensing

Ok, I use an RTL-SDR for gathering data from several sensors. From time to time the addon will stop. I have the following automation attempting to detect the stoppage, but I think it is over detecting. So, what is the best way to detect this when it happens?

- id: Restart_RTL-SDR_if_no_data
  alias: Restart RTL-SDR if no data
  trigger:
    - platform: state
      entity_id: sensor.acurite_porch_f
      for: "00:15:00"
    - platform: state
      entity_id: sensor.acurite_stairs_f
      for: "00:15:00"
  action:
  - service: hassio.addon_restart
    data:
      addon: d63406df_sdr2mqtt
  - service: notify.sms_matt
    data:
      message: "SDR-MQTT restarted after 15 minute inactivity!"

The same question was asked here… No change and it looks like exactly what I have done. I have a 15 minute no change interval, yet the restart seems to happen randomly at intervals not equal to 15 minutes. The last time I tried to run it, it triggered at 9:43pm, next morning at 1:48am, 2:29am, 2:48am and 3:29am. At that point the notifications were driving me nuts and interrupting sleep so I turned of the automation. I gave up on this the last time for the same reason, they are definitely false alarms and always trigger on the first trigger.

Here is my system config:

## System Information

version | core-2022.8.7
-- | --
installation_type | Home Assistant Supervised
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.10.5
os_name | Linux
os_version | 5.10.0-16-amd64
arch | x86_64
timezone | America/Chicago
config_dir | /config

<details><summary>Home Assistant Community Store</summary>

GitHub API | ok
-- | --
GitHub Content | ok
GitHub Web | ok
GitHub API Calls Remaining | 4900
Installed Version | 1.27.1
Stage | running
Available Repositories | 1109
Downloaded Repositories | 15

</details>

<details><summary>Home Assistant Supervisor</summary>

host_os | Debian GNU/Linux 11 (bullseye)
-- | --
update_channel | stable
supervisor_version | supervisor-2022.08.6
agent_version | 1.2.2
docker_version | 20.10.12
disk_total | 218.1 GB
disk_used | 16.7 GB
healthy | true
supported | true
supervisor_api | ok
version_api | ok
installed_addons | Backup Hassio to Google Drive (1.7.2), Dropbox Sync (1.3.0), Duck DNS (1.15.0), File editor (5.4.1), Log Viewer (0.14.0), RPC Shutdown (2.2), WireGuard (0.7.0), SSH & Web Terminal (12.0.2), Samba share (10.0.0), TasmoAdmin (0.20.0), Glances (0.16.0), Check Home Assistant configuration (3.11.0), DHCP server (1.3.0), Network UPS Tools (0.11.0), Samba Backup (5.1.2), Portainer (2.0.0), Home Assistant Google Drive Backup (0.108.4), SDR to Home Assistant (0.1.14b), Mosquitto broker (6.1.3)

</details>

<details><summary>Dashboards</summary>

dashboards | 1
-- | --
resources | 7
views | 15
mode | storage

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | September 9, 2022 at 3:12 AM
-- | --
current_recorder_run | September 9, 2022 at 5:09 PM
estimated_db_size | 264.45 MiB
database_engine | sqlite
database_version | 3.38.5

</details>

<details><summary>Sonoff</summary>

version | 3.2.0 (38856d1)
-- | --
cloud_online | 0 / 0
local_online | 0 / 0

</details>

I may have just found my issue… will start and test the automation. Failure happens very rarely, but is still annoying to me.

I noticed this:

alias: Restart RTL-SDR if no data

And changed to this:

alias: "Restart RTL-SDR if no data"

I am wondering if the unquoted “no” was causing a trigger to happen as “no” maybe a keyword.

No that is not likely to be your issue.

Check the automation trace to see why it triggered.

Also consider changing your triggers to this:

  trigger:
    - platform: state
      entity_id: sensor.acurite_porch_f
      to:
      for: "00:15:00"
    - platform: state
      entity_id: sensor.acurite_stairs_f
      to:
      for: "00:15:00"

A null to: only triggers on state changes and ignores attribute changes.

It appears my change did not fix it and it appeared to be a value change that triggered it. I have made your suggested change, time will tell me.

Ok, so I removed one of the triggers and extended the idle time and still have false triggers every night! This is nuts… Last night it triggered at 1:38am and 2:21am before I disabled the automation. You will see in the graph that there were no stalls in the data. Normally when the addon or really the radio stops responding, the data has a flatline with the last retained value until restart. There was not a lot of change in the values from midnight to about 6:30am, but I am assuming that the automation works on the data as presented at the 1/10 degree level and that never is still.

Here is the current automation:

id: Restart_RTL-SDR_if_no_data
alias: Restart RTL-SDR if no data
trigger:
  - platform: state
    entity_id: sensor.acurite_porch_f
    to: null
    for: '00:20:00'
action:
  - service: hassio.addon_restart
    data:
      addon: d63406df_sdr2mqtt
  - service: notify.sms_matt
    data:
      message: SDR-MQTT restarted after 15 minute inactivity!

Here is a 24 hour graph of the data set that triggers the automation.
image