From aca757138ef50931454b68f92a5ba27a0f8f5d46 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Tue, 16 Apr 2024 21:57:51 +0200 Subject: [PATCH] Nanoleaf Updates (#1724) * Add new devices * Do not restore ExtControl state --- assets/webconfig/js/content_leds.js | 4 ++++ libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp | 4 ++-- libsrc/leddevice/dev_net/LedDeviceNanoleaf.h | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/webconfig/js/content_leds.js b/assets/webconfig/js/content_leds.js index 938bf8ee..f058450a 100755 --- a/assets/webconfig/js/content_leds.js +++ b/assets/webconfig/js/content_leds.js @@ -2510,6 +2510,10 @@ function nanoleafGeneratelayout(panelLayout, panelOrderTopDown, panelOrderLeftRi 18: { name: "LightLinesSingleZone", led: true, sideLengthX: 77, sideLengthY: 77 }, 19: { name: "ControllerCap", led: false, sideLengthX: 11, sideLengthY: 11 }, 20: { name: "PowerConnector", led: false, sideLengthX: 11, sideLengthY: 11 }, + 29: { name: "4DLightstrip", led: true, sideLengthX: 50, sideLengthY: 50 }, + 30: { name: "Skylight Panel", led: true, sideLengthX: 180, sideLengthY: 180 }, + 31: { name: "SkylightControllerPrimary", led: true, sideLengthX: 180, sideLengthY: 180 }, + 32: { name: "SkylightControllerPassive", led: true, sideLengthX: 180, sideLengthY: 180 }, 999: { name: "Unknown", led: true, sideLengthX: 100, sideLengthY: 100 } }; diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp index e2b8b3fb..d7711a02 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.cpp @@ -708,7 +708,7 @@ bool LedDeviceNanoleaf::storeState() QJsonObject effects = responseEffects.getBody().object(); DebugIf(verbose, _log, "effects: [%s]", QString(QJsonDocument(_originalStateProperties).toJson(QJsonDocument::Compact)).toUtf8().constData()); _originalEffect = effects[API_EFFECT_SELECT].toString(); - _originalIsDynEffect = _originalEffect == "*Dynamic*" || _originalEffect == "*Solid*"; + _originalIsDynEffect = _originalEffect != "*Dynamic*" || _originalEffect == "*Solid*" || _originalEffect == "*ExtControl*"; } break; } @@ -759,7 +759,7 @@ bool LedDeviceNanoleaf::restoreState() } } else { - Warning(_log, "%s restoring effect failed with error: Cannot restore dynamic or solid effect. Device is switched off", QSTRING_CSTR(_activeDeviceType)); + Info(_log, "%s cannot restore dynamic or solid effects. Device is switched off instead", QSTRING_CSTR(_activeDeviceType)); _originalIsOn = false; } break; diff --git a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h index 8aae03ec..dd9353b6 100644 --- a/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h +++ b/libsrc/leddevice/dev_net/LedDeviceNanoleaf.h @@ -179,7 +179,11 @@ private: LIGHT_LINES = 17, LIGHT_LINES_SINGLZONE = 18, CONTROLLER_CAP = 19, - POWER_CONNECTOR = 20 + POWER_CONNECTOR = 20, + NL_4D_LIGHTSTRIP = 29, + SKYLIGHT_PANEL = 30, + SKYLIGHT_CONTROLLER_PRIMARY = 31, + SKYLIGHT_CONTROLLER_PASSIV = 32 }; ///