mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Updated Hue description response emulation. Updated the management of
devices in the map. Updated logging information to be less in normal mode.
This commit is contained in:
@@ -43,7 +43,7 @@ public class DeviceRepository {
|
||||
DeviceDescriptor theDevice = null;
|
||||
while (theIterator.hasNext()) {
|
||||
theDevice = theIterator.next();
|
||||
put(Integer.parseInt(theDevice.getId()), theDevice);
|
||||
put(theDevice.getId(), theDevice);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,17 +62,16 @@ public class DeviceRepository {
|
||||
return devices.get(id);
|
||||
}
|
||||
|
||||
private void put(int id, DeviceDescriptor aDescriptor) {
|
||||
devices.put(String.valueOf(id), aDescriptor);
|
||||
private void put(String id, DeviceDescriptor aDescriptor) {
|
||||
devices.put(id, aDescriptor);
|
||||
}
|
||||
|
||||
public void save(DeviceDescriptor aDescriptor) {
|
||||
int id = random.nextInt(Integer.MAX_VALUE);
|
||||
if(aDescriptor.getId() != null)
|
||||
devices.remove(aDescriptor.getId());
|
||||
else
|
||||
aDescriptor.setId(String.valueOf(id));
|
||||
put(id, aDescriptor);
|
||||
aDescriptor.setId(String.valueOf(random.nextInt(Integer.MAX_VALUE)));
|
||||
put(aDescriptor.getId(), aDescriptor);
|
||||
JsonTransformer aRenderer = new JsonTransformer();
|
||||
String jsonValue = aRenderer.render(findAll());
|
||||
repositoryWriter(jsonValue, repositoryPath);
|
||||
|
||||
Reference in New Issue
Block a user