2022-01-09T18:11:37
Continuous Polling with curl and watch
I have been setting up some RESTful sensors for Home Assistant and to verify/fine tune their functionality, it dawned on me that I could use watch
to continuously poll my endpoint to watch for a value change:
watch curl --no-progress-meter http://domain.tld/path/to/sensor/
If you're familiar with watch, you'll know that the default "polling rate" will be every 2 seconds. This can be altered by passing in the option -n x
, where "x" is the number of seconds you'd like between command runs.