Skip to content

Commit

Permalink
Remove old code to create Ikea 5-button remote control
Browse files Browse the repository at this point in the history
  • Loading branch information
manup committed Jan 30, 2019
1 parent 7ff7325 commit 2b58052
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions rest_sensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2992,73 +2992,7 @@ void DeRestPluginPrivate::handleIndicationSearchSensors(const deCONZ::ApsDataInd
return;

// filter for remote control toggle command (large button)
if (ind.srcEndpoint() == 0x01 && ind.clusterId() == ONOFF_CLUSTER_ID && zclFrame.commandId() == 0x02)
{
DBG_Printf(DBG_INFO, "ikea remote toggle button\n");

if (searchSensorsState != SearchSensorsActive)
{
return;
}

Sensor *s = getSensorNodeForAddressAndEndpoint(ind.srcAddress(), ind.srcEndpoint());

if (!s)
{
Sensor sensorNode;
SensorFingerprint &fp = sensorNode.fingerPrint();
fp.endpoint = 0x01;
fp.deviceId = DEV_ID_ZLL_COLOR_SCENE_CONTROLLER;
fp.profileId = HA_PROFILE_ID;
fp.inClusters.push_back(BASIC_CLUSTER_ID);
fp.inClusters.push_back(COMMISSIONING_CLUSTER_ID);
fp.inClusters.push_back(POWER_CONFIGURATION_CLUSTER_ID);
fp.outClusters.push_back(ONOFF_CLUSTER_ID);
fp.outClusters.push_back(LEVEL_CLUSTER_ID);
fp.outClusters.push_back(SCENE_CLUSTER_ID);

sensorNode.setNode(0);
sensorNode.address() = sc->address;
sensorNode.setType("ZHASwitch");
sensorNode.fingerPrint() = fp;
sensorNode.setUniqueId(generateUniqueId(sensorNode.address().ext(), sensorNode.fingerPrint().endpoint, COMMISSIONING_CLUSTER_ID));
sensorNode.setManufacturer(QLatin1String("IKEA of Sweden"));
sensorNode.setModelId(QLatin1String("TRADFRI remote control"));
sensorNode.setMode(Sensor::ModeColorTemperature);
sensorNode.setNeedSaveDatabase(true);

ResourceItem *item;
item = sensorNode.item(RConfigOn);
item->setValue(true);

item = sensorNode.item(RConfigReachable);
item->setValue(true);

sensorNode.addItem(DataTypeInt32, RStateButtonEvent);
sensorNode.updateStateTimestamp();

sensorNode.setNeedSaveDatabase(true);
updateSensorEtag(&sensorNode);

openDb();
sensorNode.setId(QString::number(getFreeSensorId()));
closeDb();
sensorNode.setName(QString("Remote control %1").arg(sensorNode.id()));
sensors.push_back(sensorNode);
s = &sensors.back();
updateSensorEtag(s);
Event e(RSensors, REventAdded, sensorNode.id());
enqueueEvent(e);

//fastProbeAddr = sc->address;
if (!fastProbeTimer->isActive())
{
fastProbeTimer->start(100);
}
}
}
//else if (ind.srcEndpoint() == 0x01 && ind.clusterId() == SCENE_CLUSTER_ID && zclFrame.commandId() == 0x09 && zclFrame.manufacturerCode() == VENDOR_IKEA)
else if (ind.srcEndpoint() == 0x01 && ind.clusterId() == SCENE_CLUSTER_ID && zclFrame.manufacturerCode() == VENDOR_IKEA &&
if (ind.srcEndpoint() == 0x01 && ind.clusterId() == SCENE_CLUSTER_ID && zclFrame.manufacturerCode() == VENDOR_IKEA &&
zclFrame.commandId() == 0x07 && zclFrame.payload().at(0) == 0x02)
{
// TODO move following legacy cleanup code in Phoscon App / switch editor
Expand Down

0 comments on commit 2b58052

Please sign in to comment.