aggiunto indicazione data ora via mqtt
This commit is contained in:
10
agsm.py
10
agsm.py
@@ -15,6 +15,7 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import config
|
import config
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# python -m venv env
|
# python -m venv env
|
||||||
# attivare ambiente
|
# attivare ambiente
|
||||||
@@ -365,5 +366,14 @@ if platform.node() == 'ds7':
|
|||||||
acqueveronesi()
|
acqueveronesi()
|
||||||
windtre()
|
windtre()
|
||||||
|
|
||||||
|
#inserisce data ora
|
||||||
|
|
||||||
|
now = datetime.now()
|
||||||
|
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
|
||||||
|
client1= paho.Client("control1") #create client object
|
||||||
|
client1.on_publish = on_publish #assign function to callback
|
||||||
|
client1.connect(mqttbroker,mqttport) #establish connection
|
||||||
|
client1.publish('bollette/datacontrollo', dt_string, qos=0,retain=True)
|
||||||
|
|
||||||
if platform.node() == 'ds7':
|
if platform.node() == 'ds7':
|
||||||
subprocess.run(["docker","stop", "SeleniumGrid"])
|
subprocess.run(["docker","stop", "SeleniumGrid"])
|
||||||
|
|||||||
Reference in New Issue
Block a user