Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96123

Dynamically varying sensor scan interval

$
0
0

@artmg wrote:

Hi I want a variable delay ping

I am using the [ping binary_sensor(https://www.home-assistant.io/integrations/ping/) but would like to be able to vary the interval. Most of the time it’s fine to check every 5 minutes (300) but when I perform certain actions I want to check as frequently as every second. I tried using a value_template in the scan interval

binary_sensor:
  - platform: ping
    name: variabletimedping
    host: 192.168.8.81
    scan_interval: 
      value_template: 60

but this gives the error

ERROR (MainThread) [homeassistant.config] 
Invalid config for [binary_sensor]: 
[value_template] is an invalid option for [binary_sensor]. 
Check: binary_sensor->scan_interval->value_template.

A similar question was asked here with no answer. This post seems to suggest that scan interval can have a value template under the command line platform. So I tried

sensor
  - platform: command_line
    name: "ping test 1"
    command: ping -c 5 192.168.8.81 &> /dev/null && echo 0 || echo 1
    scan_interval: 
      value_template: 60

But this also gives the error

[homeassistant.config] 
Invalid config for [sensor]: 
[value_template] is an invalid option for [sensor]. 
Check: sensor->scan_interval->value_template.

Could anybody suggest a way to have a ping run every second but just for a very limited time, to stop them swamping network traffic. How could I turn this on and off / enable or disable the sensor? Thanks

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>