Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
DnomaidGit committed Mar 30, 2021
1 parent 2084dbd commit db9ab20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion iot/src/main/java/com/dnomaid/iot/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void run() {
// System.out.println("SensorTemp5: "+Devices.getInst().getSensors().get(2).getTopics().get(0).getValueTopic(TypeTopic.Temperature));
// System.out.println("SensorHum6: "+Devices.getInst().getSensors().get(2).getTopics().get(0).getValueTopic(TypeTopic.Humidity));
// System.out.println("SensorTemp7: "+Devices.getInst().getSensors().get(3).getTopics().get(0).getValueTopic(TypeTopic.Temperature));
// Devices.getInst().deleteDevice(new DeviceConfig(TypeDevice.SonoffS20, "3"));
Devices.getInst().deleteDevice(new DeviceConfig(TypeDevice.SonoffS20, "3"));

} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Expand Down
2 changes: 1 addition & 1 deletion iot/src/main/java/com/dnomaid/iot/mqtt/device/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private String setNameDevice(TypeDevice device, String NumberDevice) {

@Override
public String toString() {
return Device.name();
return NameDevice;
}

}
20 changes: 2 additions & 18 deletions iot/src/main/java/com/dnomaid/iot/mqtt/device/Devices.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,13 @@ public void newDevice(TypeDevice typeDevice, String numberDevice){
DevicesConfig.add(new DeviceConfig(typeDevice, numberDevice));
selectDevice(typeDevice, numberDevice);
}
public void deleteDevice(DeviceConfig deviceConfig){
public void deleteDevice(DeviceConfig deviceConfig){
IntStream.range(0, (getDevices().size()-1))
.forEach(index -> {
if (deviceConfig.toString().equals(getDevices().get(index).toString())){
System.out.println("Borrar.......... index: "+index);
getDevices().remove(index);
}
});
IntStream.range(0, (getRelays().size()-1))
.forEach(index -> {
if (deviceConfig.toString().equals(getRelays().get(index).toString())){
System.out.println("Borrar.......... index: "+index);
getRelays().remove(index);
}
});
IntStream.range(0, (getSensorsClimate().size()-1))
.forEach(index -> {
if (deviceConfig.toString().equals(getSensorsClimate().get(index).toString())){
System.out.println("Borrar.......... index: "+index);
getSensorsClimate().remove(index);
}
});

});
}

public ArrayList<DeviceConfig> getDevicesConfig() {return DevicesConfig;}
Expand Down

0 comments on commit db9ab20

Please sign in to comment.