Prevent Eve devices with newer firmware to be polled #893
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.
The server has some logic to poll custom attributes when needed, this is for example needed for the custom power/energy attributes on Eve Energy with firmware version < 3.5.
The newer Eve Energy firmware however implements the official Matter 1.3 clusters for power and energy measurements so no need to to poll these attributes anymore.
Changes should_poll in the custom cluster/attribute definitions into a method/callback that accepts the MatterNodeData as argument. That way the implementation can do some conditional checks based on node attribute/firmware version etc.
Disable polling if the node is not Eve - this catches e.g. the MatterBridge which (ab)uses the Eve custom cluster to send power measurements. There is no reason to poll those values.
Disable polling on the Eve power attributes if the node has the new ElectricalPowerMeasurement cluster.
Strictly taken this means that you need to update HA in order to use the new sensors but since the Eve firmware is not yet available this is not a real problem. I could have gone with a super dynamic client-dependent approach where the client determines what attributes should be polled but imo that is overkill for these few attributes and the fact that we're just preparing for the future here. Home Assistant 2024.9 will have the new power sensors available.