Remove Windows workarounds from wake_on_lan (#64070)

This commit is contained in:
Erik Montnemery 2022-01-13 20:42:30 +01:00 committed by GitHub
parent b3421cf727
commit abce453b5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 84 deletions

View file

@ -2,7 +2,6 @@
from __future__ import annotations
import logging
import platform
import subprocess as sp
import voluptuous as vol
@ -158,24 +157,14 @@ class WolSwitch(SwitchEntity):
def update(self):
"""Check if device is on and update the state. Only called if assumed state is false."""
if platform.system().lower() == "windows":
ping_cmd = [
"ping",
"-n",
"1",
"-w",
str(DEFAULT_PING_TIMEOUT * 1000),
str(self._host),
]
else:
ping_cmd = [
"ping",
"-c",
"1",
"-W",
str(DEFAULT_PING_TIMEOUT),
str(self._host),
]
ping_cmd = [
"ping",
"-c",
"1",
"-W",
str(DEFAULT_PING_TIMEOUT),
str(self._host),
]
status = sp.call(ping_cmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL)
self._state = not bool(status)