Skip to content

Commit

Permalink
Add deps
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Oct 23, 2024
1 parent 52bb5d7 commit 9f6521d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
6 changes: 4 additions & 2 deletions components/nuki_lock/binary_sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_DOOR
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

DEPENDENCIES = ["nuki_lock"]

CONF_IS_CONNECTED = "is_connected"
CONF_IS_PAIRED = "is_paired"
Expand All @@ -16,7 +18,7 @@
CONF_DOOR_SENSOR = "door_sensor"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Required(CONF_IS_CONNECTED): binary_sensor.binary_sensor_schema(
device_class=DEVICE_CLASS_CONNECTIVITY,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
Expand Down
6 changes: 4 additions & 2 deletions components/nuki_lock/button/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
from esphome.const import (
ENTITY_CATEGORY_CONFIG,
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

NukiLockUnpairButton = nuki_lock_ns.class_("NukiLockUnpairButton", button.Button, cg.Component)

DEPENDENCIES = ["nuki_lock"]

CONF_UNPAIR_BUTTON = "unpair"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Optional(CONF_UNPAIR_BUTTON): button.button_schema(
NukiLockUnpairButton,
entity_category=ENTITY_CATEGORY_CONFIG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
CONF_TRIGGER_ID
)

AUTO_LOAD = []

CONF_NUKI_LOCK_ID = "nuki_lock_id"

CONF_SECURITY_PIN = "security_pin"
Expand All @@ -21,14 +19,14 @@
CONF_ON_PAIRED = "on_paired_action"

nuki_lock_ns = cg.esphome_ns.namespace('nuki_lock')
NukiLock = nuki_lock_ns.class_('NukiLockComponent', lock.Lock, cg.Component)
NukiLockComponent = nuki_lock_ns.class_('NukiLockComponent', lock.Lock, cg.Component)

PairingModeOnTrigger = nuki_lock_ns.class_("PairingModeOnTrigger", automation.Trigger.template())
PairingModeOffTrigger = nuki_lock_ns.class_("PairingModeOffTrigger", automation.Trigger.template())
PairedTrigger = nuki_lock_ns.class_("PairedTrigger", automation.Trigger.template())

CONFIG_SCHEMA = lock.LOCK_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(NukiLock),
cv.GenerateID(): cv.declare_id(NukiLockComponent),
cv.Optional(CONF_PAIRING_TIMEOUT, default="300s"): cv.positive_time_period_seconds,
cv.Optional(CONF_ON_PAIRING_MODE_ON): automation.validate_automation(
{
Expand Down Expand Up @@ -79,7 +77,7 @@ async def to_code(config):

NUKI_LOCK_UNPAIR_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.use_id(NukiLock)
cv.GenerateID(): cv.use_id(NukiLockComponent)
}
)

Expand All @@ -100,7 +98,7 @@ async def nuki_lock_unpair_to_code(config, action_id, template_arg, args):

NUKI_LOCK_SET_PAIRING_MODE_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.use_id(NukiLock),
cv.GenerateID(): cv.use_id(NukiLockComponent),
cv.Required(CONF_SET_PAIRING_MODE): cv.templatable(cv.boolean)
}
)
Expand Down
6 changes: 4 additions & 2 deletions components/nuki_lock/number/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
from esphome.const import (
ENTITY_CATEGORY_CONFIG,
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

NukiLockLedBrightnessNumber = nuki_lock_ns.class_("NukiLockLedBrightnessNumber", number.Number, cg.Component)

DEPENDENCIES = ["nuki_lock"]

CONF_LED_BRIGHTNESS_NUMBER = "led_brightness"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Optional(CONF_LED_BRIGHTNESS_NUMBER): number.number_schema(
NukiLockLedBrightnessNumber,
entity_category=ENTITY_CATEGORY_CONFIG,
Expand Down
6 changes: 4 additions & 2 deletions components/nuki_lock/sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
UNIT_PERCENT,
DEVICE_CLASS_BATTERY,
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

DEPENDENCIES = ["nuki_lock"]

CONF_BATTERY_LEVEL = "battery_level"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Optional(CONF_BATTERY_LEVEL): sensor.sensor_schema(
device_class=DEVICE_CLASS_BATTERY,
unit_of_measurement=UNIT_PERCENT,
Expand Down
6 changes: 4 additions & 2 deletions components/nuki_lock/switch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
DEVICE_CLASS_SWITCH,
ENTITY_CATEGORY_CONFIG,
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

NukiLockPairingModeSwitch = nuki_lock_ns.class_("NukiLockPairingModeSwitch", switch.Switch, cg.Component)
NukiLockButtonEnabledSwitch = nuki_lock_ns.class_("NukiLockButtonEnabledSwitch", switch.Switch, cg.Component)
NukiLockLedEnabledSwitch = nuki_lock_ns.class_("NukiLockLedEnabledSwitch", switch.Switch, cg.Component)

DEPENDENCIES = ["nuki_lock"]

CONF_PAIRING_MODE_SWITCH = "pairing_mode"
CONF_BUTTON_ENABLED_SWITCH = "button_enabled"
CONF_LED_ENABLED_SWITCH = "led_enabled"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Optional(CONF_PAIRING_MODE_SWITCH): switch.switch_schema(
NukiLockPairingModeSwitch,
device_class=DEVICE_CLASS_SWITCH,
Expand Down
6 changes: 4 additions & 2 deletions components/nuki_lock/text_sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
UNIT_PERCENT,
DEVICE_CLASS_BATTERY,
)
from .. import CONF_NUKI_LOCK_ID, NukiLock, nuki_lock_ns
from .. import CONF_NUKI_LOCK_ID, NukiLockComponent, nuki_lock_ns

DEPENDENCIES = ["nuki_lock"]

CONF_DOOR_SENSOR_STATE = "door_sensor_state"

CONFIG_SCHEMA = {
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLock),
cv.GenerateID(CONF_NUKI_LOCK_ID): cv.use_id(NukiLockComponent),
cv.Optional(CONF_DOOR_SENSOR_STATE): text_sensor.text_sensor_schema(),
}

Expand Down

0 comments on commit 9f6521d

Please sign in to comment.