From d5e0c6ca57f95ebc8f013c08ea7180ec92ec05d7 Mon Sep 17 00:00:00 2001 From: Nick Peelman Date: Mon, 6 Jul 2020 12:14:19 -0400 Subject: [PATCH] Add Divisors to Eaton Matrix sensors (#11906) * Add Divisors to Eaton Matrix sensors * Fix tests * Update sensor_limits --- .../definitions/discovery/eaton-matrix.yaml | 4 ++ tests/data/eaton-matrix.json | 68 +++++++++---------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/includes/definitions/discovery/eaton-matrix.yaml b/includes/definitions/discovery/eaton-matrix.yaml index 5186f70e89..95e4825ab8 100644 --- a/includes/definitions/discovery/eaton-matrix.yaml +++ b/includes/definitions/discovery/eaton-matrix.yaml @@ -7,12 +7,14 @@ modules: oid: matInvTable value: matInvOutputCurrent num_oid: ".1.3.6.1.4.1.935.10.2.1.2.2.1.7.{{ $index }}" + divisor: 10 descr: "Inverter {{ $index }} Output" index: "matInvOutputCurrent.{{ $index }}" - oid: matStsTable value: matStsOutputCurrent num_oid: ".1.3.6.1.4.1.935.10.2.1.3.2.1.12.{{ $index }}" + divisor: 10 descr: "STS Output" index: "matStsOutputCurrent.{{ $index }}" voltage: @@ -65,11 +67,13 @@ modules: oid: matStsOutputPower num_oid: ".1.3.6.1.4.1.935.10.2.1.3.2.1.13.{{ $index }}" index: "matStsOutputPower.{{ $index }}" + divisor: 10 descr: "STS Output Power" - oid: matInvTable value: matInvOutputPower num_oid: ".1.3.6.1.4.1.935.10.2.1.2.2.1.10.{{ $index }}" + divisor: 10 descr: "Inverter {{ $index }} Output Power" index: "matInvOutputPower.{{ $index }}" high_limit: matConfInvOutputPower diff --git a/tests/data/eaton-matrix.json b/tests/data/eaton-matrix.json index 4824c3d57b..f7079bca25 100644 --- a/tests/data/eaton-matrix.json +++ b/tests/data/eaton-matrix.json @@ -487,9 +487,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 1 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 1, + "sensor_current": 0.1, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -511,9 +511,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 2 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 0, + "sensor_current": 0.0, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -535,9 +535,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 3 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 1, + "sensor_current": 0.1, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -559,9 +559,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 4 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 1, + "sensor_current": 0.1, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -583,9 +583,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 5 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 1, + "sensor_current": 0.1, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -607,9 +607,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 6 Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 1, + "sensor_current": 0.1, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -631,9 +631,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "STS Output", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 0, + "sensor_current": 0.0, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null, @@ -655,10 +655,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 1 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 10, - "sensor_limit": 1500, + "sensor_current": 1.0, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -679,10 +679,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 2 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 16, - "sensor_limit": 1500, + "sensor_current": 1.6, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -703,10 +703,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 3 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 17, - "sensor_limit": 1500, + "sensor_current": 1.7, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -727,10 +727,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 4 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 16, - "sensor_limit": 1500, + "sensor_current": 1.6, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -751,10 +751,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 5 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 17, - "sensor_limit": 1500, + "sensor_current": 1.7, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -775,10 +775,10 @@ "sensor_type": "eaton-matrix", "sensor_descr": "Inverter 6 Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 17, - "sensor_limit": 1500, + "sensor_current": 1.7, + "sensor_limit": 150.0, "sensor_limit_warn": null, "sensor_limit_low": null, "sensor_limit_low_warn": null, @@ -799,9 +799,9 @@ "sensor_type": "eaton-matrix", "sensor_descr": "STS Output Power", "group": null, - "sensor_divisor": 1, + "sensor_divisor": 10, "sensor_multiplier": 1, - "sensor_current": 29, + "sensor_current": 2.9, "sensor_limit": null, "sensor_limit_warn": null, "sensor_limit_low": null,