Skip to content
Snippets Groups Projects
Commit 90f27028 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Fix refresh rate due to Meross request (email)

parent d67be14f
Branches
No related tags found
No related merge requests found
import aiohttp
from xaal.lib import tools
from meross_iot.http_api import MerossHttpClient
......@@ -15,6 +14,7 @@ logger = logging.getLogger(PACKAGE_NAME)
# disable internal logging
logging.getLogger("meross_iot").setLevel(logging.WARNING)
class GW(object):
def __init__(self, engine):
self.engine = engine
......@@ -23,9 +23,9 @@ class GW(object):
engine.on_start(self.setup)
engine.on_stop(self._exit)
# refresh devices state
engine.add_timer(self.refresh,60)
# dis
engine.add_timer(self.discover,60)
engine.add_timer(self.refresh, 120)
# discover
engine.add_timer(self.discover, 300)
def config(self):
cfg = tools.load_cfg(PACKAGE_NAME)
......@@ -33,7 +33,7 @@ class GW(object):
cfg = tools.new_cfg(PACKAGE_NAME)
cfg['config'] = {'addr': tools.get_random_uuid(), 'login': '', 'password': ''}
cfg['devices'] = {}
logger.warn("Created an empty config file")
logger.warning("Created an empty config file")
cfg.write()
self.cfg = cfg
......@@ -79,7 +79,7 @@ class GW(object):
# find a class to handle this device
klass = bindings.find_class(m_dev)
if not klass:
logger.warn(f"No binding for {m_dev.type}")
logger.warning(f"No binding for {m_dev.type}")
continue
# search config
conf = devices_config.get(m_dev.uuid, None)
......@@ -109,6 +109,7 @@ class GW(object):
logger.info('Saving configuration file')
self.cfg.write()
def setup(eng):
GW(eng)
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment