1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
0
I found the solution:
self.myAWSIoTMQTTClient.onOffline = self.myOnOfflineCallback
self.myAWSIoTMQTTClient.onOnline = self.myOnOnlineCallback
def myOnOfflineCallback(self):
self.sent_to_topic = False
print("OFFLINE")
def myOnOnlineCallback(self):
self.sent_to_topic = True
print("ONLINE")
def publish(self, topic, message_to_send):
if self.sent_to_topic:
self.myAWSIoTMQTTClient.publish(topic, message_to_send, 1)
print(f"Published topic {topic}")
répondu il y a 5 ans
Contenus pertinents
- demandé il y a un an
- demandé il y a 21 jours
- demandé il y a un an
- demandé il y a un mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 2 ans