diff --git a/tests/data/devices/bituo-technik-spm01x001.json b/tests/data/devices/bituo-technik-spm01x001.json index a7078baca..95dd60b4a 100644 --- a/tests/data/devices/bituo-technik-spm01x001.json +++ b/tests/data/devices/bituo-technik-spm01x001.json @@ -728,6 +728,53 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:8d:c2:0c:51-1-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 1, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "1:0x0b04", + "unique_id": "ab:cd:ef:12:8d:c2:0c:51:1:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:8d:c2:0c:51", + "endpoint_id": 1, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 0.0 + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/frient-a-s-emizb-151.json b/tests/data/devices/frient-a-s-emizb-151.json index b51f5192d..ba5e7f7ba 100644 --- a/tests/data/devices/frient-a-s-emizb-151.json +++ b/tests/data/devices/frient-a-s-emizb-151.json @@ -1659,6 +1659,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:74:0f:89:c3-2-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 2, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "2:0x0b04", + "unique_id": "ab:cd:ef:12:74:0f:89:c3:2:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:74:0f:89:c3", + "endpoint_id": 2, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": null, + "measurement_type": "ACTIVE_MEASUREMENT, PHASE_A_MEASUREMENT, PHASE_B_MEASUREMENT, PHASE_C_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/isilentllc-home-energy-monitor.json b/tests/data/devices/isilentllc-home-energy-monitor.json index 0c9990109..6b295ac8a 100644 --- a/tests/data/devices/isilentllc-home-energy-monitor.json +++ b/tests/data/devices/isilentllc-home-energy-monitor.json @@ -4276,6 +4276,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-10-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 10, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "10:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:10:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 10, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 3.44, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -4568,6 +4616,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-11-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 11, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "11:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:11:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 11, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 1.93, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -4860,6 +4956,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-12-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 12, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "12:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:12:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 12, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 1.23, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -5152,6 +5296,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-13-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 13, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "13:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:13:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 13, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 3.62, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -5444,6 +5636,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-14-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 14, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "14:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:14:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 14, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 3.45, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -5736,6 +5976,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-15-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 15, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "15:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:15:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 15, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.45, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -6031,13 +6319,13 @@ { "info_object": { "fallback_name": null, - "unique_id": "00:13:a2:00:41:93:fe:df-16-2820-rms_current", + "unique_id": "00:13:a2:00:41:93:fe:df-16-2820-reactive_power", "migrate_unique_ids": [], "platform": "sensor", - "class_name": "ElectricalMeasurementRMSCurrent", + "class_name": "ElectricalMeasurementReactivePower", "translation_key": null, "translation_placeholders": null, - "device_class": "current", + "device_class": "reactive_power", "state_class": "measurement", "entity_category": null, "entity_registry_enabled_default": true, @@ -6064,7 +6352,55 @@ "available": true, "group_id": null, "suggested_display_precision": 1, - "unit": "A" + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 3.15, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-16-2820-rms_current", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementRMSCurrent", + "translation_key": null, + "translation_placeholders": null, + "device_class": "current", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 16, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "16:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:16:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 16, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "A" }, "state": { "class_name": "ElectricalMeasurementRMSCurrent", @@ -6320,6 +6656,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-17-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 17, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "17:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:17:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 17, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 1.21, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -6612,6 +6996,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-18-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 18, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "18:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:18:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 18, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.17, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -6904,6 +7336,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-19-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 19, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "19:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:19:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 19, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 1.89, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -7196,6 +7676,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-2-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 2, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "2:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:2:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 2, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 8.46, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -7488,6 +8016,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-20-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 20, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "20:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:20:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 20, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.52, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -7780,6 +8356,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-21-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 21, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "21:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:21:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 21, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 4.53, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -8072,6 +8696,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-22-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 22, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "22:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:22:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 22, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 4.31, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -8364,6 +9036,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-23-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 23, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "23:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:23:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 23, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 5.76, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -8656,6 +9376,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-24-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 24, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "24:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:24:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 24, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 6.13, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -8948,6 +9716,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-25-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 25, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "25:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:25:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 25, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.26, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -9240,6 +10056,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-26-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 26, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "26:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:26:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 26, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 0.09, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -9493,7 +10357,55 @@ "class_name": "ElectricalMeasurementPowerFactor", "translation_key": null, "translation_placeholders": null, - "device_class": "power_factor", + "device_class": "power_factor", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 3, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "3:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:3:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 3, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "%" + }, + "state": { + "class_name": "ElectricalMeasurementPowerFactor", + "available": true, + "state": 27, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-3-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", "state_class": "measurement", "entity_category": null, "entity_registry_enabled_default": true, @@ -9520,12 +10432,12 @@ "available": true, "group_id": null, "suggested_display_precision": 1, - "unit": "%" + "unit": "var" }, "state": { - "class_name": "ElectricalMeasurementPowerFactor", + "class_name": "ElectricalMeasurementReactivePower", "available": true, - "state": 27, + "state": 6.06, "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" }, "extra_state_attributes": [ @@ -9824,6 +10736,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-4-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 4, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "4:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:4:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 4, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 0.95, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -10116,6 +11076,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-5-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 5, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "5:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:5:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 5, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 6.43, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -10408,6 +11416,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-6-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 6, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "6:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:6:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 6, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.72, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -10700,6 +11756,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-7-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 7, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "7:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:7:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 7, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 8.79, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -10992,6 +12096,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-8-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 8, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "8:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:8:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 8, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 2.66, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -11284,6 +12436,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "00:13:a2:00:41:93:fe:df-9-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 9, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "9:0x0b04", + "unique_id": "00:13:a2:00:41:93:fe:df:9:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "00:13:a2:00:41:93:fe:df", + "endpoint_id": 9, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 0.66, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/tze200-bkkmqmyo-ts0601.json b/tests/data/devices/tze200-bkkmqmyo-ts0601.json index 0113f2e77..5b9a6fedf 100644 --- a/tests/data/devices/tze200-bkkmqmyo-ts0601.json +++ b/tests/data/devices/tze200-bkkmqmyo-ts0601.json @@ -894,6 +894,53 @@ "extra_state_attributes": [ "measurement_type" ] + }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:ab:88:33:32-1-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 1, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "1:0x0b04", + "unique_id": "ab:cd:ef:12:ab:88:33:32:1:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:ab:88:33:32", + "endpoint_id": 1, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 102.0 + }, + "extra_state_attributes": [ + "measurement_type" + ] } ], "switch": [ diff --git a/tests/data/devices/tze204-81yrt3lo-ts0601.json b/tests/data/devices/tze204-81yrt3lo-ts0601.json index 47de04adf..8a96d5884 100644 --- a/tests/data/devices/tze204-81yrt3lo-ts0601.json +++ b/tests/data/devices/tze204-81yrt3lo-ts0601.json @@ -1345,6 +1345,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:22:09:db:75-1-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 1, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "1:0x0b04", + "unique_id": "ab:cd:ef:12:22:09:db:75:1:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:22:09:db:75", + "endpoint_id": 1, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 0.0, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -1741,6 +1789,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:22:09:db:75-2-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 2, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "2:0x0b04", + "unique_id": "ab:cd:ef:12:22:09:db:75:2:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:22:09:db:75", + "endpoint_id": 2, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 79.7, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, @@ -2040,6 +2136,54 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:22:09:db:75-3-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 3, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "3:0x0b04", + "unique_id": "ab:cd:ef:12:22:09:db:75:3:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:22:09:db:75", + "endpoint_id": 3, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 79.7, + "measurement_type": "ACTIVE_MEASUREMENT, REACTIVE_MEASUREMENT, APPARENT_MEASUREMENT, PHASE_A_MEASUREMENT" + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, diff --git a/tests/data/devices/tze204-bkkmqmyo-ts0601.json b/tests/data/devices/tze204-bkkmqmyo-ts0601.json index d6b9b895e..9f36949c8 100644 --- a/tests/data/devices/tze204-bkkmqmyo-ts0601.json +++ b/tests/data/devices/tze204-bkkmqmyo-ts0601.json @@ -769,6 +769,53 @@ "measurement_type" ] }, + { + "info_object": { + "fallback_name": null, + "unique_id": "ab:cd:ef:12:83:e9:5e:8c-1-2820-reactive_power", + "migrate_unique_ids": [], + "platform": "sensor", + "class_name": "ElectricalMeasurementReactivePower", + "translation_key": null, + "translation_placeholders": null, + "device_class": "reactive_power", + "state_class": "measurement", + "entity_category": null, + "entity_registry_enabled_default": true, + "enabled": true, + "primary": false, + "cluster_handlers": [ + { + "class_name": "ElectricalMeasurementClusterHandler", + "generic_id": "cluster_handler_0x0b04", + "endpoint_id": 1, + "cluster": { + "id": 2820, + "name": "Electrical Measurement", + "type": "server" + }, + "id": "1:0x0b04", + "unique_id": "ab:cd:ef:12:83:e9:5e:8c:1:0x0b04", + "status": "INITIALIZED", + "value_attribute": "ac_voltage_multiplier" + } + ], + "device_ieee": "ab:cd:ef:12:83:e9:5e:8c", + "endpoint_id": 1, + "available": true, + "group_id": null, + "suggested_display_precision": 1, + "unit": "var" + }, + "state": { + "class_name": "ElectricalMeasurementReactivePower", + "available": true, + "state": 22.0 + }, + "extra_state_attributes": [ + "measurement_type" + ] + }, { "info_object": { "fallback_name": null, diff --git a/tests/test_cluster_handlers.py b/tests/test_cluster_handlers.py index 22fdd6711..265f862af 100644 --- a/tests/test_cluster_handlers.py +++ b/tests/test_cluster_handlers.py @@ -255,6 +255,7 @@ def endpoint_mock(zigpy_coordinator_device: ZigpyDevice) -> Endpoint: "active_power_ph_c", "total_active_power", "apparent_power", + "reactive_power", "dc_current", "dc_current_divisor", "dc_current_multiplier", diff --git a/tests/test_sensor.py b/tests/test_sensor.py index 65b6bcadf..982ee2dc3 100644 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -1425,6 +1425,7 @@ async def test_elec_measurement_skip_unsupported_attribute( "active_power_max_ph_c", "total_active_power", "apparent_power", + "reactive_power", "rms_current", "rms_current_ph_b", "rms_current_ph_c", diff --git a/zha/application/platforms/sensor/__init__.py b/zha/application/platforms/sensor/__init__.py index 88f459025..110dddc33 100644 --- a/zha/application/platforms/sensor/__init__.py +++ b/zha/application/platforms/sensor/__init__.py @@ -91,6 +91,7 @@ UnitOfMass, UnitOfPower, UnitOfPressure, + UnitOfReactivePower, UnitOfSpeed, UnitOfTemperature, UnitOfTime, @@ -886,6 +887,23 @@ class ElectricalMeasurementApparentPower(BaseElectricalMeasurement): ) +@register_entity(ElectricalMeasurement.cluster_id) +class ElectricalMeasurementReactivePower(BaseElectricalMeasurement): + """Reactive power measurement.""" + + _attribute_name = "reactive_power" + _unique_id_suffix = "reactive_power" + _divisor_attribute_name = "ac_power_divisor" + _multiplier_attribute_name = "ac_power_multiplier" + _attr_device_class: SensorDeviceClass = SensorDeviceClass.REACTIVE_POWER + _attr_native_unit_of_measurement = UnitOfReactivePower.VOLT_AMPERE_REACTIVE + _skip_creation_if_no_attr_cache = True + + _cluster_handler_match = ClusterHandlerMatch( + cluster_handlers=frozenset({CLUSTER_HANDLER_ELECTRICAL_MEASUREMENT}), + ) + + @register_entity(ElectricalMeasurement.cluster_id) class ElectricalMeasurementRMSCurrent(BaseElectricalMeasurement): """RMS current measurement.""" diff --git a/zha/zigbee/cluster_handlers/homeautomation.py b/zha/zigbee/cluster_handlers/homeautomation.py index f8c85b9f2..aa8a14e2b 100644 --- a/zha/zigbee/cluster_handlers/homeautomation.py +++ b/zha/zigbee/cluster_handlers/homeautomation.py @@ -113,6 +113,10 @@ class MeasurementType(enum.IntFlag): attr=ElectricalMeasurement.AttributeDefs.apparent_power.name, config=REPORT_CONFIG_OP, ), + AttrReportConfig( + attr=ElectricalMeasurement.AttributeDefs.reactive_power.name, + config=REPORT_CONFIG_OP, + ), AttrReportConfig( attr=ElectricalMeasurement.AttributeDefs.rms_current.name, config=REPORT_CONFIG_OP, @@ -189,6 +193,7 @@ class MeasurementType(enum.IntFlag): ElectricalMeasurement.AttributeDefs.active_power_max_ph_c.name, ElectricalMeasurement.AttributeDefs.total_active_power.name, ElectricalMeasurement.AttributeDefs.apparent_power.name, + ElectricalMeasurement.AttributeDefs.reactive_power.name, ElectricalMeasurement.AttributeDefs.power_factor.name, ElectricalMeasurement.AttributeDefs.power_factor_ph_b.name, ElectricalMeasurement.AttributeDefs.power_factor_ph_c.name,