mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Warn when vacuum.turn_on or turn_off is called on Tuya vacuums (#95848)
Co-authored-by: Hmmbob <33529490+hmmbob@users.noreply.github.com>
This commit is contained in:
parent
daa9162ca7
commit
1e4f43452c
@ -212,5 +212,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"service_deprecation_turn_off": {
|
||||
"title": "Tuya vacuum support for vacuum.turn_off is being removed",
|
||||
"description": "Tuya vacuum support for the vacuum.turn_off service is deprecated and will be removed in Home Assistant 2024.2; Please adjust any automation or script that uses the service to instead call vacuum.stop and select submit below to mark this issue as resolved."
|
||||
},
|
||||
"service_deprecation_turn_on": {
|
||||
"title": "Tuya vacuum support for vacuum.turn_on is being removed",
|
||||
"description": "Tuya vacuum support for the vacuum.turn_on service is deprecated and will be removed in Home Assistant 2024.2; Please adjust any automation or script that uses the service to instead call vacuum.start and select submit below to mark this issue as resolved."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ from homeassistant.components.vacuum import (
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import STATE_IDLE, STATE_PAUSED
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
@ -153,10 +154,30 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
self._send_command([{"code": DPCode.POWER, "value": True}])
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
"service_deprecation_turn_on",
|
||||
breaks_in_ha_version="2024.2.0",
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="service_deprecation_turn_on",
|
||||
)
|
||||
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
self._send_command([{"code": DPCode.POWER, "value": False}])
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
"service_deprecation_turn_off",
|
||||
breaks_in_ha_version="2024.2.0",
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="service_deprecation_turn_off",
|
||||
)
|
||||
|
||||
def start(self, **kwargs: Any) -> None:
|
||||
"""Start the device."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user