Skip to content
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

Add entity specific force_update for DSMR #46111

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

yurnih
Copy link
Contributor

@yurnih yurnih commented Feb 6, 2021

Breaking change

Proposed change

#42086 changed the force_update property for each entity by default to True and with #43057 the interval of state updates can be modified. However, in some cases only a few properties are relevant to update every second, and for others it is fine to get updated when there is a new value. With this PR the property force_update is entity specific instead of default True for all.

This PR is in conflict when #43405 get merged.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @RobBie1221, mind taking a look at this pull request as its been labeled with an integration (dsmr) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@RobBie1221
Copy link
Contributor

Why make it customizable? Can we perhaps come up with better entity specific defaults?

@coryshack
Copy link

coryshack commented Feb 6, 2021 via email

@yurnih
Copy link
Contributor Author

yurnih commented Feb 6, 2021

Why make it customizable? Can we perhaps come up with better entity specific defaults?

I completely agree with you, having defaults specified for each entity would be much easier. But the reason I created the extra option is since I think it is hard to determine which entity should be forced pushed and which not, since this could be different for everyone using this integration.

Like a few entities only get updated a few times per day (Tarif) and others every "x"-seconds (Power).
I can think of that some want to have Tarif / Power logged into influxdb for each telegram, where others want to have it stored in the recorder for just viewing history in HA.

@RobBie1221
Copy link
Contributor

I think we should limit the number of options presented to the user. Furthermore, the approach is not very generic. If force_update would be something that a user wants to customize per entity, it should be added to customization: https://www.home-assistant.io/docs/configuration/customizing-devices/

Within the integration we should try to make a default choice taking into consideration the type of data that is represented by an entity. In my opinion, force_update makes most sense for power and energy entities, because users want to have all datapoints of those to make charts and do statistics. For the other entities, For the other entities, I don't see a use case to have updates forced.

@yurnih
Copy link
Contributor Author

yurnih commented Feb 6, 2021

That sounds fair. I'll update this PR, with just an extra label for force_update in the obis_mapping list.

@yurnih yurnih changed the title Make force_update customisable for DSMR integration Entity specific force_update for DSMR integration Feb 6, 2021
Copy link
Contributor

@RobBie1221 RobBie1221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@MartinHjelmare MartinHjelmare changed the title Entity specific force_update for DSMR integration Add entity specific force_update for DSMR Feb 8, 2021
@MartinHjelmare MartinHjelmare merged commit 2811e39 into home-assistant:dev Feb 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DSMR power_tariff state registers as a change every update
5 participants