-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
Deprecate sensors in Habitica integration #134036
base: dev
Are you sure you want to change the base?
Conversation
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
fdf2749
to
b246f0c
Compare
b246f0c
to
312adc3
Compare
assert entity_entry | ||
if entity_entry.disabled: | ||
ent_reg.async_remove(entity_id) | ||
async_delete_issue( |
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.
Seem to miss testing this
) | ||
else: | ||
entities.append(HabiticaTaskSensor(coordinator, description)) | ||
if description.key in ( |
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.
Maybe we can combine these with the ones below and put the breaking version in the description and use it as a variable?
assert entity_entry | ||
if entity_entry.disabled: | ||
ent_reg.async_remove(entity_id) | ||
async_delete_issue( |
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.
Seems to miss testing
description: SensorEntityDescription | ||
for description in SENSOR_DESCRIPTIONS: | ||
if description.key is HabiticaSensorEntity.HEALTH_MAX: | ||
if entity_id := ent_reg.async_get_entity_id( |
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.
Maybe this whole code-block could go into a separate function and call the function. Then we can make the code even more dry by combining it with the task sensors also below.
async def async_added_to_hass(self) -> None: | ||
"""Raise issue when entity is registered and was not disabled.""" | ||
if TYPE_CHECKING: | ||
assert self.unique_id | ||
|
||
await super().async_added_to_hass() | ||
|
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.
async def async_added_to_hass(self) -> None: | |
"""Raise issue when entity is registered and was not disabled.""" | |
if TYPE_CHECKING: | |
assert self.unique_id | |
await super().async_added_to_hass() |
@@ -407,6 +407,10 @@ | |||
"title": "The Habitica {task_name} sensor is deprecated", | |||
"description": "The Habitica entity `{entity}` is deprecated and will be removed in a future release.\nPlease update your automations and scripts to replace the sensor entity with the newly added todo entity.\nWhen you are done migrating you can disable `{entity}`." | |||
}, | |||
"deprecated_entity": { |
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.
Combine with deprecated_task_entity
?
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.
This PR will remove the code for the already deprecated sensors, so i think i should wait before continuing.
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.
Can now be rebased as it has been merged
Breaking change
Breaking change in the future
Proposed change
Deprecates 3 sensors:
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: