Skip to content

Commit

Permalink
Update light_node.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Smanar authored and manup committed Oct 21, 2019
1 parent 676957d commit 64fd134
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions light_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ const deCONZ::SimpleDescriptor &LightNode::haEndpoint() const
*/
void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
{
bool isWindowCovering = false;
bool isInitialized = m_haEndpoint.isValid();
m_haEndpoint = endpoint;

Expand Down Expand Up @@ -344,17 +345,6 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)

isInitialized = item(RStateColorMode) != nullptr;
}

//Same problem for legrand, need modelId to correct a device ID (shutter using plug id)
if (manufacturerCode() == VENDOR_LEGRAND && endpoint.deviceId() == DEV_ID_Z30_ONOFF_PLUGIN_UNIT)
{
if (modelId().isEmpty())
{
return;
}

isInitialized = item(RStateColorMode) != nullptr;
}

// initial setup
if (!isInitialized)
Expand Down Expand Up @@ -445,6 +435,7 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
QList<deCONZ::ZclCluster>::const_iterator ic = haEndpoint().inClusters().constBegin();
std::vector<deCONZ::ZclAttribute>::const_iterator ia = ic->attributes().begin();
std::vector<deCONZ::ZclAttribute>::const_iterator enda = ic->attributes().end();
isWindowCovering = true;
bool hasLift = true; // set default to lift
bool hasTilt = false;
for (;ia != enda; ++ia)
Expand Down Expand Up @@ -505,9 +496,10 @@ void LightNode::setHaEndpoint(const deCONZ::SimpleDescriptor &endpoint)
if (haEndpoint().profileId() == HA_PROFILE_ID)
{

if (modelId() == QLatin1String("Shutter switch with neutral"))
if ((manufacturerCode() == VENDOR_LEGRAND) && isWindowCovering)
{
// correct wrong device id for legrand, the window suhtter command is see as plug
// DEV_ID_Z30_ONOFF_PLUGIN_UNIT
deviceId = DEV_ID_HA_WINDOW_COVERING_DEVICE;
}

Expand Down

0 comments on commit 64fd134

Please sign in to comment.