JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
162 stars 40 forks source link

[Bug]: Error while setting up loxone platform for sensor #269

Open brechtvhb opened 1 week ago

brechtvhb commented 1 week ago

Describe the bug

Custom sensors with a unit of measurement configured no longer work in ha 2024.5

Example sensor:

Firmware of your Miniserver

14

HomeAssistant install method

Hassio

Version of HomeAssistant

2025.5

Version of Pyloxone

0.6.7

Update pyloxone

yes

Log

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/loxone/sensor.py", line 151, in async_setup_platform new_sensor = LoxoneCustomSensor(config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/loxone/sensor.py", line 192, in init super().init(kwargs) File "/config/custom_components/loxone/init.py", line 422, in init setattr(self, key, kwargs[key]) AttributeError: property 'unit_of_measurement' of 'LoxoneCustomSensor' object has no setter

brechtvhb commented 1 week ago

Might be fixed in this PR? https://github.com/JoDehli/PyLoxone/pull/268

JoDehli commented 1 week ago

@brechtvhb is it working with the newest release.

brechtvhb commented 1 week ago

Having this error on startups now

Logger: homeassistant.config_entries
Source: config_entries.py:575
First occurred: 22:28:25 (1 occurrences)
Last logged: 22:28:25

Error setting up entry PyLoxone for loxone
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/loxone/__init__.py", line 379, in async_setup_entry
    res = await miniserver.start_ws()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/loxone/miniserver.py", line 120, in start_ws
    res = await self.api.async_init()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/loxone/api.py", line 439, in async_init
    res = await self.acquire_token()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/loxone/api.py", line 701, in acquire_token
    new_hash = self.hash_credentials(key_and_salt)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/loxone/api.py", line 858, in hash_credentials
    SHA1 if self._visual_hash.hash_alg == "SHA1" else SHA256,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'hash_alg'
brechtvhb commented 1 week ago

Reverting to 0.6.7 fixed my new issue

JoDehli commented 1 week ago

@brechtvhb thanks for your feedback fixed it in the release 0.6.9.

brechtvhb commented 1 week ago

Working now, thanks a lot!

Only warning left, related to pyloxone, in the logs is this one. Doesn't seem to cause any troubles though.

This error originated from a custom integration.

Logger: py.warnings
Source: custom_components/loxone/api.py:27
integration: PyLoxone (documentation, issues)
First occurred: 08:24:08 (1 occurrences)
Last logged: 08:24:08

/config/custom_components/loxone/const.py:103: SyntaxWarning: invalid escape sequence '\d' cfmt = """\