Command line sensor scan interval

Is there anyway to set the scan interval in command line sensor for read value out of a remote text file?
I tried putting the “scan_interval” but not working.

sensor:
  - platform: command_line
    command: python3 -c "import requests; print(requests.get('http://remote-host/sensor_data.txt').text)"
    name: File value

Please advise. Thank you!

See

Hi fabaff, thanks for the reply.
I saw that post and tried using “scan_interval”, but its not working for command_line.

sensor:

Is this working also with Zwave components?

This is still a bug, see #2499, #2994 or #3652. Both PR’s are closed with the remark that this feature is working, but it isn’t.

It is defaulting to 60 seconds for me even though I have scan_interval set to 10. I am running version 33.4

This is fixed in the next version.

1 Like

Is it also possible to increase the timer?
I’ve got a command line sensor that checks my GitHub for new commits (using git fetch), running it every minute seems overkill.

I noticed the polling range is set in this line: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/helpers/entity_component.py#L329
wouldn’t it be possible to take 60 seconds, of the scan_interval, whichever is higher?

EDIT: doesn’t work to take the highest, since it gets converted to a range with the correct intervals, would need some more work