alextud / ha-switchbot-curtain

Controls switchbot curtain using Home Assistant
MIT License
55 stars 16 forks source link

Some attributes incorrect after firmware update #30

Open AndyBerman opened 2 years ago

AndyBerman commented 2 years ago

I just updated the firmware on my switchbot curtains (foolishly), and now the current_position and battery attributes are incorrect. They appear to be swapped.

gordallott commented 2 years ago

for anyone else with this issue, changing the last part of cover.py to look like

    @property
    def current_cover_position(self):
        """Return the current position of cover shutter."""
        return 100 - self._device.get_battery_percent()
        #return self._device.get_position()

    def update(self):
        self._device.update()
        self._light = self._device.get_light_level()
        self._battery = self._device.get_position()
        #self._battery = self._device.get_battery_percent()

seems to work okay

AndyBerman commented 2 years ago

That fixed the problem, thanks!