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

Fix deprecated vacuum states in vacuum entity #244

Closed
wants to merge 3 commits into from

Conversation

StefanoGiu
Copy link
Contributor

Fixing error:

2025-01-14 19:52:56.113 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_CLEANING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.CLEANING instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.128 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_DOCKED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.139 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_PAUSED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.PAUSED instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.155 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_IDLE was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.IDLE instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.168 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_RETURNING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.183 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_ERROR was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.ERROR instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.193 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_CLEANING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.CLEANING instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.205 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_DOCKED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.215 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_PAUSED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.PAUSED instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.225 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_IDLE was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.IDLE instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.238 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_RETURNING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'zcsmower' custom integration 2025-01-14 19:52:56.248 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_ERROR was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.ERROR instead, please report it to the author of the 'zcsmower' custom integration

Fixing error:

2025-01-14 19:52:56.113 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_CLEANING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.CLEANING instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.128 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_DOCKED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.139 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_PAUSED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.PAUSED instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.155 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_IDLE was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.IDLE instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.168 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_RETURNING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.183 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_ERROR was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.ERROR instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.193 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_CLEANING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.CLEANING instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.205 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_DOCKED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.215 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_PAUSED was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.PAUSED instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.225 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_IDLE was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.IDLE instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.238 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_RETURNING was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'zcsmower' custom integration
2025-01-14 19:52:56.248 WARNING (ImportExecutor_0) [homeassistant.components.vacuum] STATE_ERROR was used from zcsmower, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.ERROR instead, please report it to the author of the 'zcsmower' custom integration
Copy link
Owner

@ufozone ufozone left a comment

Choose a reason for hiding this comment

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

Good work. Thank you! I think we have wrong syntaxt and need only one line:

from homeassistant.components.vacuum import (
    ATTR_STATUS,
    StateVacuumEntity,
    StateVacuumEntityDescription,
    VacuumActivity,
    VacuumEntityFeature,
)

@ufozone ufozone added this to the v1.8 milestone Jan 14, 2025
@ufozone ufozone added the bug Something isn't working label Jan 14, 2025
@ufozone ufozone self-assigned this Jan 14, 2025
@ufozone ufozone changed the title Update vacuum.py Fix deprecated vacuum states in vacuum entity Jan 14, 2025
@StefanoGiu
Copy link
Contributor Author

I also fixed the state names... sorry but I didn't test the fix before pushing :)

With the latest PR I sent it should be ok

@@ -24,8 +19,8 @@
LOGGER,
DOMAIN,
)
from .coordinator import ZcsMowerDataUpdateCoordinator
from .entity import ZcsMowerRobotEntity
from .coordinator import ZcsDataUpdateCoordinator
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
from .coordinator import ZcsDataUpdateCoordinator
from .coordinator import ZcsMowerDataUpdateCoordinator

from .coordinator import ZcsMowerDataUpdateCoordinator
from .entity import ZcsMowerRobotEntity
from .coordinator import ZcsDataUpdateCoordinator
from .entity import ZcsMowerEntity
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
from .entity import ZcsMowerEntity
from .entity import ZcsMowerRobotEntity

@@ -37,7 +32,7 @@
| VacuumEntityFeature.START
| VacuumEntityFeature.MAP
)
ROBOT_ENTITY_DESCRIPTIONS = (
ENTITY_DESCRIPTIONS = (
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
ENTITY_DESCRIPTIONS = (
ROBOT_ENTITY_DESCRIPTIONS = (

@@ -55,21 +50,21 @@ async def async_setup_entry(
coordinator = config_entry.runtime_data
async_add_entities(
[
ZcsMowerRobotVacuumEntity(
ZcsMowerVacuumEntity(
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
ZcsMowerVacuumEntity(
ZcsMowerRobotVacuumEntity(

hass=hass,
config_entry=config_entry,
coordinator=coordinator,
entity_description=entity_description,
imei=imei,
)
for imei in coordinator.mowers
for entity_description in ROBOT_ENTITY_DESCRIPTIONS
for entity_description in ENTITY_DESCRIPTIONS
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
for entity_description in ENTITY_DESCRIPTIONS
for entity_description in ROBOT_ENTITY_DESCRIPTIONS

],
update_before_add=True,
)


class ZcsMowerRobotVacuumEntity(ZcsMowerRobotEntity, StateVacuumEntity):
class ZcsMowerVacuumEntity(ZcsMowerEntity, StateVacuumEntity):
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
class ZcsMowerVacuumEntity(ZcsMowerEntity, StateVacuumEntity):
ZcsMowerRobotVacuumEntity(ZcsMowerRobotEntity, StateVacuumEntity):

@@ -79,7 +74,7 @@ def __init__(
self,
hass: HomeAssistant,
config_entry: ConfigEntry,
coordinator: ZcsMowerDataUpdateCoordinator,
coordinator: ZcsDataUpdateCoordinator,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
coordinator: ZcsDataUpdateCoordinator,
coordinator: ZcsMowerDataUpdateCoordinator,

@ufozone
Copy link
Owner

ufozone commented Jan 14, 2025

You seem to have used an older version of vacuum.py for your fix. Please merge your fix with the file from the main branch.

@StefanoGiu
Copy link
Contributor Author

I forked the main branch and then apply the fix. What shall I do now? Create a new PR?

@StefanoGiu StefanoGiu closed this by deleting the head repository Jan 15, 2025
@ufozone ufozone removed this from the v1.8 milestone Jan 15, 2025
@ufozone ufozone removed the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants