Skip to content

Commit

Permalink
Merge pull request #79 from sourcebots/run_uuid
Browse files Browse the repository at this point in the history
Include run_uuid in state messages
  • Loading branch information
WillB97 authored Jul 23, 2024
2 parents 8b0bb94 + 096ad5c commit ad64ee2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runusb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def set_status(self, value: LedStatus) -> None:
topic_prefix = MQTT_SETTINGS.active_config.topic_prefix
mqtt_client.publish(
f'{topic_prefix}/state',
json.dumps({"state": value.name}),
json.dumps(dict(state=value.name, **MQTT_SETTINGS.extra_data)),
qos=1,
retain=True,
)
Expand Down Expand Up @@ -363,10 +363,10 @@ def cleanup(self) -> None:

def close(self) -> None:
self.cleanup()
MQTT_SETTINGS.extra_data["run_uuid"] = "" # Reset the run UUID
LED_CONTROLLER.set_status(LedStatus.NoUSB)
LED_CONTROLLER.set_code(False)
USERCODE_LOGGER.removeHandler(self.handler)
MQTT_SETTINGS.extra_data["run_uuid"] = "" # Reset the run UUID
MQTT_SETTINGS.active_usercode = None

def reset(self) -> None:
Expand Down

0 comments on commit ad64ee2

Please sign in to comment.