Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if settings.DevList:
for devname in settings.DevList:
if Dev[devname,'Type'] == 'RM' or Dev[devname,'Type'] == 'RM2':
device = broadlink.rm((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'MP1':
device = broadlink.mp1((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'SP1':
device = broadlink.sp1((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'SP2':
device = broadlink.sp2((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'A1':
device = broadlink.a1((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'HYSEN':
device = broadlink.hysen((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'S1C':
device = broadlink.S1C((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
if Dev[devname,'Type'] == 'DOOYA':
device = broadlink.dooya((Dev[devname,'IPAddress'], 80), Dev[devname,'MACAddress'], Dev[devname,'Device'])
device.timeout = Dev[devname,'Timeout']
if not devname in DeviceByName:
device.hostname = devname
device.auth()
devices.append(device)
print ("%s: Read %s on %s (%s)" % (devname, device.type, str(device.host[0]), device.mac))
DeviceByName[devname] = device
return { "port": serverPort, "listen": listen_address, "timeout": GlobalTimeout }
def __init__(self, ip_addr, mac_addr, timeout):
"""initialize the connection object"""
import broadlink
self._hub = broadlink.S1C((ip_addr, 80), mac_addr, None)
self._hub.timeout = timeout
self._authorized = self.authorize()
if (self._authorized):
_LOGGER.info("succesfully connected to s1c hub")
self._initial_data = self._hub.get_sensors_status()
else:
_LOGGER.error("failed to connect s1c hub, not authorized. please fix the problem and restart the system")
self._initial_data = None
def __init__(self, ip_addr: str, mac_addr: bytes, timeout: int) -> None:
"""Initialize the connection object."""
import broadlink
self._hub = broadlink.S1C((ip_addr, 80), mac_addr, None)
self._hub.timeout = timeout
self._authorized = self.authorize()
if self._authorized:
_LOGGER.info("succesfully connected to s1c hub")
self._initial_data = self._hub.get_sensors_status()
else:
_LOGGER.error(
"failed to connect s1c hub, not authorized."
"Fix the problem and restart the system."
)
self._initial_data = None
def __init__(self, ip_addr, mac_addr, timeout):
"""initialize the connection object"""
import broadlink
self._hub = broadlink.S1C((ip_addr, 80), mac_addr, None)
self._hub.timeout = timeout
self._authorized = self.authorize()
if (self._authorized):
_LOGGER.info("succesfully connected to s1c hub")
self._initial_data = self._hub.get_sensors_status()
else:
_LOGGER.error("failed to connect s1c hub, not authorized. please fix the problem and restart the system")
self._initial_data = None