mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
refactor: Align Phillips Hue to reworked device handling (#712)
* Align PhilipsHue (Classic) * Minor Device corrections * Have code working with Qt < 5.10 * Fixes on Hue Wizzard * Fixes on Hue Wizzard * Calculate Latchtime only for lights updated by hyperion * Allow to disable restoring original light's state * Fix - LightIDs / LightMap vectors were not cleared when reopening the device * Reduce API Calls for state updates by consolidation
This commit is contained in:
@@ -37,13 +37,13 @@ static const char STATE_ONOFF_VALUE[] = "value";
|
||||
static const char STATE_VALUE_TRUE[] = "true";
|
||||
static const char STATE_VALUE_FALSE[] = "false";
|
||||
|
||||
//Device Data elements
|
||||
// Device Data elements
|
||||
static const char DEV_DATA_NAME[] = "name";
|
||||
static const char DEV_DATA_MODEL[] = "model";
|
||||
static const char DEV_DATA_MANUFACTURER[] = "manufacturer";
|
||||
static const char DEV_DATA_FIRMWAREVERSION[] = "firmwareVersion";
|
||||
|
||||
//Nanoleaf Stream Control elements
|
||||
// Nanoleaf Stream Control elements
|
||||
//static const char STREAM_CONTROL_IP[] = "streamControlIpAddr";
|
||||
static const char STREAM_CONTROL_PORT[] = "streamControlPort";
|
||||
//static const char STREAM_CONTROL_PROTOCOL[] = "streamControlProtocol";
|
||||
@@ -59,7 +59,7 @@ static const char API_STATE[] ="state";
|
||||
static const char API_PANELLAYOUT[] = "panelLayout";
|
||||
static const char API_EFFECT[] = "effects";
|
||||
|
||||
//Nanoleaf ssdp services
|
||||
// Nanoleaf ssdp services
|
||||
static const char SSDP_CANVAS[] = "nanoleaf:nl29";
|
||||
static const char SSDP_LIGHTPANELS[] = "nanoleaf_aurora:light";
|
||||
const int SSDP_TIMEOUT = 5000; // timout in ms
|
||||
@@ -132,7 +132,7 @@ bool LedDeviceNanoleaf::init(const QJsonObject &deviceConfig)
|
||||
if ( _hostname.isEmpty() )
|
||||
{
|
||||
//Discover Nanoleaf device
|
||||
if ( !discoverNanoleafDevice() )
|
||||
if ( !discoverDevice() )
|
||||
{
|
||||
this->setInError("No target IP defined nor Nanoleaf device was discovered");
|
||||
return false;
|
||||
@@ -256,24 +256,17 @@ int LedDeviceNanoleaf::open()
|
||||
|
||||
if ( init(_devConfig) )
|
||||
{
|
||||
if ( !initNetwork() )
|
||||
if ( initLeds() )
|
||||
{
|
||||
this->setInError( "UDP Network error!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( initLeds() )
|
||||
{
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
}
|
||||
_deviceReady = true;
|
||||
setEnable(true);
|
||||
retval = 0;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool LedDeviceNanoleaf::discoverNanoleafDevice()
|
||||
bool LedDeviceNanoleaf::discoverDevice()
|
||||
{
|
||||
|
||||
bool isDeviceFound (false);
|
||||
|
Reference in New Issue
Block a user