| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Expand Up | @@ -57,7 +57,8 @@ def overloaded(self) -> bool: | |||||||||||||||
| @property | ||||||||||||||||
| def enabled(self) -> bool: | ||||||||||||||||
| """Return True if child protection is enabled.""" | ||||||||||||||||
| return self.data["get_protection_power"]["enabled"] | ||||||||||||||||
| gp = self.data["get_protection_power"] | ||||||||||||||||
| return gp.get("enabled") or gp.get("protection_enabled") | ||||||||||||||||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
Sorry, something went wrong.
All reactions
|
||||||||||||||||
|
|
||||||||||||||||
| async def set_enabled(self, enabled: bool, *, threshold: int | None = None) -> dict: | ||||||||||||||||
| """Set power protection enabled. | ||||||||||||||||
| Expand All | @@ -74,6 +75,10 @@ async def set_enabled(self, enabled: bool, *, threshold: int | None = None) -> d | |||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| params = {**self.data["get_protection_power"], "enabled": enabled} | ||||||||||||||||
| # If "enabled" is not used by the device, use "protection_enabled" | ||||||||||||||||
| if "protection_enabled" in self.data["get_protection_power"]: | ||||||||||||||||
| params["protection_enabled"] = enabled | ||||||||||||||||
| params.pop("enabled", None) | ||||||||||||||||
|
Comment thread
Comment on lines
77
to
+81
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
How about something like this?
Sorry, something went wrong.
All reactions
|
||||||||||||||||
| if threshold is not None: | ||||||||||||||||
| params["protection_power"] = threshold | ||||||||||||||||
| return await self.call("set_protection_power", params) | ||||||||||||||||
| Expand Down | ||||||||||||||||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySo this check is only done to avoid initializing energy module for the main device on P304M as it only reports this information on the child sockets. I think this was an easy solution as the main device cannot be switched on and off, but this check should to my understanding also work for your P316M.
Maybe it's just the cli that needs adjustment for devices that have individual sockets with emeter?
In any case, I would suggest that we get this PR first merged without changes to emeter & tackle that issue in a separate PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.