示例#1
0
mqtt_username = "******"
mqtt_password = "******"
mqtt_topic = "Blinds"
mqtt_ip = "192.168.50.236"
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_get
client.on_disconnect = on_disconnect
client.username_pw_set(mqtt_username, mqtt_password)
client.connect(mqtt_ip, 1883)

servotest2.send_servo_command(0, 0)
#servotest2.send_servo_command(0,180)
#mytimer = Timer(TIME_TO_OFF,mybot.timerOff)
mybot.displayDefault()


def say(text):
    url = "http://localhost:12101/api/text-to-speech"
    requests.post(url, text)


# Intents are passed through here
def on_message(ws, message):
    global lightson
    global mytimer
    global alarmtimer
    data = json.loads(message)
    #print("**Captured New Intent**")
    #print(data)