Remove SmartHome leftovers (#9283)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -311,7 +311,7 @@ public class DeviceHandler extends BaseThingHandler implements DeviceStatusListe
|
||||
if (deviceStateUpdate.isSensorUpdateType()) {
|
||||
updateState(getSensorChannelID(deviceStateUpdate.getTypeAsSensorEnum()),
|
||||
new DecimalType(deviceStateUpdate.getValueAsFloat()));
|
||||
logger.debug("Update ESH-State");
|
||||
logger.debug("Update state");
|
||||
return;
|
||||
}
|
||||
if (deviceStateUpdate.isBinarayInputType()) {
|
||||
@@ -402,7 +402,7 @@ public class DeviceHandler extends BaseThingHandler implements DeviceStatusListe
|
||||
}
|
||||
updateState(DsChannelTypeProvider.SHADE, new PercentType(percent));
|
||||
}
|
||||
logger.debug("Update ESH-State");
|
||||
logger.debug("Update state");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -736,14 +736,14 @@ public class DeviceHandler extends BaseThingHandler implements DeviceStatusListe
|
||||
if (!channelList.isEmpty()) {
|
||||
Iterator<Channel> channelInter = channelList.iterator();
|
||||
while (channelInter.hasNext()) {
|
||||
Channel eshChannel = channelInter.next();
|
||||
if (DsChannelTypeProvider.isOutputChannel(eshChannel.getUID().getId())) {
|
||||
if (!eshChannel.getUID().getId().equals(currentChannel)
|
||||
&& !(device.isShade() && eshChannel.getUID().getId().equals(DsChannelTypeProvider.SHADE))) {
|
||||
Channel channel = channelInter.next();
|
||||
if (DsChannelTypeProvider.isOutputChannel(channel.getUID().getId())) {
|
||||
if (!channel.getUID().getId().equals(currentChannel)
|
||||
&& !(device.isShade() && channel.getUID().getId().equals(DsChannelTypeProvider.SHADE))) {
|
||||
channelInter.remove();
|
||||
channelListChanged = true;
|
||||
} else {
|
||||
if (!eshChannel.getUID().getId().equals(DsChannelTypeProvider.SHADE)) {
|
||||
if (!channel.getUID().getId().equals(DsChannelTypeProvider.SHADE)) {
|
||||
channelIsAlreadyLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public enum EventResponseEnum {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true, if the given property exists at the ESH event properties, otherwise false.
|
||||
* Returns true, if the given property exists at the event properties, otherwise false.
|
||||
*
|
||||
* @param property to check
|
||||
* @return contains property (true = yes | false = no)
|
||||
|
||||
@@ -277,35 +277,35 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
|
||||
while (!currentDeviceList.isEmpty()) {
|
||||
Device currentDevice = currentDeviceList.remove(0);
|
||||
DSID currentDeviceDSID = currentDevice.getDSID();
|
||||
Device eshDevice = tempDeviceMap.remove(currentDeviceDSID);
|
||||
Device device = tempDeviceMap.remove(currentDeviceDSID);
|
||||
|
||||
if (eshDevice != null) {
|
||||
checkDeviceConfig(currentDevice, eshDevice);
|
||||
if (device != null) {
|
||||
checkDeviceConfig(currentDevice, device);
|
||||
|
||||
if (eshDevice.isPresent()) {
|
||||
if (device.isPresent()) {
|
||||
// check device state updates
|
||||
while (!eshDevice.isDeviceUpToDate()) {
|
||||
DeviceStateUpdate deviceStateUpdate = eshDevice.getNextDeviceUpdateState();
|
||||
while (!device.isDeviceUpToDate()) {
|
||||
DeviceStateUpdate deviceStateUpdate = device.getNextDeviceUpdateState();
|
||||
if (deviceStateUpdate != null) {
|
||||
switch (deviceStateUpdate.getType()) {
|
||||
case DeviceStateUpdate.OUTPUT:
|
||||
case DeviceStateUpdate.SLAT_ANGLE_INCREASE:
|
||||
case DeviceStateUpdate.SLAT_ANGLE_DECREASE:
|
||||
filterCommand(deviceStateUpdate, eshDevice);
|
||||
filterCommand(deviceStateUpdate, device);
|
||||
break;
|
||||
case DeviceStateUpdate.UPDATE_SCENE_CONFIG:
|
||||
case DeviceStateUpdate.UPDATE_SCENE_OUTPUT:
|
||||
updateSceneData(eshDevice, deviceStateUpdate);
|
||||
updateSceneData(device, deviceStateUpdate);
|
||||
break;
|
||||
case DeviceStateUpdate.UPDATE_OUTPUT_VALUE:
|
||||
if (deviceStateUpdate.getValueAsInteger() > -1) {
|
||||
readOutputValue(eshDevice);
|
||||
readOutputValue(device);
|
||||
} else {
|
||||
removeSensorJob(eshDevice, deviceStateUpdate);
|
||||
removeSensorJob(device, deviceStateUpdate);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sendComandsToDSS(eshDevice, deviceStateUpdate);
|
||||
sendComandsToDSS(device, deviceStateUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -475,32 +475,32 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeSensorJob(Device eshDevice, DeviceStateUpdate deviceStateUpdate) {
|
||||
private void removeSensorJob(Device device, DeviceStateUpdate deviceStateUpdate) {
|
||||
switch (deviceStateUpdate.getType()) {
|
||||
case DeviceStateUpdate.UPDATE_SCENE_CONFIG:
|
||||
if (sceneJobExecutor != null) {
|
||||
sceneJobExecutor.removeSensorJob(eshDevice,
|
||||
SceneConfigReadingJob.getID(eshDevice, deviceStateUpdate.getSceneId()));
|
||||
sceneJobExecutor.removeSensorJob(device,
|
||||
SceneConfigReadingJob.getID(device, deviceStateUpdate.getSceneId()));
|
||||
}
|
||||
break;
|
||||
case DeviceStateUpdate.UPDATE_SCENE_OUTPUT:
|
||||
if (sceneJobExecutor != null) {
|
||||
sceneJobExecutor.removeSensorJob(eshDevice,
|
||||
SceneOutputValueReadingJob.getID(eshDevice, deviceStateUpdate.getSceneId()));
|
||||
sceneJobExecutor.removeSensorJob(device,
|
||||
SceneOutputValueReadingJob.getID(device, deviceStateUpdate.getSceneId()));
|
||||
}
|
||||
break;
|
||||
case DeviceStateUpdate.UPDATE_OUTPUT_VALUE:
|
||||
if (sensorJobExecutor != null) {
|
||||
sensorJobExecutor.removeSensorJob(eshDevice, DeviceOutputValueSensorJob.getID(eshDevice));
|
||||
sensorJobExecutor.removeSensorJob(device, DeviceOutputValueSensorJob.getID(device));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (deviceStateUpdate.isSensorUpdateType()) {
|
||||
if (sensorJobExecutor != null) {
|
||||
logger.debug("remove SensorJob with ID: {}",
|
||||
DeviceConsumptionSensorJob.getID(eshDevice, deviceStateUpdate.getTypeAsSensorEnum()));
|
||||
sensorJobExecutor.removeSensorJob(eshDevice,
|
||||
DeviceConsumptionSensorJob.getID(eshDevice, deviceStateUpdate.getTypeAsSensorEnum()));
|
||||
DeviceConsumptionSensorJob.getID(device, deviceStateUpdate.getTypeAsSensorEnum()));
|
||||
sensorJobExecutor.removeSensorJob(device,
|
||||
DeviceConsumptionSensorJob.getID(device, deviceStateUpdate.getTypeAsSensorEnum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -751,35 +751,35 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
|
||||
* Updates the {@link Device} status of the given {@link Device} with handling outstanding commands, which are saved
|
||||
* as {@link DeviceStateUpdate}'s.
|
||||
*
|
||||
* @param eshDevice to update
|
||||
* @param device to update
|
||||
*/
|
||||
public synchronized void updateDevice(Device eshDevice) {
|
||||
public synchronized void updateDevice(Device device) {
|
||||
logger.debug("Check device updates");
|
||||
// check device state updates
|
||||
while (!eshDevice.isDeviceUpToDate()) {
|
||||
DeviceStateUpdate deviceStateUpdate = eshDevice.getNextDeviceUpdateState();
|
||||
while (!device.isDeviceUpToDate()) {
|
||||
DeviceStateUpdate deviceStateUpdate = device.getNextDeviceUpdateState();
|
||||
if (deviceStateUpdate != null) {
|
||||
if (deviceStateUpdate.getType() != DeviceStateUpdate.OUTPUT) {
|
||||
if (deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_CONFIG
|
||||
|| deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_OUTPUT) {
|
||||
updateSceneData(eshDevice, deviceStateUpdate);
|
||||
updateSceneData(device, deviceStateUpdate);
|
||||
} else {
|
||||
sendComandsToDSS(eshDevice, deviceStateUpdate);
|
||||
sendComandsToDSS(device, deviceStateUpdate);
|
||||
}
|
||||
} else {
|
||||
DeviceStateUpdate nextDeviceStateUpdate = eshDevice.getNextDeviceUpdateState();
|
||||
DeviceStateUpdate nextDeviceStateUpdate = device.getNextDeviceUpdateState();
|
||||
while (nextDeviceStateUpdate != null
|
||||
&& nextDeviceStateUpdate.getType() == DeviceStateUpdate.OUTPUT) {
|
||||
deviceStateUpdate = nextDeviceStateUpdate;
|
||||
nextDeviceStateUpdate = eshDevice.getNextDeviceUpdateState();
|
||||
nextDeviceStateUpdate = device.getNextDeviceUpdateState();
|
||||
}
|
||||
sendComandsToDSS(eshDevice, deviceStateUpdate);
|
||||
sendComandsToDSS(device, deviceStateUpdate);
|
||||
if (nextDeviceStateUpdate != null) {
|
||||
if (deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_CONFIG
|
||||
|| deviceStateUpdate.getType() == DeviceStateUpdate.UPDATE_SCENE_OUTPUT) {
|
||||
updateSceneData(eshDevice, deviceStateUpdate);
|
||||
updateSceneData(device, deviceStateUpdate);
|
||||
} else {
|
||||
sendComandsToDSS(eshDevice, deviceStateUpdate);
|
||||
sendComandsToDSS(device, deviceStateUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user