in my configuration i have command_line switch looking like this to use some external device:
switch:
- platform: command_line
switches:
jadalnia:
command_on: "curl 'http://ip/relay?something'1"
command_off: "curl 'http://ip/relay?something2'"
command_state: "curl 'http://ip/relay?something3'"
value_template: '{{ value == "1" }}'
scan_interval: 5
It works fine, and state of switch refreshes correctly.
I want to have as small delay as possible in case device will be switched in other way (not by HA) but to avoid unnecessary traffic every 5 seconds in my network I wanted to change scan_interval
into some webhook to HA to be called by this device (it can do that) to change state of command_line switch entity. This would reduce traffic in my network. I was trying to find solution but with no success.