Command line state command polling interval

As far as I can tell, there is no way to change the polling interval for a command line switches state command.

Is this a feature that would be possible to implement?

How about https://home-assistant.io/topics/platform_options/#scan-interval

That doesn’t seem to have an effect on the command line switch state command. I did attempt to adjust that parameter.

Just looked at the code, it should work…

Yes, the scan_interval works for platform command_line but I think the issue might be with where exactly you put scan_interval command

Here is an example that worked for me

switch:
  platform: command_line
  scan_interval: 10
  switches:
    sportmusic:
      oncmd: 'curl -k xxxxxxxxxxxxxxx'
      offcmd: 'curl -k yyyyyyyyyyyyyyy'
      statecmd: 'if [ zzzzzzzz ]; then return 0; else return 1; fi'
5 Likes