Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in removeDevice method #175

Open
yanivps opened this issue Apr 2, 2021 · 0 comments
Open

Bug in removeDevice method #175

yanivps opened this issue Apr 2, 2021 · 0 comments

Comments

@yanivps
Copy link

yanivps commented Apr 2, 2021

Hello
If I'm not wrong, there is a bug in the removeDevice method.

The way device IDs work is that they are merely indices in the vector
The problem with this is that if I have 4 devices and I remove device num #2, device #3 then becomes the original device #4
Example:

byte devId1 = fauxmo.addDevice("Device 1");
byte devId2 = fauxmo.addDevice("Device 2");
byte devId3 = fauxmo.addDevice("Device 3");
byte devId4 = fauxmo.addDevice("Device 4");
char buff[50];
fauxmo.getDeviceName(devId3, buff, sizeof(buff));
Serial.println(buff); // prints "Device 3"
fauxmo.removeDevice(devId2);
fauxmo.getDeviceName(devId3, buff, sizeof(buff));
Serial.println(buff); // prints "Device 4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant