Add vicare sensors (#63339)

* Add sensors

for:
- solar collector 
- power consumption

* Update sensor.py

* Update sensor.py

* Update sensor.py

* Update sensor.py
This commit is contained in:
tschnilo 2022-02-16 12:11:37 +01:00 committed by GitHub
parent fd96d81563
commit b322c6dafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,10 +189,74 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar power production", key="solar power production today",
name="Solar Power Production", name="Solar power production today",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProduction(), value_getter=lambda api: api.getSolarPowerProductionToday(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="solar power production this week",
name="Solar power production this week",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisWeek(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="solar power production this month",
name="Solar power production this month",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisMonth(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="solar power production this year",
name="Solar power production this year",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisYear(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="power consumption today",
name="Power consumption today",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionToday(),
unit_getter=lambda api: api.getPowerConsumptionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="power consumption this week",
name="Power consumption this week",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisWeek(),
unit_getter=lambda api: api.getPowerConsumptionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="power consumption this month",
name="Power consumption this month",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisMonth(),
unit_getter=lambda api: api.getPowerConsumptionUnit(),
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="power consumption this year",
name="Power consumption this year",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisYear(),
unit_getter=lambda api: api.getPowerConsumptionUnit(),
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),