-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
Adjust HomeWizard to use updated python-homewizard-energy library #135046
Adjust HomeWizard to use updated python-homewizard-energy library #135046
Conversation
"gas_unique_id", | ||
"id", | ||
"serial", | ||
"wifi_ssid", | ||
"unique_meter_id", | ||
"unique_id", | ||
"gas_unique_id", | ||
"unique_meter_id", | ||
"wifi_ssid", |
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.
Added 'id' and ordered alphabetically
self.config_entry.title, | ||
ex, | ||
) | ||
data = await self.api.combined() |
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.
"Supported checks" are now handled by the library
@@ -6,7 +6,6 @@ | |||
from homeassistant.const import PERCENTAGE, EntityCategory | |||
from homeassistant.core import HomeAssistant | |||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | |||
from homeassistant.util.color import brightness_to_value, value_to_brightness |
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.
0...255 mapping to percentage is now handled by library
available_fn=lambda data: data.state is not None and not data.state.switch_lock, | ||
is_on_fn=lambda data: data.state.power_on if data.state else None, | ||
set_fn=lambda api, active: api.state_set(power_on=active), | ||
create_fn=lambda x: x.device.supports_state(), |
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.
Library now handles 'supports_*' checks
|
||
data.system = await self.api.system() | ||
|
||
except UnsupportedError as ex: |
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.
Supported/unsupported mismatches are handled by the library
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
…assistant-core into bumb-homewizard-energy-8.0.0
Proposed change
This is a big one, and I am fully open to get tips to reduce the TL;DR level.
This PR implements the updated
python-homewizard-energy
, which makes it easier to move to the v2 API (docs). The only goal of this PR is to get the component work with the libary as if nothing has been changed. New features and actual v2 support will be added in future PR's.The previous PR related to this was #131366, which renamed
HomeWizardEnergy
toHomeWizardEnergyV1
. I then started to implementHomeWizardEnergyV2
but everything in this component went from easy to understand code to many "if v1 then this else that" trees.Therefore the library has been adjusted to do all this instead HA. After initialisation everything should work the same.
Models and naming conventions are moved to v2, as all HomeWizard devices will be moved to v2 eventually.
The update itself:
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: