slesinger / pybmr

Python library for controling BMR HC64 heating
https://shop.fenixgroup.cz/z4770-bmr-hc-64-ridici-jednotka
Apache License 2.0
0 stars 2 forks source link

Fix exception in getCircuit() caused by malformed response #5

Closed dankeder closed 3 years ago

dankeder commented 3 years ago

Sometimes BMR controller sends "-" instead of int.

  Traceback (most recent call last):
    File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
      await self.async_device_update()
    File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
      raise exc
    File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
      result = self.fn(*self.args, **self.kwargs)
    File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 259, in wrapper
      result = method(*args, **kwargs)
    File "/config/custom_components/bmr/sensor.py", line 110, in update
      circuit = self._bmr.getCircuit(self._config.get(CONF_CIRCUIT_ID))
    File "/usr/local/lib/python3.8/site-packages/cachetools/func.py", line 64, in wrapper
      v = func(*args, **kwargs)
    File "/config/pybmr/__init__.py", line 47, in wrapped
      return func(self, *args, **kwargs)
    File "/config/pybmr/__init__.py", line 208, in getCircuit
      "heating": bool(int(room_status["heating"])),
     ValueError: invalid literal for int() with base 10: '-'
slesinger commented 3 years ago

Thanks, Dane