From e17759410c57b385ac60be5af5f86307ec74b0c2 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 30 Nov 2021 20:33:14 +1300 Subject: [PATCH] Esphome button device class (#60569) --- homeassistant/components/esphome/button.py | 8 ++++++-- homeassistant/components/esphome/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/esphome/button.py b/homeassistant/components/esphome/button.py index b2b780ccaff..a16eca650ad 100644 --- a/homeassistant/components/esphome/button.py +++ b/homeassistant/components/esphome/button.py @@ -3,8 +3,7 @@ from __future__ import annotations from typing import Any -from aioesphomeapi import ButtonInfo -from aioesphomeapi.model import EntityState +from aioesphomeapi import ButtonInfo, EntityState from homeassistant.components.button import ButtonEntity from homeassistant.config_entries import ConfigEntry @@ -32,6 +31,11 @@ async def async_setup_entry( class EsphomeButton(EsphomeEntity[ButtonInfo, EntityState], ButtonEntity): """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 def _on_device_update(self) -> None: """Update the entity state when device info has changed.""" diff --git a/homeassistant/components/esphome/manifest.json b/homeassistant/components/esphome/manifest.json index 3b4eea3395c..680c79057af 100644 --- a/homeassistant/components/esphome/manifest.json +++ b/homeassistant/components/esphome/manifest.json @@ -3,7 +3,7 @@ "name": "ESPHome", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/esphome", - "requirements": ["aioesphomeapi==10.3.0"], + "requirements": ["aioesphomeapi==10.4.0"], "zeroconf": ["_esphomelib._tcp.local."], "codeowners": ["@OttoWinter", "@jesserockz"], "after_dependencies": ["zeroconf", "tag"], diff --git a/requirements_all.txt b/requirements_all.txt index 2e0cf967e13..b4a32a3bbe4 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -161,7 +161,7 @@ aioeagle==1.1.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==10.3.0 +aioesphomeapi==10.4.0 # homeassistant.components.flo aioflo==2021.11.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 9ee1d3227a9..d7ffa92dc67 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -112,7 +112,7 @@ aioeagle==1.1.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==10.3.0 +aioesphomeapi==10.4.0 # homeassistant.components.flo aioflo==2021.11.0