本文整理汇总了Python中Adafruit_IO.MQTTClient.status方法的典型用法代码示例。如果您正苦于以下问题:Python MQTTClient.status方法的具体用法?Python MQTTClient.status怎么用?Python MQTTClient.status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_IO.MQTTClient
的用法示例。
在下文中一共展示了MQTTClient.status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: printStatus
# 需要导入模块: from Adafruit_IO import MQTTClient [as 别名]
# 或者: from Adafruit_IO.MQTTClient import status [as 别名]
client.status = payload
printStatus(client)
def printStatus(status):
print ('status={0}'.format(client.status))
# Create an MQTT client instance.
client = MQTTClient(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)
# Setup the callback functions defined above.
client.on_connect = connected
client.on_disconnect = disconnected
client.on_message = message
client.status = 'OFF'
# Connect to the Adafruit IO server.
client.connect()
# Start a message loop that blocks forever waiting for MQTT messages to be
# received. Note there are other options for running the event loop like doing
# so in a background thread--see the mqtt_client.py example to learn more.
client.loop_background()
cpu = CPU()
aio = Client(ADAFRUIT_IO_KEY)
client.status = aio.receive(FEED_ID).value
printStatus(client)
while True:
if (client.status == 'ON'):