vfilimonov/co2meter

Current zeroconf has error about adding string and float

beached opened this issue · 2 comments

  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/site-packages/co2meter/server.py", line 316, in init_homekit_target
    start_homekit(mon, host=host, port=port, monitoring=False, handle_sigint=False)
  File "/usr/local/lib/python3.7/site-packages/co2meter/homekit.py", line 145, in start_homekit
    driver.start()
  File "/usr/local/lib/python3.7/site-packages/pyhap/accessory_driver.py", line 472, in start
    self.advertiser.register_service(self.mdns_service_info)
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 2385, in register_service
    self._broadcast_service(info)
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 2419, in _broadcast_service
    info.server,
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 652, in __init__
    DNSRecord.__init__(self, name, type_, class_, ttl)
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 457, in __init__
    self._expiration_time = self.get_expiration_time(100)
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 484, in get_expiration_time
    return self.created + (percent * self.ttl * 10)
TypeError: unsupported operand type(s) for +: 'float' and 'str'

Reverting zeroconf to 0.23 remediated this. The issue was on both mac and ubuntu(rasp pi)

Thank you for reporting this! I will add a note about it then.

I believe that updating to a newer pyhap should solve it (and would be a proper fix), but apparently some interfaces were changed after version 1.1.5, and unfortunately I don't have capacity at the moment to look into that.

But PRs are always welcome!