remove my changes

This commit is contained in:
karl.hudgell 2021-10-28 12:40:01 +01:00
parent c9b3acca63
commit 4f1e2a528c
2 changed files with 2 additions and 8 deletions

6
.env
View File

@ -1,6 +0,0 @@
BROKER = ""
PORT = 1883
SUB_TOPIC = ""
PUB_TOPIC = ""
USERNAME = ""
PASSWORD = ""

View File

@ -9,7 +9,7 @@ from lib.shared import run_bulb_action, convert_to_bulb_format
load_dotenv()
broker = os.getenv("BROKER")
port = os.getenv("PORT")
port = int(os.getenv("PORT"))
topic = os.getenv("SUB_TOPIC")
# generate client ID with pub prefix randomly
client_id = f"python-mqtt-{random.randint(0, 100)}"
@ -32,7 +32,7 @@ def connect_mqtt() -> mqtt_client:
def publish(client):
result = client.publish(os.getenv('PUB_TOPIC'), "ON")
result = client.publish(os.getenv("PUB_TOPIC"), "ON")
status = result[0]
if status == 0:
print(f"Send `ON` to topic `{topic}`")