Add battery discharge sensor to ViCare integration (#113502)

Co-authored-by: jan iversen <jancasacondor@gmail.com>
This commit is contained in:
Christopher Fenner 2024-03-16 12:38:54 +01:00 committed by GitHub
parent 219cb7a788
commit 1ffc514528
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 54 additions and 0 deletions

View File

@ -620,6 +620,45 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
options=["charge", "discharge", "standby"],
value_getter=lambda api: api.getElectricalEnergySystemOperationState(),
),
ViCareSensorEntityDescription(
key="ess_discharge_today",
translation_key="ess_discharge_today",
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedCurrentDay(),
unit_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedUnit(),
),
ViCareSensorEntityDescription(
key="ess_discharge_this_week",
translation_key="ess_discharge_this_week",
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedCurrentWeek(),
unit_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="ess_discharge_this_month",
translation_key="ess_discharge_this_month",
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedCurrentMonth(),
unit_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="ess_discharge_this_year",
translation_key="ess_discharge_this_year",
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedCurrentYear(),
unit_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="ess_discharge_total",
translation_key="ess_discharge_total",
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedLifeCycle(),
unit_getter=lambda api: api.getElectricalEnergySystemTransferDischargeCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="pcc_transfer_power_exchange",
translation_key="pcc_transfer_power_exchange",

View File

@ -286,6 +286,21 @@
"standby": "Standby"
}
},
"ess_discharge_today": {
"name": "Battery discharge today"
},
"ess_discharge_this_week": {
"name": "Battery discharge this week"
},
"ess_discharge_this_month": {
"name": "Battery discharge this month"
},
"ess_discharge_this_year": {
"name": "Battery discharge this year"
},
"ess_discharge_total": {
"name": "Battery discharge total"
},
"pcc_current_power_exchange": {
"name": "Grid power exchange"
},