From 1f0001566fa40e43e97ed643a75d63cb134c8e5d Mon Sep 17 00:00:00 2001 From: artarus <3d@arturik.lt> Date: Thu, 19 Oct 2023 21:20:38 +0300 Subject: [PATCH] Extra sensors Added sensors: Grid Apparent power, Grid Reactive power, Grid total consumption power and grid active power. The Grid active power on each phase is not implemented now in SolisCloud server, but should be fixed by November. --- custom_components/solis/const.py | 74 +++++++++++++++++++++++ custom_components/solis/ginlong_const.py | 9 +++ custom_components/solis/soliscloud_api.py | 17 ++++-- 3 files changed, 96 insertions(+), 4 deletions(-) diff --git a/custom_components/solis/const.py b/custom_components/solis/const.py index fa251c3..719884b 100644 --- a/custom_components/solis/const.py +++ b/custom_components/solis/const.py @@ -14,6 +14,8 @@ ENERGY_KILO_WATT_HOUR, ENERGY_MEGA_WATT_HOUR, POWER_WATT, + POWER_VOLT_AMPERE_REACTIVE, + POWER_VOLT_AMPERE, ELECTRIC_CURRENT_AMPERE, DEVICE_CLASS_CURRENT, DEVICE_CLASS_ENERGY, @@ -479,6 +481,78 @@ STATE_CLASS_TOTAL_INCREASING, GRID_TOTAL_ENERGY_USED ], + 'gridphase1power': [ + 'Grid Phase1 Power', + POWER_WATT, + 'mdi:home-import-outline', + DEVICE_CLASS_POWER, + STATE_CLASS_MEASUREMENT, + GRID_PHASE1_POWER + ], + 'gridphase2power': [ + 'Grid Phase2 Power', + POWER_WATT, + 'mdi:home-import-outline', + DEVICE_CLASS_POWER, + STATE_CLASS_MEASUREMENT, + GRID_PHASE2_POWER + ], + 'gridphase3power': [ + 'Grid Phase3 Power', + POWER_WATT, + 'mdi:home-import-outline', + DEVICE_CLASS_POWER, + STATE_CLASS_MEASUREMENT, + GRID_PHASE3_POWER + ], + 'gridapparentphase1power': [ + 'Grid Phase1 Apparent Power', + POWER_VOLT_AMPERE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_APPARENT_PHASE1_POWER + ], + 'gridapparentphase2power': [ + 'Grid Phase2 Apparent Power', + POWER_VOLT_AMPERE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_APPARENT_PHASE2_POWER + ], + 'gridapparentphase3power': [ + 'Grid Phase3 Apparent Power', + POWER_VOLT_AMPERE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_APPARENT_PHASE3_POWER + ], + 'gridreactivephase1power': [ + 'Grid Phase1 Reactive Power', + POWER_VOLT_AMPERE_REACTIVE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_REACTIVE_PHASE1_POWER + ], + 'gridreactivephase2power': [ + 'Grid Phase2 Reactive Power', + POWER_VOLT_AMPERE_REACTIVE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_REACTIVE_PHASE2_POWER + ], + 'gridreactivephase3power': [ + 'Grid Phase3 Reactive Power', + POWER_VOLT_AMPERE_REACTIVE, + 'mdi:home-import-outline', + None, + STATE_CLASS_MEASUREMENT, + GRID_REACTIVE_PHASE3_POWER + ], 'batstateofhealth': [ 'Battery State Of Health', PERCENTAGE, diff --git a/custom_components/solis/ginlong_const.py b/custom_components/solis/ginlong_const.py index af099f3..a91388f 100644 --- a/custom_components/solis/ginlong_const.py +++ b/custom_components/solis/ginlong_const.py @@ -73,6 +73,15 @@ GRID_TOTAL_CONSUMPTION_POWER = 'totalConsumptionPower' GRID_TOTAL_ENERGY_PURCHASED = 'totalEnergyPurchased' GRID_TOTAL_ENERGY_USED = 'totalEnergyUsed' +GRID_PHASE1_POWER = 'Phase1Power' +GRID_PHASE2_POWER = 'Phase2Power' +GRID_PHASE3_POWER = 'Phase3Power' +GRID_APPARENT_PHASE1_POWER = 'ApparentPhase1Power' +GRID_APPARENT_PHASE2_POWER = 'ApparentPhase2Power' +GRID_APPARENT_PHASE3_POWER = 'ApparentPhase3Power' +GRID_REACTIVE_PHASE1_POWER = 'ReactivePhase1Power' +GRID_REACTIVE_PHASE2_POWER = 'ReactivePhase2Power' +GRID_REACTIVE_PHASE3_POWER = 'ReactivePhase3Power' SOC_CHARGING_SET = 'socChargingSet' SOC_DISCHARGE_SET = 'socDischargeSet' BYPASS_LOAD_POWER = 'bypassLoadPower' diff --git a/custom_components/solis/soliscloud_api.py b/custom_components/solis/soliscloud_api.py index 1843f75..4410360 100644 --- a/custom_components/solis/soliscloud_api.py +++ b/custom_components/solis/soliscloud_api.py @@ -118,14 +118,21 @@ GRID_TOTAL_ON_GRID_ENERGY_STR: ['gridSellTotalEnergyStr', str, None], GRID_TOTAL_POWER: ['psum', float, 3], GRID_TOTAL_POWER_STR: ['psumStr', str, None], - GRID_TOTAL_CONSUMPTION_POWER: ['familyLoadPower', float, 3], - GRID_TOTAL_CONSUMPTION_POWER_STR: ['familyLoadPowerStr', str, None], GRID_TOTAL_ENERGY_USED: ['homeLoadTotalEnergy', float, 3], GRID_TOTAL_ENERGY_USED_STR: ['homeLoadTotalEnergyStr', str, None], + GRID_PHASE1_POWER: ['pA', float, 3], + GRID_PHASE2_POWER: ['pB', float, 3], + GRID_PHASE3_POWER: ['pC', float, 3], + GRID_APPARENT_PHASE1_POWER: ['aLookedPower', float, 3], + GRID_APPARENT_PHASE2_POWER: ['bLookedPower', float, 3], + GRID_APPARENT_PHASE3_POWER: ['cLookedPower', float, 3], + GRID_REACTIVE_PHASE1_POWER: ['aReactivePower', float, 3], + GRID_REACTIVE_PHASE2_POWER: ['bReactivePower', float, 3], + GRID_REACTIVE_PHASE3_POWER: ['cReactivePower', float, 3], SOC_CHARGING_SET: ['socChargingSet', float, 0], SOC_DISCHARGE_SET: ['socDischargeSet', float, 0], BYPASS_LOAD_POWER: ['bypassLoadPower', float, 3], - BYPASS_LOAD_POWER_STR: ['bypassLoadPowerStr', str, None], + BYPASS_LOAD_POWER_STR: ['bypassLoadPowerStr', str, None] }, PLANT_DETAIL: { INVERTER_PLANT_NAME: ['sno', str, None], #stationName no longer available? @@ -142,7 +149,9 @@ GRID_DAILY_ON_GRID_ENERGY: ['gridSellDayEnergy', float, 3], GRID_DAILY_ON_GRID_ENERGY_STR: ['gridSellDayEnergyStr', str, None], GRID_DAILY_ENERGY_USED: ['homeLoadEnergy', float, 3], - GRID_DAILY_ENERGY_USED_STR: ['homeLoadEnergyStr', str, None] + GRID_DAILY_ENERGY_USED_STR: ['homeLoadEnergyStr', str, None], + GRID_TOTAL_CONSUMPTION_POWER: ['familyLoadPower', float, 3], + GRID_TOTAL_CONSUMPTION_POWER_STR: ['familyLoadPowerStr', str, None] }, }