Create service to enable Continuous Mode on Nuki Opener (#51861)

This commit is contained in:
Anaïs Betts 2021-06-30 08:43:02 +02:00 committed by GitHub
parent f2906d0fca
commit da9bb99ba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

View file

@ -4,6 +4,7 @@ DOMAIN = "nuki"
# Attributes # Attributes
ATTR_BATTERY_CRITICAL = "battery_critical" ATTR_BATTERY_CRITICAL = "battery_critical"
ATTR_NUKI_ID = "nuki_id" ATTR_NUKI_ID = "nuki_id"
ATTR_ENABLE = "enable"
ATTR_UNLATCH = "unlatch" ATTR_UNLATCH = "unlatch"
# Data # Data

View file

@ -12,6 +12,7 @@ from homeassistant.helpers import config_validation as cv, entity_platform
from . import NukiEntity from . import NukiEntity
from .const import ( from .const import (
ATTR_BATTERY_CRITICAL, ATTR_BATTERY_CRITICAL,
ATTR_ENABLE,
ATTR_NUKI_ID, ATTR_NUKI_ID,
ATTR_UNLATCH, ATTR_UNLATCH,
DATA_COORDINATOR, DATA_COORDINATOR,
@ -58,6 +59,11 @@ async def async_setup_entry(hass, entry, async_add_entities):
vol.Optional(ATTR_UNLATCH, default=False): cv.boolean, vol.Optional(ATTR_UNLATCH, default=False): cv.boolean,
}, },
"lock_n_go", "lock_n_go",
"set_continuous_mode",
{
vol.Required(ATTR_ENABLE): cv.boolean,
},
"set_continuous_mode",
) )
@ -165,3 +171,15 @@ class NukiOpenerEntity(NukiDeviceEntity):
def lock_n_go(self, unlatch): def lock_n_go(self, unlatch):
"""Stub service.""" """Stub service."""
def set_continuous_mode(self, enable):
"""Continuous Mode.
This feature will cause the door to automatically open when anyone
rings the bell. This is similar to ring-to-open, except that it does
not automatically deactivate
"""
if enable:
self._nuki_device.activate_continuous_mode()
else:
self._nuki_device.deactivate_continuous_mode()

View file

@ -12,3 +12,17 @@ lock_n_go:
default: false default: false
selector: selector:
boolean: boolean:
set_continuous_mode:
name: Set Continuous Mode
description: "Enable or disable Continuous Mode on Nuki Opener"
target:
entity:
integration: nuki
domain: lock
fields:
enable:
name: Enable
description: Whether to enable or disable the feature
default: false
selector:
boolean: