Closed cadavre closed 4 years ago
Hi @cadavre ,
There is an issue with XiaomiGatewayAlarm
, it does not implement supported_features
required by RestoreEntity
(guessing, not an expert in python) :
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/miio_gateway/alarm_control_panel.py", line 17, in setup_platform
devices.append(XiaomiGatewayAlarm(gateway))
TypeError: Can't instantiate abstract class XiaomiGatewayAlarm with abstract methods supported_features```
Hi @kind3r is it just on 0.103 or even previous versions?
HA 0.103.0
yes. It's a bit more dificult for me to test older versions. I'm new to HA and still trying to figure it out.
I have modified the alarm_control_panel.py
:
from homeassistant.components.alarm_control_panel import (
AlarmControlPanel, SUPPORT_ALARM_ARM_HOME, SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_NIGHT, SUPPORT_ALARM_TRIGGER)
class XiaomiGatewayAlarm(XiaomiGwDevice, AlarmControlPanel):
@property
def supported_features(self):
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT | SUPPORT_ALARM_TRIGGER
This seems to do the trick tho now I'm stuck with a js error from the frontend (it tries to read some missing code input) when arming/disarming.
Fixed.
I've changed basic representation of sensor from
Entity
toRestoreEntity
and addedrestore
parameter to sensor mapping.Now,
restore
defaults toFalse
but you can overwrite it to get your sensor states back after HA restart.You can find the release-candidate version in #dev-restore branch: https://github.com/cadavre/miio_gateway/tree/dev-restore
I haven't tested it yet by myself, but you're free to try and let me know. :)