HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
49 stars 9 forks source link

error adding binary sensor #101

Closed kuradi closed 1 year ago

kuradi commented 2 years ago

Version of the custom_component

latest. also latest ha

Describe the bug

cant add binary sensor

Debug log

Error while setting up openhasp platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/openhasp/binary_sensor.py", line 34, in async_setup_entry [ File "/config/custom_components/openhasp/binary_sensor.py", line 35, in HASPBinarySensor( File "/config/custom_components/openhasp/binary_sensor.py", line 58, in init self._attr_name = f"{name} binary_sensor {self._gpio}" AttributeError: 'HASPBinarySensor' object has no attribute '_gpio'

Joraeim commented 1 year ago

I had this same issue. You can add the following line to the init function for the HASPBinarySensor class just prior to line 58 to resolve this error.

self._gpio = gpio

(This may not completely fix it, I'm having a separate error at the same time.)

htvekov commented 1 year ago

Has this issue with the binary sensor been resolved ? Didn't really notice that my sensors in HA was no longer available as I use MQTT in HA to trigger on GPIO events from the plates

dgomes commented 1 year ago

yes in ea2a04e049ddb59b5b0981d52560c8a902a185a6

htvekov commented 1 year ago

Updated CC to ea2a04e -> All OK 👍 Thank you !

kuradi commented 1 year ago

yes in ea2a04e

excuse me but what should i do to get rid of this error? i have latest 0.6.6 installed....

htvekov commented 1 year ago

excuse me but what should i do to get rid of this error? i have latest 0.6.6 installed....

openHASP CC 0.6.6 still has this binary sensor issue. Switch to main branch, redownload and restart HA. Now your CC should be commit 45a2e44 and have working binary sensors in HA

image