Add button device classes to HomeKit Controller (#60620)

pull/60633/head
Franck Nijhof 2021-11-30 15:21:26 +01:00 committed by GitHub
parent 683bb13f50
commit 2366fbe846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,11 @@ from dataclasses import dataclass
from aiohomekit.model.characteristics import Characteristic, CharacteristicsTypes
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import callback
@ -35,7 +39,7 @@ BUTTON_ENTITIES: dict[str, HomeKitButtonEntityDescription] = {
CharacteristicsTypes.Vendor.HAA_UPDATE: HomeKitButtonEntityDescription(
key=CharacteristicsTypes.Vendor.HAA_UPDATE,
name="Update",
icon="mdi:update",
device_class=ButtonDeviceClass.UPDATE,
entity_category=ENTITY_CATEGORY_CONFIG,
write_value="#HAA@trcmd",
),
@ -61,7 +65,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class HomeKitButton(CharacteristicEntity, ButtonEntity):
"""Representation of a Button control on a homekit accessory."""
entity_description = HomeKitButtonEntityDescription
entity_description: HomeKitButtonEntityDescription
def __init__(
self,