python-ring-doorbell icon indicating copy to clipboard operation
python-ring-doorbell copied to clipboard

bad compability with multiple doorbells

Open nuketownhf opened this issue 6 years ago • 3 comments

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

nuketownhf avatar Oct 18 '19 08:10 nuketownhf

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 avatar Oct 21 '19 14:10 nuketownhf

@nuketownhf can you send a PR with your solution please?

tchellomello avatar Jan 03 '20 14:01 tchellomello

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.

nuketownhf avatar Jan 20 '20 09:01 nuketownhf

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.

github-actions[bot] avatar Apr 18 '24 18:04 github-actions[bot]