-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Add multi phone numbers support #6605
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
Conversation
It works great with a single instance of the component. When I add multiple Fido sensors, initially some of the accounts give this error: After some time, all accounts do get updated though. |
@tanilolli do you have this sometimes or only at startup ? |
@titilambert Only at startup |
@tanilolli EVERYTIME your start HA ? (Is it reproducible ?) |
@titilambert Yes, everytime. It seems the issue is Fido doesn't like the requests being made so fast. |
@tanilolli yes I guess,... So I don't know what to do for that :( |
@balloob Can we share some data/object between to instance of the same component ? |
@titilambert Maybe the component could load all the data for the account and create it's own sensors. sensor.fido could display general account details like balance |
@tanilolli good idea, I will try it tomorrow |
Ping, any updates? |
Sorry, my "tomorrow" is really long :/ |
Ready for review ! |
if self._number in self.fido_data.data and \ | ||
self.type in self.fido_data.data[self._number]: | ||
if self.fido_data.data[self._number][self.type] is not None: | ||
self._state = round(self.fido_data.data[self._number][self.type], 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (88 > 79 characters)
self._state = round(self.fido_data.data[self.type], 2) | ||
else: | ||
if self.fido_data.data.get(self._number, {}).get(self.type) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (84 > 79 characters)
Thanks for the update! It's working great with all 3 numbers in my account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small code style
self._state = round(self.fido_data.data[self.type], 2) | ||
if self._name == 'balance': | ||
if self.type in self.fido_data.data: | ||
if self.fido_data.data[self.type] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can only use if self.fido_data.data.get(self.type):
that replace this two lines.
else: | ||
if self._number in self.fido_data.data and \ | ||
self.type in self.fido_data.data[self._number]: | ||
if self.fido_data.data[self._number][self.type] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
self._state = round(self.fido_data.data[self.type], 2) | ||
else: | ||
if self._number in self.fido_data.data and \ | ||
self.fido_data.data[self._number].get(self.type) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line with same indent as next logical line
Fixed ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave a comment
Description:
As @tanilolli requested (here #5997), this PR add the multi phone number support.
Please don't merge this PR. I'm waiting for @tanilolli confirmation for cleaning.
@tanilolli Could you confirm that this patch is working for you ?
Related issue (if applicable): fixes #5997
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2256
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.