Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Optimize 3#839
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Optimize 3 #839
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8bdae45
Replace xml attrib[] by get()
bouwew 02aca5f
Optimize _get_groups(), fix group_id
bouwew a73ff8e
Clean up
bouwew ae27f8d
Update CHANGELOG
bouwew e584329
Improve error-handling as suggested
bouwew 9ea62f3
Correct missing rule_id assignment
bouwew 1f956c7
Add extra guarding for group_id, remove unneeded guard in check_heate…
bouwew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -82,9 +82,7 @@ def get_all_gateway_entities(self) -> None: | ||
| Finally, collect the data and states for each entity. | ||
| """ | ||
| self._all_appliances() | ||
| if group_data := self._get_groups(): | ||
| self.gw_entities.update(group_data) | ||
| self._get_groups() | ||
| self._all_entity_data() | ||
| async def async_update(self) -> dict[str, GwEntityData]: | ||
| @@ -154,13 +152,17 @@ async def set_offset(self, dev_id: str, offset: float) -> None: | ||
| async def set_preset(self, _: str, preset: str) -> None: | ||
| """Set the given Preset on the relevant Thermostat - from DOMAIN_OBJECTS.""" | ||
| if (presets := self._presets()) is None: | ||
| if not (presets := self._presets()): | ||
| raise PlugwiseError("Plugwise: no presets available.") # pragma: no cover | ||
| if preset not in list(presets): | ||
| raise PlugwiseError("Plugwise: invalid preset.") | ||
| locator = f'rule/directives/when/then[@icon="{preset}"].../.../...' | ||
| rule_id = self._domain_objects.find(locator).attrib["id"] | ||
| if (rule := self._domain_objects.find(locator)) is None: | ||
| raise PlugwiseError("Plugwise: no preset rule found.") # pragma: no cover | ||
| if (rule_id := rule.get("id")) is None: | ||
| raise PlugwiseError("Plugwise: no preset id found.") # pragma: no cover | ||
| data = f"<rules><rule id='{rule_id}'><active>true</active></rule></rules>" | ||
| await self.call_request(RULES, method="put", data=data) | ||
| @@ -192,7 +194,7 @@ async def set_schedule_state( | ||
| schedule_rule_id: str | None = None | ||
| for rule in self._domain_objects.findall("rule"): | ||
| if rule.find("name").text == name: | ||
| schedule_rule_id = rule.attrib["id"] | ||
| schedule_rule_id = rule.get("id") | ||
| break | ||
| if schedule_rule_id is None: | ||
| @@ -205,7 +207,7 @@ async def set_schedule_state( | ||
| new_state = "true" | ||
| locator = f'.//*[@id="{schedule_rule_id}"]/template' | ||
| template_id = self._domain_objects.find(locator).attrib["id"] | ||
| template_id = self._domain_objects.find(locator).get("id") | ||
coderabbitai[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| data = ( | ||
| "<rules>" | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.