Skip to content

Commit

Permalink
added version numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
exddc committed Jun 17, 2024
1 parent b9afb44 commit 0ceb51d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Init file for the doorbell agent package."""

__version__ = "0.2.0"
3 changes: 2 additions & 1 deletion agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import doorbell_agent
import indoor_unit_agent
import web_server
from . import __version__

# Load environment variables
dotenv.load_dotenv()
Expand Down Expand Up @@ -46,7 +47,7 @@ def __init__(self):
def run(self):
"""Run the agent and all modules"""

LOGGER.info("%s agent started.", self.__agent_type)
LOGGER.info("%s agent started with version: %s", self.__agent_type, __version__)
self._agent.run()
for module in self._modules:
module.run()
Expand Down
7 changes: 6 additions & 1 deletion agent/mqtt_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logger
import dotenv
import paho.mqtt.client
from . import __version__

# Load environment variables
dotenv.load_dotenv()
Expand Down Expand Up @@ -187,7 +188,11 @@ def _publish_heartbeat(self) -> None:
self.publish(
f"status/{os.environ.get('AGENT_LOCATION')}",
json.dumps(
{"state": "online", "date": datetime.datetime.now().isoformat()}
{
"state": "online",
"date": datetime.datetime.now().isoformat(),
"version": __version__,
}
),
False,
)
Expand Down

0 comments on commit 0ceb51d

Please sign in to comment.