Skip to content

Commit

Permalink
Merge pull request #39 from IUT-Blagnac/DevPierre
Browse files Browse the repository at this point in the history
MAJ clientMQTT
  • Loading branch information
RaphaLLamothe authored Nov 22, 2024
2 parents 94a7b25 + 8341480 commit 2caa007
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions Code/Python/clientMQTT.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
import paho.mqtt.client as mqtt
import configparser
import json
Expand Down Expand Up @@ -29,18 +30,25 @@ def on_connect(client, userdata, flags, rc):
print(f"Échec de connexion, code de retour : {rc}")

def on_message(client, userdata, msg):
date=datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
topic = msg.topic
payload = msg.payload.decode("utf-8")
parties = topic.split("/")
flux_mqtt = parties[0]

try:
data = json.loads(payload)
except json.JSONDecodeError:
data = payload

parties = topic.split("/")
flux_mqtt = parties[0]

if flux_mqtt=="solaredge":
liste_fichier=glob.glob(os.path+'\\*')
last_file=liste_fichier[-1]
tab1=last_file.split('_').split('-')
##Gérer les périodes ici
if liste_fichier:
return

if SOLAREDGE_INFO_TYPES[0] == "all" :
message = f"{data}"
else:
Expand Down
2 changes: 1 addition & 1 deletion Code/java/src/main/resources/application/view/menu.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Insets top="40.0" />
</VBox.margin>
</Button>
<Button mnemonicParsing="false" onAction="#fermer" prefHeight="30.0" prefWidth="176.0" text="Fermer l'application">
<Button alignment="CENTER" mnemonicParsing="false" onAction="#fermer" prefHeight="30.0" prefWidth="176.0" text="Fermer l'application">
<VBox.margin>
<Insets top="40.0" />
</VBox.margin>
Expand Down

0 comments on commit 2caa007

Please sign in to comment.