python-ring-doorbell
python-ring-doorbell copied to clipboard
bad compability with multiple doorbells
Hello, I want a notification system that if the bell rings than something in an if-statement happens. But the id of the specific device is always hopping to another Ring device (I have 4 of them) example:
while True:
print(myring.doorbells[3].id)
outputs: d8a98b6fcxxx 90e202938xxx d8a98b6fcxxx a810874d5xxx a810874d5xxx d8a98b6fcxxx 90e202938xxx 90e202938xxx a810874d5xxx
but i'd need that index [3] IS and STAYS the same id to fit the if-statement...
thank you
I made it to work by myself by editing line 232 (method called __devices) to
if device_type == 'doorbells':
req = self.query(url).get('doorbots')
for member in list((obj['description'] for obj in req)):
lst.append(RingDoorBell(self,member))
if len(lst) == < ENTER YOUR AMOUNT OF DOORBELLS>:
lst = sorted(lst, key=lambda x: x.id)
# get shared doorbells, however device is read-only
req = self.query(url).get('authorized_doorbots')
for member in list((obj['description'] for obj in req)):
lst.append(RingDoorBell(self, member, shared=True))
now the Doorbells get assigned the same index every time!
@nuketownhf can you send a PR with your solution please?
Hello, I can't do a PR at the moment as the versions have been changed.
You just need to sort the list of the IDs desc or asc so it will be static doorbots[0] will always be the ID 123xxxxxxx whereas doorbots[1] will always be 542xxxxxxx
at the moment I don't know how to do that with this newer version.
There hasn't been any activity on this issue recently. This issue has been automatically marked as stale because of that. It will be closed if no further activity occurs. Please make sure to update to the latest ring_doorbell version and check if that solves the issue. Thank you for your contributions.