Skip to content

Commit

Permalink
Change all entities to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Nov 1, 2024
1 parent 61e6993 commit e0529e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .github/test-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ lock:
name: "Nuki Fob Action 2"
fob_action_3:
name: "Nuki Fob Action 3"
timezone:
name: "Nuki Timezone"
advertising_mode:
name: "Nuki Advertising Mode"

pairing_mode_timeout: 300s
event: "nuki"
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,30 @@ esp32:
platform_version: 6.7.0

lock:
# Required:
# Required
- platform: nuki_lock
name: Nuki Lock
# Optional: Settings
pairing_mode_timeout: 300s
event: "nuki"
# Optional: Binary Sensors
is_connected:
name: "Nuki Connected"
is_paired:
name: "Nuki Paired"

# Optional:
battery_critical:
name: "Nuki Battery Critical"
door_sensor:
name: "Nuki Door Sensor"

# Optional: Sensors
battery_level:
name: "Nuki Battery Level"

# Optional: Text Sensors
door_sensor_state:
name: "Nuki Door Sensor: State"
last_unlock_user:
name: "Nuki Last Unlock User"

# Optional: Switches
pairing_mode:
name: "Nuki Pairing Mode"
auto_unlatch:
Expand All @@ -52,10 +54,12 @@ lock:
name: "Nuki Button: Locking operations"
led_enabled:
name: "Nuki LED Signal"

# Optional: Number Inputs
security_pin:
name: "Nuki Security Pin"
led_brightness:
name: "Nuki LED Brightness"

# Optional: Switches
night_mode_enabled:
name: "Nuki Night Mode"
night_mode_auto_lock_enabled:
Expand All @@ -72,7 +76,7 @@ lock:
name: "Nuki Auto Lock: Immediately"
auto_update_enabled:
name: "Nuki Automatic Updates"
# Optional: Select Inputs
single_buton_press_action:
name: "Nuki Button: Single Press Action"
double_buton_press_action:
Expand All @@ -83,17 +87,13 @@ lock:
name: "Nuki Fob: Action 2"
fob_action_3:
name: "Nuki Fob: Action 3"

timezone:
name: "Nuki Timezone"
advertising_mode:
name: "Nuki Advertising Mode"
# Optional: Buttons
unpair:
name: "Nuki Unpair Device"

security_pin:
name: "Nuki Security Pin"

# Optional: Settings
pairing_mode_timeout: 300s
event: "nuki"

# Optional: Callbacks
on_pairing_mode_on_action:
- lambda: ESP_LOGI("nuki_lock", "Pairing mode turned on");
Expand Down
7 changes: 5 additions & 2 deletions components/nuki_lock/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
NukiLock = nuki_lock_ns.class_('NukiLockComponent', lock.Lock, switch.Switch, cg.Component)

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

NukiLockPairingModeSwitch = nuki_lock_ns.class_("NukiLockPairingModeSwitch", switch.Switch, cg.Component)
NukiLockAutoUnlatchEnabledSwitch = nuki_lock_ns.class_("NukiLockAutoUnlatchEnabledSwitch", switch.Switch, cg.Component)
NukiLockButtonEnabledSwitch = nuki_lock_ns.class_("NukiLockButtonEnabledSwitch", switch.Switch, cg.Component)
Expand All @@ -155,8 +156,10 @@
NukiLockAutoUnlockDisabledSwitch = nuki_lock_ns.class_("NukiLockAutoUnlockDisabledSwitch", switch.Switch, cg.Component)
NukiLockImmediateAutoLockEnabledSwitch = nuki_lock_ns.class_("NukiLockImmediateAutoLockEnabledSwitch", switch.Switch, cg.Component)
NukiLockAutoUpdateEnabledSwitch = nuki_lock_ns.class_("NukiLockAutoUpdateEnabledSwitch", switch.Switch, cg.Component)

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

NukiLockSingleButtonPressActionSelect = nuki_lock_ns.class_("NukiLockSingleButtonPressActionSelect", select.Select, cg.Component)
NukiLockDoubleButtonPressActionSelect = nuki_lock_ns.class_("NukiLockDoubleButtonPressActionSelect", select.Select, cg.Component)
NukiLockFobAction1Select = nuki_lock_ns.class_("NukiLockFobAction1Select", select.Select, cg.Component)
Expand All @@ -179,12 +182,12 @@

CONFIG_SCHEMA = lock.LOCK_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(NukiLock),
cv.Required(CONF_IS_CONNECTED): binary_sensor.binary_sensor_schema(
cv.Optional(CONF_IS_CONNECTED): binary_sensor.binary_sensor_schema(
device_class=DEVICE_CLASS_CONNECTIVITY,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
icon="mdi:link"
),
cv.Required(CONF_IS_PAIRED): binary_sensor.binary_sensor_schema(
cv.Optional(CONF_IS_PAIRED): binary_sensor.binary_sensor_schema(
device_class=DEVICE_CLASS_CONNECTIVITY,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
icon="mdi:link"
Expand Down

0 comments on commit e0529e3

Please sign in to comment.