Support setting Aqara Hub Volume via homekit_controller (#62538)
This commit is contained in:
parent
6806b8b116
commit
d3d6965ba0
9 changed files with 101 additions and 51 deletions
|
@ -47,6 +47,7 @@ HOMEKIT_ACCESSORY_DISPATCH = {
|
|||
}
|
||||
|
||||
CHARACTERISTIC_PLATFORMS = {
|
||||
CharacteristicsTypes.Vendor.AQARA_GATEWAY_VOLUME: "number",
|
||||
CharacteristicsTypes.Vendor.EVE_ENERGY_WATT: "sensor",
|
||||
CharacteristicsTypes.Vendor.EVE_DEGREE_AIR_PRESSURE: "sensor",
|
||||
CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION: "number",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "HomeKit Controller",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
|
||||
"requirements": ["aiohomekit==0.6.4"],
|
||||
"requirements": ["aiohomekit==0.6.10"],
|
||||
"zeroconf": ["_hap._tcp.local."],
|
||||
"after_dependencies": ["zeroconf"],
|
||||
"codeowners": ["@Jc2k", "@bdraco"],
|
||||
|
|
|
@ -10,6 +10,7 @@ from aiohomekit.model.characteristics import Characteristic, CharacteristicsType
|
|||
|
||||
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
|
||||
from . import KNOWN_DEVICES, CharacteristicEntity
|
||||
|
||||
|
@ -18,11 +19,25 @@ NUMBER_ENTITIES: dict[str, NumberEntityDescription] = {
|
|||
key=CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL,
|
||||
name="Spray Quantity",
|
||||
icon="mdi:water",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION: NumberEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.EVE_DEGREE_ELEVATION,
|
||||
name="Elevation",
|
||||
icon="mdi:elevation-rise",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.AQARA_GATEWAY_VOLUME: NumberEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.AQARA_GATEWAY_VOLUME,
|
||||
name="Volume",
|
||||
icon="mdi:volume-high",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
CharacteristicsTypes.Vendor.AQARA_E1_GATEWAY_VOLUME: NumberEntityDescription(
|
||||
key=CharacteristicsTypes.Vendor.AQARA_E1_GATEWAY_VOLUME,
|
||||
name="Volume",
|
||||
icon="mdi:volume-high",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
}
|
||||
|
||||
|
@ -57,6 +72,14 @@ class HomeKitNumber(CharacteristicEntity, NumberEntity):
|
|||
self.entity_description = description
|
||||
super().__init__(conn, info, char)
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the device if any."""
|
||||
prefix = ""
|
||||
if name := super().name:
|
||||
prefix = f"{name} -"
|
||||
return f"{prefix} {self.entity_description.name}"
|
||||
|
||||
def get_characteristic_types(self):
|
||||
"""Define the homekit characteristics the entity is tracking."""
|
||||
return [self._char.type]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue