Skip to content

Commit

Permalink
Merge pull request smarthomeNG#929 from laraveluser/develop
Browse files Browse the repository at this point in the history
AVM: Bugfix get_calllist and get_contact_name_by_phone_number
  • Loading branch information
psilo909 authored Apr 2, 2024
2 parents 89c622b + bb0f8c4 commit dd31035
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions avm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,11 @@ def set_call_origin(self, phone_name: str):
return self.fritz_device.set_call_origin(phone_name)

@NoAttributeError
def get_calllist(self):
return self.fritz_device.get_calllist_from_cache()
def get_calllist(self, filter_incoming: str = ''):
if filter_incoming :
return self.fritz_device.get_calllist(filter_incoming)
else :
return self.fritz_device.get_calllist_from_cache()

@NoAttributeError
def get_phone_name(self, index: int = 1):
Expand All @@ -607,7 +610,7 @@ def get_phone_numbers_by_name(self, name: str = '', phonebook_id: int = 0):

@NoAttributeError
def get_contact_name_by_phone_number(self, phone_number: str = '', phonebook_id: int = 0):
return self.fritz_device.get_phone_numbers_by_name(phone_number, phonebook_id)
return self.fritz_device.get_contact_name_by_phone_number(phone_number, phonebook_id)

@NoAttributeError
def get_device_log_from_lua(self):
Expand Down Expand Up @@ -1381,7 +1384,7 @@ def get_contact_name_by_phone_number(self, phone_number: str = '', phonebook_id:
# phonebook_url = self.client.InternetGatewayDevice.X_AVM_DE_OnTel.GetPhonebook(NewPhonebookID=phonebook_id)['NewPhonebookURL']
phonebook_url = to_str(self._poll_fritz_device('phonebook_url', phonebook_id, enforce_read=True))
if not phonebook_url:
return ''
return phone_number

phonebooks = request_response_to_xml(self._request(phonebook_url, self._timeout, self.verify))
if phonebooks:
Expand All @@ -1395,7 +1398,7 @@ def get_contact_name_by_phone_number(self, phone_number: str = '', phonebook_id:
else:
self.logger.error("Phonebook not available on the FritzDevice")

return ''
return phone_number

def get_phone_numbers_by_name(self, name: str = '', phonebook_id: int = 0) -> dict:
"""Get phone number from phone book by contact"""
Expand Down

0 comments on commit dd31035

Please sign in to comment.