-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Guard against missing data in 1st generation RainMachine controllers #72632
Conversation
@@ -158,17 +158,17 @@ class CurrentRestrictionsBinarySensor(RainMachineEntity, BinarySensorEntity): | |||
def update_from_latest_data(self) -> None: | |||
"""Update the state.""" | |||
if self.entity_description.key == TYPE_FREEZE: | |||
self._attr_is_on = self.coordinator.data["freeze"] | |||
self._attr_is_on = self.coordinator.data.get("freeze") |
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.
Is it possible that you don't even offer these entities if the data is not provided ?
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.
Definitely. The only challenge is that I would now have to go back and remove orphaned entities for people with 1st generation controllers (since previous versions of the integration will have put them there). Is adding that to this PR too much for beta?
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.
Yeah, let's do that for next release.
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.
If a device says unavailable because it's orphaned or unknown because the attr_is_on is None, that's not too much different annoying :)
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.
Adding to my todo list for next release. Thank you!
Proposed change
RainMachine was assuming the presence of several data points that may not exist in 1st generation controllers. This PR updates things to look for missing data and output accordingly.
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: