Delivery site selection in config flow#108
Open
berendhaan wants to merge 7 commits intobajansen:mainfrom
Open
Conversation
Provide an extra step in the config_flow if there are more than one delivery sites
HiDiHo01
suggested changes
Jun 13, 2024
Contributor
There was a problem hiding this comment.
number_of_sites = len(me.deliverySites)
if number_of_sites == 1:
# for backward compatibility (do nothing)
# Check if entry with CONF_USERNAME exists, then abort
if CONF_USERNAME in user_input:
await self.async_set_unique_id(user_input[CONF_USERNAME])
self._abort_if_unique_id_configured()
# Create entry with unique_id as me.deliverySites[0].reference
first_site = me.deliverySites[0]
self.sign_in_data[CONF_SITE] = first_site.reference
self.sign_in_data[CONF_USERNAME] = self.create_title(first_site)
return await self._async_create_entry(self.sign_in_data)
Author
I'm missing the reference where you want this part of the code, is it in config_flow.py? |
Author
|
I'm having some issues with the dependencies, propbaly because some components got updated on the way. Updating some deps resolves some issues localy, running in python 3.12, I see that in What do you think is best, fixing all this stuff in this PR, or first create a PR to bump deps? |
Contributor
|
Yes this is a edit to have site selection so old config would continue as
normal. This should go under deliverysite == 0
Op do 13 jun 2024 19:15 schreef Berend Haan ***@***.***>:
… number_of_sites = len(me.deliverySites)
if number_of_sites == 1:
# for backward compatibility (do nothing)
# Check if entry with CONF_USERNAME exists, then abort
if CONF_USERNAME in user_input:
await self.async_set_unique_id(user_input[CONF_USERNAME])
self._abort_if_unique_id_configured()
# Create entry with unique_id as me.deliverySites[0].reference
first_site = me.deliverySites[0]
self.sign_in_data[CONF_SITE] = first_site.reference
self.sign_in_data[CONF_USERNAME] = self.create_title(first_site)
return await self._async_create_entry(self.sign_in_data)
I'm missing the reference where you want this part of the code, is it in
config_flow.py?
I'll take a look in fixing all the linting issues aswell
—
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXDM263I4SPNL3OLSZ2AFF3ZHHHUXAVCNFSM6AAAAABGXOTSMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRWGM3DKMRTG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Contributor
|
Yes the depends should be updated
Op do 13 jun 2024 19:37 schreef Berend Haan ***@***.***>:
… I'm having some issues with the dependencies, propbaly because some
components got updated on the way.
Updating some deps resolves some issues localy, running in python 3.12, I
see that in ci.yaml python 3.10 is still used.
What do you think is best, fixing all this stuff in this PR, or first
create a PR to bump deps?
—
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXDM265LNGQOUZKOYC53US3ZHHKG3AVCNFSM6AAAAABGXOTSMOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRWGQYTGOBUGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Contributor
|
I was thinking.....should we do only sites in delivery or all sites including closed sites? |
Author
Yeah, I think that makes sense in a SmartHome context. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR adds an extra step to the config flow which the user can select his current site, if he has multiple. Related to #104
The code still needs some little clean-up, title is not set correctly atm and the step could be skipped if there is only one delivery site active.