From a56c37a508d0ddd59dc2d78b6670be28f7f2517b Mon Sep 17 00:00:00 2001
From: Markus Adrario <Mozilla@adrario.de>
Date: Fri, 24 Jan 2025 15:02:14 +0000
Subject: [PATCH] Add more sensors to homee (#136445)

---
 .strict-typing                                |  1 +
 homeassistant/components/homee/const.py       |  2 +
 .../components/homee/quality_scale.yaml       | 12 +++---
 homeassistant/components/homee/sensor.py      | 40 ++++++++++++++++++-
 homeassistant/components/homee/strings.json   | 33 +++++++++++++++
 mypy.ini                                      | 10 +++++
 6 files changed, 90 insertions(+), 8 deletions(-)

diff --git a/.strict-typing b/.strict-typing
index 7034ea1f0c1..1c0456a745d 100644
--- a/.strict-typing
+++ b/.strict-typing
@@ -237,6 +237,7 @@ homeassistant.components.homeassistant_green.*
 homeassistant.components.homeassistant_hardware.*
 homeassistant.components.homeassistant_sky_connect.*
 homeassistant.components.homeassistant_yellow.*
+homeassistant.components.homee.*
 homeassistant.components.homekit.*
 homeassistant.components.homekit_controller
 homeassistant.components.homekit_controller.alarm_control_panel
diff --git a/homeassistant/components/homee/const.py b/homeassistant/components/homee/const.py
index 8595f042af8..d1d5be97ef7 100644
--- a/homeassistant/components/homee/const.py
+++ b/homeassistant/components/homee/const.py
@@ -3,6 +3,7 @@
 from homeassistant.const import (
     LIGHT_LUX,
     PERCENTAGE,
+    REVOLUTIONS_PER_MINUTE,
     UnitOfElectricCurrent,
     UnitOfElectricPotential,
     UnitOfEnergy,
@@ -24,6 +25,7 @@ HOMEE_UNIT_TO_HA_UNIT = {
     "%": PERCENTAGE,
     "lx": LIGHT_LUX,
     "klx": LIGHT_LUX,
+    "1/min": REVOLUTIONS_PER_MINUTE,
     "A": UnitOfElectricCurrent.AMPERE,
     "V": UnitOfElectricPotential.VOLT,
     "kWh": UnitOfEnergy.KILO_WATT_HOUR,
diff --git a/homeassistant/components/homee/quality_scale.yaml b/homeassistant/components/homee/quality_scale.yaml
index 96d4678b420..ff99d177018 100644
--- a/homeassistant/components/homee/quality_scale.yaml
+++ b/homeassistant/components/homee/quality_scale.yaml
@@ -52,12 +52,12 @@ rules:
   docs-troubleshooting: todo
   docs-use-cases: todo
   dynamic-devices: todo
-  entity-category: todo
-  entity-device-class: todo
-  entity-disabled-by-default: todo
-  entity-translations: todo
+  entity-category: done
+  entity-device-class: done
+  entity-disabled-by-default: done
+  entity-translations: done
   exception-translations: todo
-  icon-translations: todo
+  icon-translations: done
   reconfiguration-flow: todo
   repair-issues: todo
   stale-devices: todo
@@ -65,4 +65,4 @@ rules:
   # Platinum
   async-dependency: todo
   inject-websession: todo
-  strict-typing: todo
+  strict-typing: done
diff --git a/homeassistant/components/homee/sensor.py b/homeassistant/components/homee/sensor.py
index e9ef298ab4f..9b8fb0f6fe1 100644
--- a/homeassistant/components/homee/sensor.py
+++ b/homeassistant/components/homee/sensor.py
@@ -99,9 +99,29 @@ SENSOR_DESCRIPTIONS: dict[AttributeType, HomeeSensorEntityDescription] = {
         device_class=SensorDeviceClass.TEMPERATURE,
         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(
         key="level",
-        device_class=SensorDeviceClass.VOLUME,
+        device_class=SensorDeviceClass.VOLUME_STORAGE,
         state_class=SensorStateClass.MEASUREMENT,
     ),
     AttributeType.LINK_QUALITY: HomeeSensorEntityDescription(
@@ -109,6 +129,22 @@ SENSOR_DESCRIPTIONS: dict[AttributeType, HomeeSensorEntityDescription] = {
         entity_category=EntityCategory.DIAGNOSTIC,
         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(
         key="position",
         state_class=SensorStateClass.MEASUREMENT,
@@ -216,6 +252,7 @@ NODE_SENSOR_DESCRIPTIONS: tuple[HomeeNodeSensorEntityDescription, ...] = (
         ],
         entity_category=EntityCategory.DIAGNOSTIC,
         entity_registry_enabled_default=False,
+        translation_key="node_sensor_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."""
         super().__init__(node, entry)
         self.entity_description = description
-        self._attr_translation_key = f"node_{description.key}"
         self._node = node
         self._attr_unique_id = f"{self._attr_unique_id}-{description.key}"
 
diff --git a/homeassistant/components/homee/strings.json b/homeassistant/components/homee/strings.json
index a657465126b..401996622f2 100644
--- a/homeassistant/components/homee/strings.json
+++ b/homeassistant/components/homee/strings.json
@@ -42,6 +42,24 @@
       "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": {
         "name": "Level"
       },
@@ -51,6 +69,21 @@
       "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": {
         "name": "Position"
       },
diff --git a/mypy.ini b/mypy.ini
index d0579ab8f41..7f7b66e238f 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -2126,6 +2126,16 @@ disallow_untyped_defs = true
 warn_return_any = 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.*]
 check_untyped_defs = true
 disallow_incomplete_defs = true
-- 
GitLab