Skip to content

Add unique ids to sensors#71367

Merged
balloob merged 1 commit intohome-assistant:devfrom
shaiu:sabnzbd_sensor_unique
May 5, 2022
Merged

Add unique ids to sensors#71367
balloob merged 1 commit intohome-assistant:devfrom
shaiu:sabnzbd_sensor_unique

Conversation

@shaiu
Copy link
Copy Markdown
Contributor

@shaiu shaiu commented May 5, 2022

  1. add unique id to sensors
  2. add a service info

Proposed change

Added unique ids to sensors so the integration will show the entities.
Also added a service info section

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

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][dev-checklist]
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

The integration reached or maintains the following [Integration Quality Scale][quality-scale]:

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

To help with the load of incoming pull requests:

2. add a service info
Copy link
Copy Markdown
Contributor

@0bmay 0bmay left a comment

Choose a reason for hiding this comment

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

code changes do what was explained in the code commits.

@thecode thecode added this to the 2022.5.1 milestone May 5, 2022
@balloob balloob merged commit afe4892 into home-assistant:dev May 5, 2022
balloob pushed a commit that referenced this pull request May 5, 2022
@balloob balloob mentioned this pull request May 5, 2022
Copy link
Copy Markdown
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.

Please address the comments in a new PR. Thanks!

self, sabnzbd_api_data, client_name, description: SabnzbdSensorEntityDescription
):
"""Initialize the sensor."""
unique_id = description.key
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only the key is not unique enough if more than one config entry is setup. We could prefix with the config entry entry_id if there's no better unique_id.

https://developers.home-assistant.io/docs/entity_registry_index#unique-id-requirements

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@MartinHjelmare
Copy link
Copy Markdown
Member

We should probably not have included this in a patch release. It's a new feature and now we'll need a migration when fixing the incorrect unique_id.

@shaiu
Copy link
Copy Markdown
Contributor Author

shaiu commented May 6, 2022

Please address the comments in a new PR. Thanks!

@MartinHjelmare #71455

@shaiu shaiu deleted the sabnzbd_sensor_unique branch May 6, 2022 22:00
@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2022
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.

SABnzbd sensors not linked to the integration

6 participants