[nuki] Opener support and discovery (#10672)
* [nuki] Opener support and discovery (#10671) * Added Opener support * New Smartlock channels * Discovery support * Secured communication using hashed token * Improved callback handling Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Fixed code style problems Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Id of bridge is unique for openhab instance Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Added compatibility with smart lock created by previous binding version Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Secure token configuration + threading improvements Added configuration option to enable or disable using hashed token for bridge API authentication. Turning bridge offline when device request fails. All HTTP calls made async so that openhab thread is not blocked. Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Only discover bridges which return some response Only bridges which return 200 or 403 response are discovered. Nuki API might return bridges which no longer exists or are on different network and are not reachable. We do not want to put these in inbox, only those who respond do HTTP calls. Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Changed ownership of nuki binding Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Code review changes * Fixed @Nullable annotations * Fixed too many logger messages * Rewritten configuration to use configuration class Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Code review changes * NukiId moved back to configuration and switched to configuration classes in all devices * Doorbell ringing channel switched to trigger channel Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Code review changes * Channel description reformatted into table * Fixed bug where repeated bridge discovery was overwriting existing bridge properties Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Fixed ringactionTimestamp property name Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Fixed search of changed thing in HTTP callback Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Improvements to uuid generation * Bridge id is generated only from bridgeId property, making it stable across openhab installations * Using InstanceUUID as unique callback identifier instead of bridge id Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Improved duplicate thing discovery * Implemented duplicate thing detection using openHAB ThingRegistry Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com> * Code review changes * Fixed all nullable warnings * Fixed README formatting Signed-off-by: Jan Vybíral <jan.vybiral1@gmail.com>
This commit is contained in:
@@ -9,6 +9,13 @@
|
||||
<label>Nuki Bridge</label>
|
||||
<description>This bridge represents a Nuki Bridge on your local network. Nuki Smart Locks have to be paired via
|
||||
Bluetooth with it.</description>
|
||||
<properties>
|
||||
<property name="bridgeId"/>
|
||||
<property name="hardwareId"/>
|
||||
<property name="serverId"/>
|
||||
<property name="firmwareVersion"/>
|
||||
<property name="wifiFirmwareVersion"/>
|
||||
</properties>
|
||||
<config-description>
|
||||
<parameter name="ip" type="text" required="true">
|
||||
<label>IP Address</label>
|
||||
@@ -16,7 +23,7 @@
|
||||
<description>The IP address of the Nuki Bridge. Look it up on your router. It is recommended to set a static IP
|
||||
address lease for the Nuki Bridge (and for your openHAB server too) on your router.</description>
|
||||
</parameter>
|
||||
<parameter name="port" type="integer" required="false">
|
||||
<parameter name="port" type="integer" required="true">
|
||||
<label>Port</label>
|
||||
<description>The Port which you configured during Initial Bridge setup
|
||||
(https://nuki.io/en/support/bridge/bridge-setup/initial-bridge-setup/).</description>
|
||||
@@ -30,14 +37,31 @@
|
||||
</parameter>
|
||||
<parameter name="manageCallbacks" type="boolean" required="false">
|
||||
<label>Manage Nuki Bridge Callbacks</label>
|
||||
<description>Let the Nuki Binding manage the callback on the Nuki Bridge.</description>
|
||||
<description>
|
||||
Let the Nuki Binding manage the callback on the Nuki Bridge. Nuki bridge uses HTTP callback to notify
|
||||
openHAB about changes in device properties (e.g. when doors are opened, unlocked, doorbell rings, battery level
|
||||
changes etc.). If callback is not registered, binding will not work properly and channels will not be updated. If
|
||||
this is enabled, binding will automatically register and unregister callback as necessary. If this is disabled,
|
||||
user must register callback manually. It is recommended that this is turned on.
|
||||
</description>
|
||||
<default>true</default>
|
||||
</parameter>
|
||||
<parameter name="secureToken" type="boolean" required="false">
|
||||
<label>Secure Token</label>
|
||||
<description>
|
||||
Use hashed token when communicating with bridge. This increases security and prevents sniffing of
|
||||
access token and replay attacks, since communication with bridge is not encrypted. For this feature to work, both
|
||||
device running openHAB and Nuki Bridge must have synchronized time. When disabled, token is sent in plain text with
|
||||
each bridge request. It is recommended that this is turned on unless there are problems with synchronizing time
|
||||
between openHAB and Nuki Bridge.
|
||||
</description>
|
||||
<default>true</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</bridge-type>
|
||||
|
||||
<!-- Nuki Smart Lock (Thing Type) -->
|
||||
<thing-type id="smartlock">
|
||||
<thing-type id="smartlock" listed="false">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
@@ -47,20 +71,54 @@
|
||||
<channel id="lock" typeId="smartlockLock"/>
|
||||
<channel id="lockState" typeId="smartlockState"/>
|
||||
<channel id="lowBattery" typeId="system.low-battery"/>
|
||||
<channel id="keypadLowBattery" typeId="system.low-battery"/>
|
||||
<channel id="batteryLevel" typeId="system.battery-level"/>
|
||||
<channel id="batteryCharging" typeId="smartLockBatteryCharging"/>
|
||||
<channel id="doorsensorState" typeId="smartlockDoorState"/>
|
||||
</channels>
|
||||
<properties>
|
||||
<property name="name"/>
|
||||
<property name="firmwareVersion"/>
|
||||
</properties>
|
||||
<representation-property>nukiId</representation-property>
|
||||
<config-description>
|
||||
<parameter name="nukiId" type="text" required="true">
|
||||
<label>Nuki ID</label>
|
||||
<description>The 8-digit hexadecimal string that identifies the Nuki Smart Lock. Look it up on the sticker on the
|
||||
back of the Nuki Smart Lock (remove mounting plate).</description>
|
||||
</parameter>
|
||||
<parameter name="unlatch" type="boolean" required="false">
|
||||
<label>Unlatch</label>
|
||||
<description>If switched to On (or set to true) the Nuki Smart Lock will unlock the door but then also automatically
|
||||
pull the latch of the door lock. Usually, if the door hinges are correctly adjusted, the door will then swing open.</description>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
<parameter name="nukiId" type="text" required="true" readOnly="true">
|
||||
<label>Nuki ID</label>
|
||||
<description>The decimal string that identifies the Nuki Smart Lock.</description>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<!-- Nuki Opener (Thing Type) -->
|
||||
<thing-type id="opener" listed="false">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Nuki Opener</label>
|
||||
<description>Nuki Opener which is paired via Bluetooth to a Nuki Bridge.</description>
|
||||
<channels>
|
||||
<channel id="openerState" typeId="openerState"/>
|
||||
<channel id="openerMode" typeId="openerMode"/>
|
||||
<channel id="openerLowBattery" typeId="system.low-battery"/>
|
||||
<channel id="ringActionState" typeId="ringActionState"/>
|
||||
<channel id="ringActionTimestamp" typeId="ringActionTimestamp"/>
|
||||
</channels>
|
||||
<properties>
|
||||
<property name="name"/>
|
||||
<property name="firmwareVersion"/>
|
||||
</properties>
|
||||
<representation-property>nukiId</representation-property>
|
||||
<config-description>
|
||||
<parameter name="nukiId" type="text" required="true" readOnly="true">
|
||||
<label>Nuki ID</label>
|
||||
<description>The decimal string that identifies the Nuki Opener.</description>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
@@ -101,13 +159,37 @@
|
||||
<option value="255">UNDEFINED</option>
|
||||
</options>
|
||||
</state>
|
||||
<command>
|
||||
<options>
|
||||
<option value="1">Unlock</option>
|
||||
<option value="2">Lock</option>
|
||||
<option value="3">Unlatch</option>
|
||||
<option value="4">Lock'n'go</option>
|
||||
<option value="5">Lock'n'go with unlatch</option>
|
||||
</options>
|
||||
</command>
|
||||
<autoUpdatePolicy>veto</autoUpdatePolicy>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="smartLockBatteryCharging">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Battery Charging</label>
|
||||
<description>Use this channel to display the current state of charging</description>
|
||||
<category>Energy</category>
|
||||
<state readOnly="true">
|
||||
<options>
|
||||
<option value="OFF">Battery is not charging</option>
|
||||
<option value="ON">Battery is charging</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="smartlockDoorState">
|
||||
<item-type>Number</item-type>
|
||||
<label>Door State</label>
|
||||
<description>Use this channel to display the current state of the door sensor</description>
|
||||
<category>Door</category>
|
||||
<state>
|
||||
<state readOnly="true">
|
||||
<options>
|
||||
<option value="0">Unavailable</option>
|
||||
<option value="1">Deactivated</option>
|
||||
@@ -117,6 +199,69 @@
|
||||
<option value="5">Calibrating</option>
|
||||
</options>
|
||||
</state>
|
||||
<autoUpdatePolicy>veto</autoUpdatePolicy>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="openerState">
|
||||
<item-type>Number</item-type>
|
||||
<label>Opener State</label>
|
||||
<description>Use this channel if you want to execute other supported opener actions or to display the current opener
|
||||
state.</description>
|
||||
<category>FrontDoor</category>
|
||||
<state>
|
||||
<options>
|
||||
<option value="0">Untrained</option>
|
||||
<option value="1">Online</option>
|
||||
<option value="3">Ring to open active</option>
|
||||
<option value="5">Open</option>
|
||||
<option value="7">Opening</option>
|
||||
<option value="253">Boot run</option>
|
||||
<option value="255">Undefined</option>
|
||||
</options>
|
||||
</state>
|
||||
<command>
|
||||
<options>
|
||||
<option value="1">Activate ring to open</option>
|
||||
<option value="2">Deactivate ring to open</option>
|
||||
<option value="3">Electric strike actuation</option>
|
||||
<option value="4">Activate continuous mode</option>
|
||||
<option value="5">Deactivate continuous mode</option>
|
||||
</options>
|
||||
</command>
|
||||
<autoUpdatePolicy>veto</autoUpdatePolicy>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="openerMode">
|
||||
<item-type>Number</item-type>
|
||||
<label>Opener Mode</label>
|
||||
<description>Use this channel to display/set current mode of the opener</description>
|
||||
<category>FrontDoor</category>
|
||||
<state readOnly="true">
|
||||
<options>
|
||||
<option value="2">Door mode</option>
|
||||
<option value="3">Continuous mode</option>
|
||||
</options>
|
||||
</state>
|
||||
<autoUpdatePolicy>veto</autoUpdatePolicy>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="ringActionState">
|
||||
<kind>trigger</kind>
|
||||
<label>Ring Action State</label>
|
||||
<description>Channel is triggered when doorbell is rang, at most once every 30s</description>
|
||||
<category>Siren</category>
|
||||
<event>
|
||||
<options>
|
||||
<option value="RINGING">Doorbell is ringing</option>
|
||||
</options>
|
||||
</event>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="ringActionTimestamp">
|
||||
<item-type>DateTime</item-type>
|
||||
<label>Ring Action Timestamp</label>
|
||||
<description>Time of last ring action</description>
|
||||
<category>Siren</category>
|
||||
<autoUpdatePolicy>veto</autoUpdatePolicy>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
|
||||
Reference in New Issue
Block a user