diff --git a/de_web_plugin.cpp b/de_web_plugin.cpp index ad5299b8d2..09b26311ec 100644 --- a/de_web_plugin.cpp +++ b/de_web_plugin.cpp @@ -1470,6 +1470,7 @@ void DeRestPluginPrivate::gpProcessButtonEvent(const deCONZ::GpDataIndication &i sensor->rx(); quint32 btn = ind.gpdCommandId(); + if (sensor->modelId() == QLatin1String("FOHSWITCH")) { // Map the command to the mapped button and action. @@ -1596,6 +1597,36 @@ void DeRestPluginPrivate::gpProcessButtonEvent(const deCONZ::GpDataIndication &i btn = btnMapped + S_BUTTON_ACTION_LONG_RELEASED; } } + else if (sensor->modelId() == QLatin1String("LEGRANDZGPTOGGLESWITCH")) + { + if (btn == deCONZ::GpCommandIdToggle) + { + btn = S_BUTTON_1 + S_BUTTON_ACTION_SHORT_RELEASED; + } + else //Will be deCONZ::GpCommandIdOff + { + btn = S_BUTTON_1 + S_BUTTON_ACTION_DOUBLE_PRESS; + } + } + else if (sensor->modelId() == QLatin1String("LEGRANDZGPSCENESWITCH")) + { + if (btn == deCONZ::GpCommandIdScene4) + { + btn = S_BUTTON_1 + S_BUTTON_ACTION_SHORT_RELEASED; + } + else if (btn == deCONZ::GpCommandIdScene5) + { + btn = S_BUTTON_2 + S_BUTTON_ACTION_SHORT_RELEASED; + } + else if (btn == deCONZ::GpCommandIdScene6) + { + btn = S_BUTTON_3 + S_BUTTON_ACTION_SHORT_RELEASED; + } + else //Will be deCONZ::GpCommandIdScene7 + { + btn = S_BUTTON_4 + S_BUTTON_ACTION_SHORT_RELEASED; + } + } updateSensorEtag(sensor); sensor->updateStateTimestamp(); @@ -1649,6 +1680,9 @@ int DeRestPluginPrivate::taskCountForAddress(const deCONZ::Address &address) */ void DeRestPluginPrivate::gpDataIndication(const deCONZ::GpDataIndication &ind) { + // display some information + DBG_Printf(DBG_ZGP, "Incoming ZGP Frame: gpdsrcid %u, command 0x%02X, Payload %s\n", ind.gpdSrcId(), ind.gpdCommandId(), qPrintable(ind.payload().toHex())); + switch (ind.gpdCommandId()) { case deCONZ::GpCommandIdScene0: @@ -1820,6 +1854,9 @@ void DeRestPluginPrivate::gpDataIndication(const deCONZ::GpDataIndication &ind) { return; } + + // display some information + DBG_Printf(DBG_ZGP, "Device commissioning : device type 0x%02X, options.byte 0x%02X, extOptions.byte 0x%02X\n", gpdDeviceId, options.byte, extOptions.byte); // create new sensor Sensor sensorNode; @@ -1865,6 +1902,38 @@ void DeRestPluginPrivate::gpDataIndication(const deCONZ::GpDataIndication &ind) sensorNode.setManufacturer("PhilipsFoH"); sensorNode.setSwVersion("PTM216Z"); } + else if (gpdDeviceId == GpDeviceIdOnOffSwitch && options.byte == 0xC5 && extOptions.byte == 0xF2 && ind.payload().size() == 31) + { + //For the 1 button switch (0 677 23L or ZLGP17): + //Button 1: Device commissioning : options.byte 0xC5 , extOptions.byte 0xF2 , gpdsrcid 5345230 , gpdDeviceId 0x02 , Payload 02c5f20164366c366d12f5587972fd1dae3dee65ff1de0f001000004022220 + + //For the 2 buttons switch (0 677 24L or ZLGP18): + //Button 1: Device commissioning : options.byte 0xC5 , extOptions.byte 0xF2 , gpdsrcid 5375258 , gpdDeviceId 0x02 , Payload 02c5f29ddf38cc0baaa63c6d8c31176a7d50892a7f84e35f00000004022220 + //Button 2: Device commissioning : options.byte 0xC5 , extOptions.byte 0xF2 , gpdsrcid 5375259 , gpdDeviceId 0x02 , Payload 02c5f2361cf5a1f812cebb4744edfec5d591f07fe3e2935800000004022220 + + // they use as command + // 0x20 GpCommandIdOff + // 0x22 GpCommandIdToggle + + sensorNode.setModelId("LEGRANDZGPTOGGLESWITCH"); + sensorNode.setManufacturer("Legrand"); + sensorNode.setSwVersion("1.0"); + } + else if (gpdDeviceId == 0xfe && options.byte == 0xC5 && extOptions.byte == 0xF2 && ind.payload().size() == 37) //0xfe is for scene switch ? + { + //For the 4 buttons switch (0 677 55L or ZLGP15): + // Device commissioning : options.byte 0xC5 , extOptions.byte 0xF2 , gpdsrcid 5350418 , gpdDeviceId 0x02 , Payload fec5f20aed654eac2b62be20be25648b591e5097033fbf640000000408141516171c1d1e1f + + // they use as command + // 0x14 GpCommandIdScene4 + // 0x15 GpCommandIdScene5 + // 0x16 GpCommandIdScene6 + // 0x17 GpCommandIdScene7 + + sensorNode.setModelId("LEGRANDZGPSCENESWITCH"); + sensorNode.setManufacturer("Legrand"); + sensorNode.setSwVersion("1.0"); + } else { DBG_Printf(DBG_INFO, "unsupported green power device 0x%02X\n", gpdDeviceId); @@ -1897,6 +1966,11 @@ void DeRestPluginPrivate::gpDataIndication(const deCONZ::GpDataIndication &ind) { sensorNode.setName(QString("FoH Switch %2").arg(sensorNode.id())); } + else if (sensorNode.modelId() == QLatin1String("LEGRANDZGPTOGGLESWITCH") || + sensorNode.modelId() == QLatin1String("LEGRANDZGPSCENESWITCH")) + { + sensorNode.setName(QString("Self-e switch %2").arg(sensorNode.id())); + } else { sensorNode.setName(QString("Hue Tap %2").arg(sensorNode.id()));