lpcmanager

45715d2aaaf4
Fix SmartehCloud updates applying multiple times when re-connecting.
Ensure that LPCMQTT command execution is serialized.
This is a consequence of duplicate messages sent at init.
Seems to happen either because server or client ignores "cleansession"/"cleanstart".
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# XXX remove that crap, seriously
from connectors import WAMP
from autobahn.wamp import auth
class WampSession(WAMP.WampSession):
def onConnect(self):
self.join("Automation", ["wampcra"], "smarteh")
print("CRA checking ...")
def onChallenge(self, challenge):
if challenge.method == "wampcra":
key = auth.derive_key("smarteh", "salt123", 100, 16)
return auth.compute_wcs(key, challenge.extra['challenge'])
else:
raise Exception("don't know how to handle authmethod {}".format(challenge.method))