Make sure that vocolinc flowerbud humidity sensor is exposed (via homekit_controller) (#53518)

* Make sure that vocolinc flowerbud humidity sensor is exposed

* Was a no-op to request these from humidifier, so remove them

* Fix typo
This commit is contained in:
Jc2k 2021-07-26 22:11:27 +01:00 committed by GitHub
parent ee452d415d
commit 1681bbe5a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 2 deletions

View File

@ -49,4 +49,7 @@ CHARACTERISTIC_PLATFORMS = {
CharacteristicsTypes.Vendor.KOOGEEK_REALTIME_ENERGY_2: "sensor",
CharacteristicsTypes.Vendor.VOCOLINC_HUMIDIFIER_SPRAY_LEVEL: "number",
CharacteristicsTypes.get_uuid(CharacteristicsTypes.TEMPERATURE_CURRENT): "sensor",
CharacteristicsTypes.get_uuid(
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT
): "sensor",
}

View File

@ -41,7 +41,6 @@ class HomeKitHumidifier(HomeKitEntity, HumidifierEntity):
"""Define the homekit characteristics the entity cares about."""
return [
CharacteristicsTypes.ACTIVE,
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
CharacteristicsTypes.CURRENT_HUMIDIFIER_DEHUMIDIFIER_STATE,
CharacteristicsTypes.TARGET_HUMIDIFIER_DEHUMIDIFIER_STATE,
CharacteristicsTypes.RELATIVE_HUMIDITY_HUMIDIFIER_THRESHOLD,
@ -143,7 +142,6 @@ class HomeKitDehumidifier(HomeKitEntity, HumidifierEntity):
"""Define the homekit characteristics the entity cares about."""
return [
CharacteristicsTypes.ACTIVE,
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
CharacteristicsTypes.CURRENT_HUMIDIFIER_DEHUMIDIFIER_STATE,
CharacteristicsTypes.TARGET_HUMIDIFIER_DEHUMIDIFIER_STATE,
CharacteristicsTypes.RELATIVE_HUMIDITY_HUMIDIFIER_THRESHOLD,

View File

@ -53,6 +53,16 @@ SIMPLE_SENSOR = {
"probe": lambda char: char.service.type
!= ServicesTypes.get_uuid(ServicesTypes.TEMPERATURE_SENSOR),
},
CharacteristicsTypes.get_uuid(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT): {
"name": "Current Humidity",
"device_class": DEVICE_CLASS_HUMIDITY,
"state_class": STATE_CLASS_MEASUREMENT,
"unit": PERCENTAGE,
# This sensor is only for humidity characteristics that are not part
# of a humidity sensor service.
"probe": lambda char: char.service.type
!= ServicesTypes.get_uuid(ServicesTypes.HUMIDITY_SENSOR),
},
}

View File

@ -68,3 +68,25 @@ async def test_vocolinc_flowerbud_setup(hass):
# The sensor and switch should be part of the same device
assert entry.device_id == device.id
# Assert the humidity sensory is detected
entry = entity_registry.async_get(
"sensor.vocolinc_flowerbud_0d324b_current_humidity"
)
assert entry.unique_id == "homekit-AM01121849000327-aid:1-sid:30-cid:30"
helper = Helper(
hass,
"sensor.vocolinc_flowerbud_0d324b_current_humidity",
pairing,
accessories[0],
config_entry,
)
state = await helper.poll_and_get_state()
assert (
state.attributes["friendly_name"]
== "VOCOlinc-Flowerbud-0d324b - Current Humidity"
)
# The sensor and humidifier should be part of the same device
assert entry.device_id == device.id