-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Add OSO Energy integration #70365
Add OSO Energy integration #70365
Conversation
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.
Here are some comments to get the review started 👍
@osohotwateriot Im planning to buy OSO Charge and this integration is very interesting. Do you plan to still work on change requests in this PR? Thanks for the effort including it in the core! |
ad6ad62
to
d74babc
Compare
d74babc
to
1d5ba58
Compare
Is this PR ready to be merged or are there any review comments left to be fixed? Im eager to get my water heater included in HA with this integration. |
All comments have been reviewed and fixed - code is pushed. @ludeeus can you verify if there is something else needed for the PR in order to proceed with the approval? |
@ludeeus any chance you will get time to review and merge this PR before the holidays kicks in? |
Any reason for not merging? |
Co-authored-by: Robert Resch <robert@resch.dev>
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.
Looks good, thanks @osohotwateriot 👍
Congrats to the first PR 🎉
Changing the name of the TypeVar
can be done in a follow-up PR.
_T = TypeVar( | ||
"_T", OSOEnergyBinarySensorData, OSOEnergySensorData, OSOEnergyWaterHeaterData | ||
) |
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.
Let's give this TypeVar
a better name, maybe:
_T = TypeVar( | |
"_T", OSOEnergyBinarySensorData, OSOEnergySensorData, OSOEnergyWaterHeaterData | |
) | |
_OSOEnergyT = TypeVar( | |
"_T", OSOEnergyBinarySensorData, OSOEnergySensorData, OSOEnergyWaterHeaterData | |
) |
return unload_ok | ||
|
||
|
||
class OSOEnergyEntity(Entity, Generic[_T]): |
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.
class OSOEnergyEntity(Entity, Generic[_T]): | |
class OSOEnergyEntity(Entity, Generic[_OSOEnergyT]): |
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.
Please address the comments in a new PR. Thanks!
|
||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Unload a config entry.""" | ||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) |
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.
This will error if the platform wasn't setup.
"""Handle a OSO Energy config flow.""" | ||
|
||
VERSION = 1 | ||
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL |
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.
This is legacy. It's set in the manifest.json nowadays.
"""Re Authenticate a user.""" | ||
self.entry = self.hass.config_entries.async_get_entry(self.context["entry_id"]) | ||
data = {CONF_API_KEY: user_input[CONF_API_KEY]} | ||
return await self.async_step_user(data) |
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.
We shouldn't pass the old config entry data as input to the user step. Then we'll try to authenticate again with the old data when we know it's already invalid.
} | ||
}, | ||
"error": { | ||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", |
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.
cannot_connect string isn't used.
"error": { | ||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", | ||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", | ||
"unknown": "[%key:common::config_flow::error::unknown%]" |
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.
unknown string isn't used.
"title": "OSO Energy Auth", | ||
"description": "Generate and enter a new 'Subscription Key' for your account at 'https://portal.osoenergy.no/'.", | ||
"data": { | ||
"api_key": "[%key:common::config_flow::data::api_key%]" |
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.
There's no form for the reauth step.
Breaking change
Proposed change
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: