mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-12 01:24:29 +05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc6bdfc8f4 | ||
|
|
e51b50797c | ||
|
|
c4205c7ddc | ||
|
|
6164966d0b |
@@ -60,8 +60,9 @@ class MegaD:
|
||||
):
|
||||
"""Initialize."""
|
||||
if mqtt_inputs is None or mqtt_inputs == 'None' or mqtt_inputs is False:
|
||||
self.http = hass.data[DOMAIN][CONF_HTTP]
|
||||
self.http.allowed_hosts |= {host}
|
||||
self.http = hass.data.get(DOMAIN, {}).get(CONF_HTTP)
|
||||
if not self.http is None:
|
||||
self.http.allowed_hosts |= {host}
|
||||
else:
|
||||
self.http = None
|
||||
self.update_all = update_all if update_all is not None else True
|
||||
@@ -360,7 +361,7 @@ class MegaD:
|
||||
return pty, m
|
||||
|
||||
async def scan_ports(self, nports=37):
|
||||
for x in range(1, nports+1):
|
||||
for x in range(0, nports+1):
|
||||
ret = await self.scan_port(x)
|
||||
if ret:
|
||||
yield [x, *ret]
|
||||
@@ -371,7 +372,7 @@ class MegaD:
|
||||
async for port, pty, m in self.scan_ports(nports):
|
||||
if pty == "0":
|
||||
ret['binary_sensor'][port].append({})
|
||||
elif pty == "1" and m in ['0', '1']:
|
||||
elif pty == "1" and m in ['0', '1', '3']:
|
||||
ret['light'][port].append({'dimmer': m == '1'})
|
||||
elif pty == '3':
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user