fix 1wire

This commit is contained in:
Andrey
2021-02-18 15:02:21 +03:00
parent 4af40c29a7
commit 6503d6bddd
5 changed files with 19 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import (
TEMP, HUM, PRESS,
LUX, PATT_SPLIT, DOMAIN,
CONF_HTTP, EVENT_BINARY_SENSOR, CONF_CUSTOM, CONF_FORCE_D
CONF_HTTP, EVENT_BINARY_SENSOR, CONF_CUSTOM, CONF_FORCE_D, CONF_DEF_RESPONSE
)
from .entities import set_events_off, BaseMegaEntity
from .exceptions import CannotConnect, NoPort
@@ -171,6 +171,10 @@ class MegaD:
def force_d(self):
return self.customize.get(CONF_FORCE_D, False)
@property
def def_response(self):
return self.customize.get(CONF_DEF_RESPONSE, None)
@property
def is_online(self):
return (datetime.now() - self.last_update).total_seconds() < (self.poll_interval + 10)
@@ -264,6 +268,8 @@ class MegaD:
ret = ret.split(';')
elif '/' in ret:
ret = ret.split('/')
else:
ret = [ret]
ret = {'value': dict([
x.split(':') for x in ret if x.count(':') == 1
])}