mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add Tami4 integration boil water button (#103400)
* Implement boil water button * Sort platforms list * Get API directly * Cleanup * Rename boil button string Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Add button to .coveragerc * Change ButtonEntityDescription to EntityDescription * Update homeassistant/components/tami4/button.py * Update homeassistant/components/tami4/button.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
83b0934138
commit
70e2ff351d
@ -1318,6 +1318,7 @@ omit =
|
|||||||
homeassistant/components/tado/device_tracker.py
|
homeassistant/components/tado/device_tracker.py
|
||||||
homeassistant/components/tado/sensor.py
|
homeassistant/components/tado/sensor.py
|
||||||
homeassistant/components/tado/water_heater.py
|
homeassistant/components/tado/water_heater.py
|
||||||
|
homeassistant/components/tami4/button.py
|
||||||
homeassistant/components/tank_utility/sensor.py
|
homeassistant/components/tank_utility/sensor.py
|
||||||
homeassistant/components/tankerkoenig/__init__.py
|
homeassistant/components/tankerkoenig/__init__.py
|
||||||
homeassistant/components/tankerkoenig/binary_sensor.py
|
homeassistant/components/tankerkoenig/binary_sensor.py
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.exceptions import ConfigEntryError, ConfigEntryNotReady
|
|||||||
from .const import API, CONF_REFRESH_TOKEN, COORDINATOR, DOMAIN
|
from .const import API, CONF_REFRESH_TOKEN, COORDINATOR, DOMAIN
|
||||||
from .coordinator import Tami4EdgeWaterQualityCoordinator
|
from .coordinator import Tami4EdgeWaterQualityCoordinator
|
||||||
|
|
||||||
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
PLATFORMS: list[Platform] = [Platform.BUTTON, Platform.SENSOR]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
42
homeassistant/components/tami4/button.py
Normal file
42
homeassistant/components/tami4/button.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
"""Button entities for Tami4Edge."""
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from Tami4EdgeAPI import Tami4EdgeAPI
|
||||||
|
|
||||||
|
from homeassistant.components.button import ButtonEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity import EntityDescription
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
|
from .const import API, DOMAIN
|
||||||
|
from .entity import Tami4EdgeBaseEntity
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
ENTITY_DESCRIPTION = EntityDescription(
|
||||||
|
key="boil_water",
|
||||||
|
translation_key="boil_water",
|
||||||
|
icon="mdi:kettle-steam",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
|
) -> None:
|
||||||
|
"""Perform the setup for Tami4Edge."""
|
||||||
|
api: Tami4EdgeAPI = hass.data[DOMAIN][entry.entry_id][API]
|
||||||
|
|
||||||
|
async_add_entities([Tami4EdgeBoilButton(api)])
|
||||||
|
|
||||||
|
|
||||||
|
class Tami4EdgeBoilButton(Tami4EdgeBaseEntity, ButtonEntity):
|
||||||
|
"""Boil button entity for Tami4Edge."""
|
||||||
|
|
||||||
|
def __init__(self, api: Tami4EdgeAPI) -> None:
|
||||||
|
"""Initialize the button entity."""
|
||||||
|
super().__init__(api, ENTITY_DESCRIPTION)
|
||||||
|
|
||||||
|
def press(self) -> None:
|
||||||
|
"""Handle the button press."""
|
||||||
|
self._api.boil_water()
|
@ -22,6 +22,11 @@
|
|||||||
"filter_litters_passed": {
|
"filter_litters_passed": {
|
||||||
"name": "Filter water passed"
|
"name": "Filter water passed"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"boil_water": {
|
||||||
|
"name": "Boil water"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user