Skip to content

Commit

Permalink
Build with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdcr committed Jan 23, 2022
1 parent 7aa05d8 commit f884b40
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 Andreas Oberritter
Copyright 2022 Andreas Oberritter

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 14 additions & 9 deletions hm-mqtt-bridge.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright 2020 Andreas Oberritter
# Copyright 2022 Andreas Oberritter
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -453,7 +453,7 @@ async def run(self, broker: str, listen: str, connect: str) -> None:
homematic.stop()


async def main(cfg: dict) -> None:
async def async_main(cfg: dict) -> None:
if cfg["debug"]:
logger.setLevel(logging.DEBUG)

Expand Down Expand Up @@ -511,10 +511,15 @@ def options() -> dict:
return cfg


try:
asyncio.run(main(options()))
except MqttError as exc:
logger.critical("MQTT error: %s", exc)
sys.exit(1)
except KeyboardInterrupt:
pass
def main():
try:
asyncio.run(async_main(options()))
except MqttError as exc:
logger.critical("MQTT error: %s", exc)
sys.exit(1)
except KeyboardInterrupt:
pass


if __name__ == "__main__":
main()
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.poetry]
name = "homematic-mqtt-bridge"
version = "0.1.0"
description = "A bridge between Homematic and MQTT"
authors = ["Andreas Oberritter <[email protected]>"]
license = "MIT"
packages = [
{ include = "hm-mqtt-bridge.py" },
]

[tool.poetry.dependencies]
python = "^3.7"
asyncio-mqtt = "^0.12.1"
pyhomematic = "^0.1.77"

[tool.poetry.scripts]
homematic-mqtt-bridge = "hm-mqtt-bridge:main"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit f884b40

Please sign in to comment.