Wake on lan switch - refresh rate?

Hi,

I use this switch: https://home-assistant.io/components/switch.wake_on_lan/
Which works great for waking and shutting down my PC.
But I also use the state of this switch in an automation, and the switch has a delay of about 30-40 seconds. So my automation that turns on and off a light together with the PC will not start until long after the PC is running and also not turn off until almost a minute after shutdown.

Is it possible to increase the refresh-rate of this switch, to like 5 seconds?
Or is possible to create another switch which pings the PC every 5 seconds and does the same thing as this switch?

You can use a commandline switch…

- platform: command_line
  scan_interval: 5
  name: 'Samsung S5'
  command: 'ping -W 1 -c 1 192.168.1.30 > /dev/null 2>&1 && echo success || echo fail'
  device_class: connectivity
  payload_on: "success"
  payload_off: "fail"

I ended up doing this, had it on my Mi Box android TV switch before so it was an easy copy.
Will try out the results tonight! Thank you for the help!