add server response in mqtt mode

This commit is contained in:
Andrey
2021-02-11 11:57:17 +03:00
parent 4fccb23c39
commit 5ed0b74eff
6 changed files with 39 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ from homeassistant.const import (DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_HUMIDITY
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
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_SKIP
from .const import TEMP, HUM, PRESS, LUX, PATT_SPLIT, DOMAIN, CONF_HTTP, EVENT_BINARY_SENSOR, CONF_CUSTOM, CONF_SKIP, \
CONF_FORCE_D
from .entities import set_events_off, BaseMegaEntity
from .exceptions import CannotConnect
from .tools import make_ints
@@ -163,6 +164,10 @@ class MegaD:
self._customize = c
return self._customize
@property
def force_d(self):
return self.customize.get(CONF_FORCE_D, False)
@property
def is_online(self):
return (datetime.now() - self.last_update).total_seconds() < (self.poll_interval + 10)