Skip to content
Snippets Groups Projects
Commit 5b575244 authored by jkerdreu's avatar jkerdreu
Browse files

Linting ..



git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3061 b32b6428-25c9-4566-ad07-03861ab6144f
parent 5b2356de
No related branches found
No related tags found
No related merge requests found
......@@ -2,15 +2,17 @@ from xaal.schemas import devices
import logging
import colorsys
import asyncio
logger = logging.getLogger(__name__)
def find_class(meross_dev):
if meross_dev.type == 'msl430':
return RGBLamp
return None
class MerossDev(object):
def __init__(self, meross_dev, base_addr):
self.meross = meross_dev
......@@ -30,6 +32,7 @@ class MerossDev(object):
dev.info = self.meross.name
dev.hw_id = self.meross.uuid
class RGBLamp(MerossDev):
temp_min = 2700
......@@ -63,6 +66,7 @@ class RGBLamp(MerossDev):
s = round(hsv[1], 2)
v = round(hsv[2], 2)
dev.attributes['hsv'] = [h, s, v]
await asyncio.sleep(0)
async def turn_on(self):
await self.meross.async_turn_on()
......@@ -100,7 +104,6 @@ class RGBLamp(MerossDev):
async def set_white_temperature(self, _white_temperature):
temp = int(_white_temperature)
#
value = int((temp - self.temp_min) / (self.temp_max - self.temp_min) * 100)
if value <= 1: value = 1
if value >= 100: value = 100
......@@ -114,4 +117,3 @@ class RGBLamp(MerossDev):
await self.set_hsv(dev.attributes['hsv'])
if _mode == 'white':
await self.set_white_temperature(dev.attributes['white_temperature'])
......@@ -48,6 +48,8 @@ class GW(object):
logger.info("Meross devices discovery")
self.client = await MerossHttpClient.async_from_user_password(email=login, password=passwd)
self.manager = MerossManager(http_client=self.client)
# from meross_iot.manager import TransportMode
# self.manager.default_transport_mode = TransportMode.LAN_HTTP_FIRST
await self.manager.async_init()
await self.discover()
......@@ -59,6 +61,7 @@ class GW(object):
logger.error(e)
meross_devices = self.manager.find_devices()
#import pdb;pdb.set_trace()
# config
devices_config = self.cfg.get('devices',{})
# devices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment