Danielhiversen / PyXiaomiGateway

PyXiaomiGateway
MIT License
153 stars 55 forks source link

Binary sensors will be detected twice #136

Open HeavyKid opened 5 years ago

HeavyKid commented 5 years ago

Hi everyone, i don't realy know if it's a bug or a feature. I use two xiaomi gateways and 15 window sensors. 11 of them was paired to first gateway the another 4 to the second. The issue i had was, that my home assistant raises an exception: "Entity id already exists: ... Platform xiaomi_aqara does not generate unique IDs". This Exception raised only for 4 sensors on second gateway. I tried to use PyXiaomiGateway Library directly from my own python script and found out, that the first gateway returns a list of all sensors i have. It doesn't matter that this was paired only with second gateway. By the way the second gateway returns only a list of four sensors paired with them, so 4 sonsors were detected twice. Is this an issue or i do something wrong? Now i paired all of sensors only with first gateway and it works as expected, except that after some time the sensor is marked as unavaliable, but this is an another issue. After the sensor will be triggered it comes back. Best regards.

syssi commented 5 years ago

Just an idea/workaround: You could buy an Xiaomi Plug. It acts as repeater and should solve coverage issues. I cannot answer your question because I don't know the intended behaviour. Did you forget to unpair the 4 sensors beforehand? You could use the unregister service to remove the device from the list of your first gateway.

HeavyKid commented 5 years ago

Did you forget to unpair the 4 sensors beforehand?

No, from beginning 11 sensors was paired to gateway 1 and 4 to gateway 2. Now i unpaired 4 sensors from gateway 2 and paired to gateway 1. It solves the issue for me now.

My idea was to "extend the range" by using second gateway. I thought it will be better than to use just a plug as a repeater, because of additional functionality of gateway like light, light sensor and speaker, but I did not think there would be problems with the library. I guess it's not the big problem to filter the list in the library for a double entries. My problem is that i don't know if this behaviour expected by xiaomi guys or not. The question from beginning: "Is this a bug or a feature?" Does it exists some kind of documentation for that?

I think my solution will be to buy the plug for extend the range and to use the second gateway just as light, speaker and lightsensor.