Enable mypy strict compliance
This commit is contained in:
parent
9f0c6ba3db
commit
7b26d3a160
7 changed files with 151 additions and 90 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Reference in a new issue