Mercurial > code > home > repos > homeauto
comparison service/insteon/insteonprotocol.py @ 493:f5664bea7cfe
old insteon driver attempt
Ignore-this: 21e4ebcbb7378639e310762a0e806904
author | drewp@bigasterisk.com |
---|---|
date | Sun, 21 Apr 2019 01:37:02 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
492:139eee3a17c0 | 493:f5664bea7cfe |
---|---|
1 from twisted.internet.defer import Deferred | |
2 from twisted.protocols.stateful import StatefulProtocol, StringIO | |
3 from twisted.protocols.policies import TimeoutMixin | |
4 | |
5 | |
6 class InsteonProtocol(StatefulProtocol, TimeoutMixin): | |
7 def getInitialState(self): | |
8 return (self.surprise, 1) | |
9 | |
10 def surprise(self, bytes): | |
11 print "received %r" % bytes | |
12 | |
13 | |
14 | |
15 def getImInfo(self): | |
16 msg = map(ord, self._send("\x60", 6)) | |
17 def imInfoBack( | |
18 self._sful_data = (imInfoBack, , StringIO(), 0 | |
19 | |
20 | |
21 d = Deferred() | |
22 return d | |
23 return {'id' : "%02X%02X%02X" % (msg[0], msg[1], msg[2]), | |
24 'deviceCategory' : msg[3], | |
25 'deviceSubcategory' : msg[4], | |
26 'firmwareRevision': msg[5]} |