Device.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kiota 作者: Morteo 项目源码 文件源码
def connect(self, gateway):

    self.gateway = gateway

    if self.config['id'] is not None:
      self.topic =  gateway.topic + "/" + self.config['id']
    else:
      self.topic =  gateway.topic + "/" + self.__class__.__name__
      if self.config['gpio'] is not None:
        self.topic =  self.topic + "/" + str(self.config["gpio"])

    payload = { 'connected': self.topic }
    self.gateway.publish(gateway.topic, json.dumps(payload))

    self.gateway.subscribe(self.topic+"/configure")
    self.gateway.subscribe(self.topic+"/get")
    self.gateway.subscribe(self.topic+"/set")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号