Enable mypy strict compliance

This commit is contained in:
Edgar P. Burkhart 2024-12-09 12:16:26 +01:00
parent 9f0c6ba3db
commit 7b26d3a160
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
7 changed files with 151 additions and 90 deletions

View file

@ -8,7 +8,7 @@ logger = logging.getLogger(__name__)
config_path = "config.toml"
def main():
def main() -> int:
with open(config_path, "rb") as config_file:
config = tomllib.load(config_file)
@ -18,7 +18,7 @@ def main():
if ha_config is None:
logger.error(f"Missing home assistant config in <{config_path}>")
logger.error(f"\t{config}")
sys.exit(1)
return 1
client = HAClient(
ha_config.get("entity"),
@ -26,10 +26,16 @@ def main():
mqtt_config=ha_config.get("mqtt"),
)
client.connect()
code = client.connect()
if code != 0:
return 1
client.loop()
code = client.loop()
if code != 0:
return 1
return 0
if __name__ == "__main__":
main()
sys.exit(main())