mirror of
https://github.com/home-assistant/core.git
synced 2025-05-03 13:39:16 +00:00
Esphome button device class (#60569)
This commit is contained in:
parent
222da7e2d1
commit
e17759410c
@ -3,8 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aioesphomeapi import ButtonInfo
|
from aioesphomeapi import ButtonInfo, EntityState
|
||||||
from aioesphomeapi.model import EntityState
|
|
||||||
|
|
||||||
from homeassistant.components.button import ButtonEntity
|
from homeassistant.components.button import ButtonEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -32,6 +31,11 @@ async def async_setup_entry(
|
|||||||
class EsphomeButton(EsphomeEntity[ButtonInfo, EntityState], ButtonEntity):
|
class EsphomeButton(EsphomeEntity[ButtonInfo, EntityState], ButtonEntity):
|
||||||
"""A button implementation for ESPHome."""
|
"""A button implementation for ESPHome."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_class(self) -> str:
|
||||||
|
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||||
|
return self._static_info.device_class
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _on_device_update(self) -> None:
|
def _on_device_update(self) -> None:
|
||||||
"""Update the entity state when device info has changed."""
|
"""Update the entity state when device info has changed."""
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "ESPHome",
|
"name": "ESPHome",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/esphome",
|
"documentation": "https://www.home-assistant.io/integrations/esphome",
|
||||||
"requirements": ["aioesphomeapi==10.3.0"],
|
"requirements": ["aioesphomeapi==10.4.0"],
|
||||||
"zeroconf": ["_esphomelib._tcp.local."],
|
"zeroconf": ["_esphomelib._tcp.local."],
|
||||||
"codeowners": ["@OttoWinter", "@jesserockz"],
|
"codeowners": ["@OttoWinter", "@jesserockz"],
|
||||||
"after_dependencies": ["zeroconf", "tag"],
|
"after_dependencies": ["zeroconf", "tag"],
|
||||||
|
@ -161,7 +161,7 @@ aioeagle==1.1.0
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==10.3.0
|
aioesphomeapi==10.4.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
@ -112,7 +112,7 @@ aioeagle==1.1.0
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==10.3.0
|
aioesphomeapi==10.4.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user