Add lock.open service to nello (#42141)

This commit is contained in:
Sören 2020-12-01 08:36:36 +01:00 committed by GitHub
parent cf5be049b3
commit 39e7b30ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import logging
from pynello.private import Nello
import voluptuous as vol
from homeassistant.components.lock import PLATFORM_SCHEMA, LockEntity
from homeassistant.components.lock import PLATFORM_SCHEMA, SUPPORT_OPEN, LockEntity
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
@ -85,3 +85,13 @@ class NelloLock(LockEntity):
"""Unlock the device."""
if not self._nello_lock.open_door():
_LOGGER.error("Failed to unlock")
def open(self, **kwargs):
"""Unlock the device."""
if not self._nello_lock.open_door():
_LOGGER.error("Failed to open")
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_OPEN