Skip to content

Commit

Permalink
Esphome button device class (home-assistant#60569)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Nov 30, 2021
1 parent 222da7e commit e177594
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions homeassistant/components/esphome/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

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
Expand Down Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/esphome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e177594

Please sign in to comment.