parent
50b358f6fc
commit
3c8c048c45
|
@ -94,6 +94,10 @@ def get_eth0_ip():
|
||||||
except (KeyError, IndexError, OSError) as e:
|
except (KeyError, IndexError, OSError) as e:
|
||||||
print(f"Error getting eth0 IP: {e}")
|
print(f"Error getting eth0 IP: {e}")
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
def on_message(mqttc, obj, msg):
|
||||||
|
global TUBE_INDEX
|
||||||
|
TUBE_INDEX = list(msg.payload.decode())
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, reason_code, properties):
|
def on_connect(client, userdata, flags, reason_code, properties):
|
||||||
if reason_code == 0:
|
if reason_code == 0:
|
||||||
|
@ -110,10 +114,6 @@ def connect_mqtt():
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def mqtt_publisher():
|
def mqtt_publisher():
|
||||||
def on_message(mqttc, obj, msg):
|
|
||||||
global TUBE_INDEX
|
|
||||||
TUBE_INDEX = list(msg.payload.decode())
|
|
||||||
|
|
||||||
# Set Connecting Client ID
|
# Set Connecting Client ID
|
||||||
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
||||||
# client.username_pw_set(username, password)
|
# client.username_pw_set(username, password)
|
||||||
|
@ -166,5 +166,4 @@ if __name__ == "__main__":
|
||||||
update_tube_index_thread.start()
|
update_tube_index_thread.start()
|
||||||
flask_thread = Process(target=flask_api)
|
flask_thread = Process(target=flask_api)
|
||||||
flask_thread.start()
|
flask_thread.start()
|
||||||
publisher_thread = Process(target=mqtt_publisher)
|
mqtt_publisher()
|
||||||
publisher_thread.start()
|
|
Loading…
Reference in New Issue