Add more sensors to homee (#136445)

This commit is contained in:
Markus Adrario 2025-01-24 15:02:14 +00:00 committed by GitHub
parent 728d381eb3
commit a56c37a508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 90 additions and 8 deletions

View File

@ -237,6 +237,7 @@ homeassistant.components.homeassistant_green.*
homeassistant.components.homeassistant_hardware.* homeassistant.components.homeassistant_hardware.*
homeassistant.components.homeassistant_sky_connect.* homeassistant.components.homeassistant_sky_connect.*
homeassistant.components.homeassistant_yellow.* homeassistant.components.homeassistant_yellow.*
homeassistant.components.homee.*
homeassistant.components.homekit.* homeassistant.components.homekit.*
homeassistant.components.homekit_controller homeassistant.components.homekit_controller
homeassistant.components.homekit_controller.alarm_control_panel homeassistant.components.homekit_controller.alarm_control_panel

View File

@ -3,6 +3,7 @@
from homeassistant.const import ( from homeassistant.const import (
LIGHT_LUX, LIGHT_LUX,
PERCENTAGE, PERCENTAGE,
REVOLUTIONS_PER_MINUTE,
UnitOfElectricCurrent, UnitOfElectricCurrent,
UnitOfElectricPotential, UnitOfElectricPotential,
UnitOfEnergy, UnitOfEnergy,
@ -24,6 +25,7 @@ HOMEE_UNIT_TO_HA_UNIT = {
"%": PERCENTAGE, "%": PERCENTAGE,
"lx": LIGHT_LUX, "lx": LIGHT_LUX,
"klx": LIGHT_LUX, "klx": LIGHT_LUX,
"1/min": REVOLUTIONS_PER_MINUTE,
"A": UnitOfElectricCurrent.AMPERE, "A": UnitOfElectricCurrent.AMPERE,
"V": UnitOfElectricPotential.VOLT, "V": UnitOfElectricPotential.VOLT,
"kWh": UnitOfEnergy.KILO_WATT_HOUR, "kWh": UnitOfEnergy.KILO_WATT_HOUR,

View File

@ -52,12 +52,12 @@ rules:
docs-troubleshooting: todo docs-troubleshooting: todo
docs-use-cases: todo docs-use-cases: todo
dynamic-devices: todo dynamic-devices: todo
entity-category: todo entity-category: done
entity-device-class: todo entity-device-class: done
entity-disabled-by-default: todo entity-disabled-by-default: done
entity-translations: todo entity-translations: done
exception-translations: todo exception-translations: todo
icon-translations: todo icon-translations: done
reconfiguration-flow: todo reconfiguration-flow: todo
repair-issues: todo repair-issues: todo
stale-devices: todo stale-devices: todo
@ -65,4 +65,4 @@ rules:
# Platinum # Platinum
async-dependency: todo async-dependency: todo
inject-websession: todo inject-websession: todo
strict-typing: todo strict-typing: done

View File

@ -99,9 +99,29 @@ SENSOR_DESCRIPTIONS: dict[AttributeType, HomeeSensorEntityDescription] = {
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
AttributeType.EXHAUST_MOTOR_REVS: HomeeSensorEntityDescription(
key="exhaust_motor_revs",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
AttributeType.INDOOR_RELATIVE_HUMIDITY: HomeeSensorEntityDescription(
key="indoor_humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
),
AttributeType.INDOOR_TEMPERATURE: HomeeSensorEntityDescription(
key="indoor_temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
AttributeType.INTAKE_MOTOR_REVS: HomeeSensorEntityDescription(
key="intake_motor_revs",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
AttributeType.LEVEL: HomeeSensorEntityDescription( AttributeType.LEVEL: HomeeSensorEntityDescription(
key="level", key="level",
device_class=SensorDeviceClass.VOLUME, device_class=SensorDeviceClass.VOLUME_STORAGE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
AttributeType.LINK_QUALITY: HomeeSensorEntityDescription( AttributeType.LINK_QUALITY: HomeeSensorEntityDescription(
@ -109,6 +129,22 @@ SENSOR_DESCRIPTIONS: dict[AttributeType, HomeeSensorEntityDescription] = {
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
AttributeType.OPERATING_HOURS: HomeeSensorEntityDescription(
key="operating_hours",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.TOTAL_INCREASING,
entity_category=EntityCategory.DIAGNOSTIC,
),
AttributeType.OUTDOOR_RELATIVE_HUMIDITY: HomeeSensorEntityDescription(
key="outdoor_humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
),
AttributeType.OUTDOOR_TEMPERATURE: HomeeSensorEntityDescription(
key="outdoor_temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
AttributeType.POSITION: HomeeSensorEntityDescription( AttributeType.POSITION: HomeeSensorEntityDescription(
key="position", key="position",
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -216,6 +252,7 @@ NODE_SENSOR_DESCRIPTIONS: tuple[HomeeNodeSensorEntityDescription, ...] = (
], ],
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
translation_key="node_sensor_state",
value_fn=lambda node: get_name_for_enum(NodeState, node.state), value_fn=lambda node: get_name_for_enum(NodeState, node.state),
), ),
) )
@ -293,7 +330,6 @@ class HomeeNodeSensor(HomeeNodeEntity, SensorEntity):
"""Initialize a homee node sensor entity.""" """Initialize a homee node sensor entity."""
super().__init__(node, entry) super().__init__(node, entry)
self.entity_description = description self.entity_description = description
self._attr_translation_key = f"node_{description.key}"
self._node = node self._node = node
self._attr_unique_id = f"{self._attr_unique_id}-{description.key}" self._attr_unique_id = f"{self._attr_unique_id}-{description.key}"

View File

@ -42,6 +42,24 @@
"energy_instance": { "energy_instance": {
"name": "Energy {instance}" "name": "Energy {instance}"
}, },
"exhaust_motor_revs": {
"name": "Exhaust motor speed"
},
"indoor_humidity": {
"name": "Indoor humidity"
},
"indoor_humidity_instance": {
"name": "Indoor humidity {instance}"
},
"indoor_temperature": {
"name": "Indoor temperature"
},
"indoor_temperature_instance": {
"name": "Indoor temperature {instance}"
},
"intake_motor_revs": {
"name": "Intake motor speed"
},
"level": { "level": {
"name": "Level" "name": "Level"
}, },
@ -51,6 +69,21 @@
"node_state": { "node_state": {
"name": "Node state" "name": "Node state"
}, },
"operating_hours": {
"name": "Operating hours"
},
"outdoor_humidity": {
"name": "Outdoor humidity"
},
"outdoor_humidity_instance": {
"name": "Outdoor humidity {instance}"
},
"outdoor_temperature": {
"name": "Outdoor temperature"
},
"outdoor_temperature_instance": {
"name": "Outdoor temperature {instance}"
},
"position": { "position": {
"name": "Position" "name": "Position"
}, },

10
mypy.ini generated
View File

@ -2126,6 +2126,16 @@ disallow_untyped_defs = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
[mypy-homeassistant.components.homee.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.homekit.*] [mypy-homeassistant.components.homekit.*]
check_untyped_defs = true check_untyped_defs = true
disallow_incomplete_defs = true disallow_incomplete_defs = true