ha-switchbot-curtain icon indicating copy to clipboard operation
ha-switchbot-curtain copied to clipboard

Fails to initialize

Open apollo1220 opened this issue 4 years ago • 5 comments

The cover fails to add to HA due to line 110. I changed locally to below to get it working

return True ##self.current_cover_position <= 0

apollo1220 avatar Jan 12 '22 21:01 apollo1220

The cover fails to add to HA due to line 110. I changed locally to below to get it working

return True ##self.current_cover_position <= 0

This worked for me.

Thanks!

isewise avatar Jan 13 '22 17:01 isewise

Does this fix my situation where I cannot update?

Regards

On Jan 13, 2022, at 10:08 AM, isewise @.***> wrote:

The cover fails to add to HA due to line 110. I changed locally to below to get it working

return True ##self.current_cover_position <= 0 This worked for me.

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/alextud/ha-switchbot-curtain/issues/28#issuecomment-1012334573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOJDTN5PSLVIQWKU7T7TU3UV4BJLANCNFSM5L2CIKYQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.

mcfarlde avatar Jan 13 '22 17:01 mcfarlde

Actually I started using this because the switchbot integration provided in HA wasn't working for my setup, but I decided to try that integration again and it is now working for me (and better then this integration ever did). If you want to give that a try, make sure you completely remove this integration and restart HA before adding with the default integration (otherwise they collide and neither works).

apollo1220 avatar Jan 21 '22 00:01 apollo1220

I just tried removing the old HACs version that works, installing the Integration (didn’t work) removed the integration, installed latest HACS version (didn’t work) and went back to the old HACs version. Curtain works, but battery is wrong.

On Jan 20, 2022, at 5:01 PM, apollo1220 @.***> wrote:

Actually I started using this because the switchbot integration provided in HA wasn't working for my setup, but I decided to try that integration again and it is now working for me (and better then this integration ever did). If you want to give that a try, make sure you completely remove this integration and restart HA before adding with the default integration (otherwise they collide and neither works).

— Reply to this email directly, view it on GitHub https://github.com/alextud/ha-switchbot-curtain/issues/28#issuecomment-1018032454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOJDTOYU4FYLK2C6SZEWEDUXCO5TANCNFSM5L2CIKYQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.

mcfarlde avatar Jan 21 '22 04:01 mcfarlde

I'm also seeing this:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 801, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 553, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/cover/__init__.py", line 240, in state
    if (closed := self.is_closed) is None:
  File "/config/custom_components/switchbot-curtain/cover.py", line 110, in is_closed
    return self.current_cover_position <= 0
TypeError: '<=' not supported between instances of 'NoneType' and 'int'

cc @alextud

I tried changing it to

    @property
    def is_closed(self):
        """Return if the cover is closed."""
        return self.current_cover_position is not None and self.current_cover_position <= 0

hopefully this works.

niemyjski avatar Apr 01 '22 17:04 niemyjski