Nanoleaf Updates (#1299)

* Discover additional Nanoleaf devices

* Fix Nanoleaf not turning on

* Added LGTM configuration file

* Allow to pass QJsonObject as payload for put

* Nanoleaf - Support Restore State & Overwrite Brightness

* Removed because this is already included

Co-authored-by: Markus <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
LordGrey
2021-08-31 10:55:49 +02:00
committed by GitHub
parent 12cdd1d58a
commit f0bd38d473
5 changed files with 301 additions and 50 deletions

View File

@@ -126,6 +126,25 @@ protected:
///
bool powerOff() override;
///
/// @brief Store the device's original state.
///
/// Save the device's state before hyperion color streaming starts allowing to restore state during switchOff().
///
/// @return True if success
///
bool storeState() override;
///
/// @brief Restore the device's original state.
///
/// Restore the device's state as before hyperion color streaming started.
/// This includes the on/off state of the device.
///
/// @return True, if success
///
bool restoreState() override;
private:
///
@@ -159,14 +178,6 @@ private:
/// @return True, if success
bool changeToExternalControlMode(QJsonDocument& resp);
///
/// @brief Get command to power Nanoleaf device on or off
///
/// @param isOn True, if to switch on device
/// @return Command to switch device on/off
///
QString getOnOffRequest(bool isOn) const;
///
/// @brief Discover Nanoleaf devices available (for configuration).
/// Nanoleaf specific ssdp discovery
@@ -197,6 +208,21 @@ private:
/// Array of the panel ids.
QVector<int> _panelIds;
QJsonObject _originalStateProperties;
bool _isBrightnessOverwrite;
int _brightness;
QString _originalColorMode;
bool _originalIsOn;
int _originalHue;
int _originalSat;
int _originalCt;
int _originalBri;
QString _originalEffect;
bool _originalIsDynEffect {false};
};
#endif // LEDEVICENANOLEAF_H