Skip to content

Commit

Permalink
Implement correct f-string formatting (Issue #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelschreiner authored Oct 31, 2023
1 parent b326776 commit 97d64e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hue2lox.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def parse_event(event_type, item):
# Leave function early
print("EVENT: unknown button event")
return
sensor_state = "{item.metadata.control_id}/{sensor_state}"
sensor_state = f"{item.metadata.control_id}/{sensor_state}"
sensor_id = item.id_v1

elif item.type.name == "MOTION":
Expand All @@ -46,8 +46,8 @@ def parse_event(event_type, item):
# print("received event", event_type.value, item)

if sensor_id != "":
event = "hue_event{sensor_id}/{sensor_state}"
print("EVENT: {event}")
event = f"hue_event{sensor_id}/{sensor_state}"
print(f"EVENT: {event}")
# Send UDP packet to Loxone Miniserver
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(bytes(event, "utf-8"), (LOXONE_IP, LOXONE_UDP_PORT))
Expand Down

0 comments on commit 97d64e2

Please sign in to comment.