Remove monitored conditions from RainMachine#31066
Conversation
This reverts commit 84fcf51.
b791f59 to
fe127f4
Compare
|
|
||
| tasks = {} | ||
|
|
||
| if TYPE_FLOW_SENSOR in self.binary_sensor_conditions or any( |
There was a problem hiding this comment.
So now you're fetching all data. One more improvement that you can do in a future PR is that each entity will let the data class know what data it is interested in. That way if all entities of a certain type are disabled, you will no longer fetch the data.
There was a problem hiding this comment.
This is how I've done it for Ring: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/ring/__init__.py#L173-L235
There was a problem hiding this comment.
How do you listen for the entity being enabled or disabled?
There was a problem hiding this comment.
async_added_to_hass and async_will_remove_from_hass?
There was a problem hiding this comment.
Yeah, use the lifecycle methods to opt-in for data. If data is not being fetched yet, that's when you start fetching that data. In your case you could just track sensor types and count how many need them. Ring has a variant on that too: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/ring/__init__.py#L238
Breaking change
It is no longer possible to specify monitored conditions within the RainMachine integration; all entities are added by default.
Additionally, the
zone_run_timeparameter is now configured directly within the controller withinconfiguration.yaml.Proposed change
Per ADR 0003, this PR removes the concept of monitored conditions from RainMachine. All entity types are added by default. The integration uses more than one local API call, but since the created entities all connect together, I didn't see a problem automatically including everything.
This PR also includes a config entry migration to clean up monitored conditions data as necessary.
Type of change
Example entry for
configuration.yaml: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:
python3 -m script.hassfest.requirements_all.txtby runningpython3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale: