mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Add neato dismiss alert button (#97572)
* Bump pybotvac * Add neato dismiss alert button * fixup! Add neato dismiss alert button * fixup! Add neato dismiss alert button Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * fixup! Add neato dismiss alert button Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * fixup! Add neato dismiss alert button * fixup! Add neato dismiss alert button * fixup! Add neato dismiss alert button Co-authored-by: G Johansson <goran.johansson@shiftit.se> * fixup! Add neato dismiss alert button Co-authored-by: G Johansson <goran.johansson@shiftit.se> * fixup! Add neato dismiss alert button * fixup! Add neato dismiss alert button --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
parent
0d55a7600e
commit
8b56e28838
@ -772,6 +772,7 @@ omit =
|
||||
homeassistant/components/neato/sensor.py
|
||||
homeassistant/components/neato/switch.py
|
||||
homeassistant/components/neato/vacuum.py
|
||||
homeassistant/components/neato/button.py
|
||||
homeassistant/components/nederlandse_spoorwegen/sensor.py
|
||||
homeassistant/components/netdata/sensor.py
|
||||
homeassistant/components/netgear/__init__.py
|
||||
|
@ -40,7 +40,13 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLATFORMS = [Platform.CAMERA, Platform.VACUUM, Platform.SWITCH, Platform.SENSOR]
|
||||
PLATFORMS = [
|
||||
Platform.CAMERA,
|
||||
Platform.VACUUM,
|
||||
Platform.SWITCH,
|
||||
Platform.SENSOR,
|
||||
Platform.BUTTON,
|
||||
]
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
42
homeassistant/components/neato/button.py
Normal file
42
homeassistant/components/neato/button.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""Support for Neato buttons."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pybotvac import Robot
|
||||
|
||||
from homeassistant.components.button import ButtonEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import NEATO_DOMAIN, NEATO_ROBOTS
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up Neato button from config entry."""
|
||||
entities = [NeatoDismissAlertButton(robot) for robot in hass.data[NEATO_ROBOTS]]
|
||||
|
||||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class NeatoDismissAlertButton(ButtonEntity):
|
||||
"""Representation of a dismiss_alert button entity."""
|
||||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
robot: Robot,
|
||||
) -> None:
|
||||
"""Initialize a dismiss_alert Neato button entity."""
|
||||
self.robot = robot
|
||||
self._attr_name = f"{robot.name} Dismiss Alert"
|
||||
self._attr_unique_id = f"{robot.serial}_dismiss_alert"
|
||||
self._attr_device_info = DeviceInfo(identifiers={(NEATO_DOMAIN, robot.serial)})
|
||||
|
||||
async def async_press(self) -> None:
|
||||
"""Press the button."""
|
||||
await self.hass.async_add_executor_job(self.robot.dismiss_current_alert)
|
@ -7,5 +7,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/neato",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["pybotvac"],
|
||||
"requirements": ["pybotvac==0.0.23"]
|
||||
"requirements": ["pybotvac==0.0.24"]
|
||||
}
|
||||
|
@ -1584,7 +1584,7 @@ pybbox==0.0.5-alpha
|
||||
pyblackbird==0.6
|
||||
|
||||
# homeassistant.components.neato
|
||||
pybotvac==0.0.23
|
||||
pybotvac==0.0.24
|
||||
|
||||
# homeassistant.components.braviatv
|
||||
pybravia==0.3.3
|
||||
|
@ -1187,7 +1187,7 @@ pybalboa==1.0.1
|
||||
pyblackbird==0.6
|
||||
|
||||
# homeassistant.components.neato
|
||||
pybotvac==0.0.23
|
||||
pybotvac==0.0.24
|
||||
|
||||
# homeassistant.components.braviatv
|
||||
pybravia==0.3.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user