From 865721fc5ba676e9dc46b15290358309ddee96cd Mon Sep 17 00:00:00 2001 From: bluewalk Date: Tue, 22 Dec 2020 13:58:01 +0100 Subject: [PATCH] Fixed forgotten topics for newly introduced properties --- AssemblyVersionInfo.cs | 2 +- .../Logic/NukiBridge2MqttLogic.cs | 16 ++++++++++++++++ README.md | 10 +++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/AssemblyVersionInfo.cs b/AssemblyVersionInfo.cs index 8521a60..9badd4f 100644 --- a/AssemblyVersionInfo.cs +++ b/AssemblyVersionInfo.cs @@ -25,4 +25,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.3.0")] +[assembly: AssemblyVersion("1.5.3.1")] diff --git a/Net.Bluewalk.NukiBridge2Mqtt/Logic/NukiBridge2MqttLogic.cs b/Net.Bluewalk.NukiBridge2Mqtt/Logic/NukiBridge2MqttLogic.cs index cd46eee..98abbfe 100644 --- a/Net.Bluewalk.NukiBridge2Mqtt/Logic/NukiBridge2MqttLogic.cs +++ b/Net.Bluewalk.NukiBridge2Mqtt/Logic/NukiBridge2MqttLogic.cs @@ -202,6 +202,10 @@ private async void HttpListenAsync() device.LastKnownState.DoorSensorState = callback.DoorSensorState; device.LastKnownState.DoorSensorStateName = callback.DoorSensorStateName; device.LastKnownState.Mode = callback.Mode; + device.LastKnownState.KeypadBatteryCritical = callback.KeypadBatteryCritical; + device.LastKnownState.RingActionState = callback.RingActionState; + device.LastKnownState.RingActionTimestamp = callback.RingActionTimestamp; + device.LastKnownState.Timestamp = DateTimeOffset.Now; await PublishDeviceStatus(device); } @@ -294,6 +298,18 @@ private async Task PublishDeviceStatus(Device device) await Publish($"{device.NukiId}/battery-critical", device.LastKnownState?.BatteryCritical.ToString()); await Publish($"{device.NameMqtt}/battery-critical", device.LastKnownState?.BatteryCritical.ToString()); + + await Publish($"{device.NukiId}/keypad-battery-critical", device.LastKnownState?.KeypadBatteryCritical.ToString()); + await Publish($"{device.NameMqtt}/keypad-battery-critical", device.LastKnownState?.KeypadBatteryCritical.ToString()); + + await Publish($"{device.NukiId}/ring-action-state", device.LastKnownState?.RingActionState.ToString()); + await Publish($"{device.NameMqtt}/ring-action-state", device.LastKnownState?.RingActionState.ToString()); + + await Publish($"{device.NukiId}/timestamp", device.LastKnownState?.Timestamp.ToString()); + await Publish($"{device.NameMqtt}/timestamp", device.LastKnownState?.Timestamp.ToString()); + + await Publish($"{device.NukiId}/ring-action-timestamp", device.LastKnownState?.RingActionTimestamp.ToString()); + await Publish($"{device.NameMqtt}/ring-action-timestamp", device.LastKnownState?.RingActionTimestamp.ToString()); } /// diff --git a/README.md b/README.md index 028c6aa..84e7eec 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ Connects Nuki Bridges to MQTT ## Installation -### Service (.NET 4.7) +### Service (.NET 4.8) Extract the release build to a folder and run `Net.Bluewalk.NukiBridge2Mqtt.Service.exe --install`, this will install the service. Seconds update [configuration](#configuration). -### Console app (.NET Core) +### Console app (.NET 5) Copy files to a directory and update [configuration](#configuration). You can optionally create a startup script to always run the console at boot. ### Docker image @@ -80,10 +80,14 @@ ___!NOTE: Prepend the root-topic if provided in the config, by default `nukibrid | reboot | write | `true` to reboot the bridge | | fw-upgrade | write | `true` to immediately check for firmware updates and install it | | callbacks | write | `true` to query all registered callbacks and log these to the logfile | +| {deviceId}/device-action `OR` {deviceName}/device-action | write | Performs an action on the device (`Unlock`, `Lock`, `Unlatch`, `LockNGo`, `LockNGoWithUnlatch`) or for the opener (`ActivateRto`, `DeactivateRto`, `ElectricStrikeActuation`, `ActivateContinuousMode`, `DeactivateContinuousMode`) | | {deviceId}/device-state `OR` {deviceName}/device-state | readonly | Contains the current device state (`Uncalibrated`, `Locked`, `Unlocking`, `Unlocked`, `Locking`, `Unlatched`, `UnlockedLockNGo`, `Unlatching`, `MotorBlocked`, `Undefined`) or for the opener (`Untrained`, `Online`, `RtoActive`, `Open`, `Opening`, `BootRun`, `Undefined` | | {deviceId}/device-mode `OR` {deviceName}/device-mode | readonly | Contains the current device mode (`DoorMode`, `ContinuousMode`) | | {deviceId}/battery-critical `OR` {deviceName}/battery-critical | readonly | `True` or `False` if the battery level is critical | -| {deviceId}/device-action `OR` {deviceName}/device-action | write | Performs an action on the device (`Unlock`, `Lock`, `Unlatch`, `LockNGo`, `LockNGoWithUnlatch`) or for the opener (`ActivateRto`, `DeactivateRto`, `ElectricStrikeActuation`, `ActivateContinuousMode`, `DeactivateContinuousMode`) | +| {deviceId}/keypad-battery-critical `OR` {deviceName}/keypad-battery-critical | readonly | `True` or `False` if the keypad battery level is critical | +| {deviceId}/timestamp `OR` {deviceName}/timestamp | readonly | Timestamp of the last callback | +| {deviceId}/ring-action-state `OR` {deviceName}/ring-action-state | readonly | `True` or `False` depending on the action state | +| {deviceId}/ring-action-timestamp `OR` {deviceName}/ring-action-timestamp | readonly | Timestamp of the last ring action | ** Device name is automatically generated based on the actual Lock Name, eg. `Front door` becomes `front-door`