Mercurial > code > home > repos > homeauto
comparison lib/mqtt_client/mqtt_client.py @ 558:1df51216b712
mqtt lib wants to encode topic names
Ignore-this: 2b72670ac614943e7188419e1aba93b
author | drewp@bigasterisk.com |
---|---|
date | Wed, 01 May 2019 00:06:50 -0700 |
parents | f263f76106aa |
children | 3501410e4cc7 |
comparison
equal
deleted
inserted
replaced
557:80f3cdc58224 | 558:1df51216b712 |
---|---|
76 if (hasattr(self.serv, 'protocol') and | 76 if (hasattr(self.serv, 'protocol') and |
77 self.serv.protocol.state ==self.serv.protocol.CONNECTED): | 77 self.serv.protocol.state ==self.serv.protocol.CONNECTED): |
78 self._resubscribe(topic) | 78 self._resubscribe(topic) |
79 return ret | 79 return ret |
80 | 80 |
81 def _resubscribe(self, topic): | 81 def _resubscribe(self, topic: bytes): |
82 log.info('subscribing %r', topic) | 82 log.info('subscribing %r', topic) |
83 self.serv.protocol.onPublish = self._onPublish | 83 self.serv.protocol.onPublish = self._onPublish |
84 return self.serv.protocol.subscribe(topics=[(topic, 2)]) | 84 return self.serv.protocol.subscribe(topics=[(topic.decode('utf-8'), 2)]) |
85 | 85 |
86 def _observe_msgs(self, observer): | 86 def _observe_msgs(self, observer): |
87 self.obs = observer | 87 self.obs = observer |
88 | 88 |
89 def _onPublish(self, topic, payload, qos, dup, retain, msgId): | 89 def _onPublish(self, topic, payload, qos, dup, retain, msgId): |