Skip to content
Snippets Groups Projects
Commit 892f9f49 authored by jkerdreu's avatar jkerdreu
Browse files

Added comment, and try to fix the update eror

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@2416 b32b6428-25c9-4566-ad07-03861ab6144f
parent 60c0dc42
Branches
Tags
No related merge requests found
......@@ -12,3 +12,6 @@ this can be a little longuer.
This gateway use a forked github pytuya lib. The main reason: The official one
doesn't support outlet w/ version 3.3 of the protocol which seems to be the
default now.
The complete guide to extract keys is there:
- https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md
......@@ -29,7 +29,7 @@ setup(
install_requires=[
'xaal.lib',
'gevent==1.5a2',
'pytuya==7.0.5',
'pytuya',
'pyaes',
'pycrypto',
'tenacity',
......
......@@ -52,7 +52,7 @@ class TuyaDev:
@retry(stop=stop_after_attempt(2))
def _update_status(self):
time.sleep(0.1)
#time.sleep(0.1)
logger.info("Updating %s" % self.tuya_id)
self.last_update = now()
status = self.tuya_dev.status()
......@@ -103,7 +103,7 @@ class PowerRelay(TuyaDev,OnOffMixing):
self.devices.append(relay)
def on_status(self,status):
self.devices[0].attributes['power'] = status['dps'][1]
self.devices[0].attributes['power'] = status['dps']['1']
class SmartPlug(TuyaDev,OnOffMixing):
......@@ -127,7 +127,6 @@ class SmartPlug(TuyaDev,OnOffMixing):
def on_status(self,status):
dps = status['dps']
print(dps)
self.devices[0].attributes['power'] = dps.get('1',None)
self.devices[1].attributes['current'] = int(dps.get('4',0)) / 1000
self.devices[1].attributes['power'] = int(dps.get('5',0)) / 10
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment