Add photovoltaic sensors to ViCare integration (#113664)

* Add photovoltaic sensors

* Update strings.json

* Apply suggestions from code review

* change uom for daily sensor
This commit is contained in:
Christopher Fenner 2024-06-07 10:21:24 +02:00 committed by GitHub
parent 78c7af40ed
commit 539b9d76fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 0 deletions

View File

@ -694,10 +694,50 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
key="photovoltaic_energy_production_today",
translation_key="photovoltaic_energy_production_today",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getPhotovoltaicProductionCumulatedCurrentDay(),
unit_getter=lambda api: api.getPhotovoltaicProductionCumulatedUnit(),
),
ViCareSensorEntityDescription(
key="photovoltaic_energy_production_this_week",
translation_key="photovoltaic_energy_production_this_week",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getPhotovoltaicProductionCumulatedCurrentWeek(),
unit_getter=lambda api: api.getPhotovoltaicProductionCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="photovoltaic_energy_production_this_month",
translation_key="photovoltaic_energy_production_this_month",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getPhotovoltaicProductionCumulatedCurrentMonth(),
unit_getter=lambda api: api.getPhotovoltaicProductionCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="photovoltaic_energy_production_this_year",
translation_key="photovoltaic_energy_production_this_year",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getPhotovoltaicProductionCumulatedCurrentYear(),
unit_getter=lambda api: api.getPhotovoltaicProductionCumulatedUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="photovoltaic_energy_production_total",
translation_key="photovoltaic_energy_production_total",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
state_class=SensorStateClass.TOTAL_INCREASING,
value_getter=lambda api: api.getPhotovoltaicProductionCumulatedLifeCycle(),
unit_getter=lambda api: api.getPhotovoltaicProductionCumulatedUnit(),
),
ViCareSensorEntityDescription(
key="photovoltaic_status",
translation_key="photovoltaic_status",

View File

@ -319,6 +319,18 @@
"photovoltaic_energy_production_today": {
"name": "Solar energy production today"
},
"photovoltaic_energy_production_this_week": {
"name": "Solar energy production this week"
},
"photovoltaic_energy_production_this_month": {
"name": "Solar energy production this month"
},
"photovoltaic_energy_production_this_year": {
"name": "Solar energy production this year"
},
"photovoltaic_energy_production_total": {
"name": "Solar energy production total"
},
"photovoltaic_status": {
"name": "Solar state",
"state": {