Change Solarlog Watt-peak to Watt (#55110)

This commit is contained in:
Ernst Klamer 2021-08-24 10:55:40 +02:00 committed by GitHub
parent dc851b9dd5
commit d3f17de072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -167,9 +167,10 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = (
SolarLogSensorEntityDescription( SolarLogSensorEntityDescription(
key="total_power", key="total_power",
json_key="totalPOWER", json_key="totalPOWER",
name="total power", name="installed peak power",
icon="mdi:solar-power", icon="mdi:solar-power",
native_unit_of_measurement="Wp", native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
), ),
SolarLogSensorEntityDescription( SolarLogSensorEntityDescription(
key="alternator_loss", key="alternator_loss",
@ -185,7 +186,8 @@ SENSOR_TYPES: tuple[SolarLogSensorEntityDescription, ...] = (
json_key="CAPACITY", json_key="CAPACITY",
name="capacity", name="capacity",
icon="mdi:solar-power", icon="mdi:solar-power",
native_unit_of_measurement="W/Wp", native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_POWER_FACTOR,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_MEASUREMENT,
), ),
SolarLogSensorEntityDescription( SolarLogSensorEntityDescription(

View File

@ -97,7 +97,7 @@ class SolarlogData:
self.data["consumptionTOTAL"] = self.api.consumption_total / 1000 self.data["consumptionTOTAL"] = self.api.consumption_total / 1000
self.data["totalPOWER"] = self.api.total_power self.data["totalPOWER"] = self.api.total_power
self.data["alternatorLOSS"] = self.api.alternator_loss self.data["alternatorLOSS"] = self.api.alternator_loss
self.data["CAPACITY"] = round(self.api.capacity, 3) self.data["CAPACITY"] = round(self.api.capacity * 100, 0)
self.data["EFFICIENCY"] = round(self.api.efficiency * 100, 0) self.data["EFFICIENCY"] = round(self.api.efficiency * 100, 0)
self.data["powerAVAILABLE"] = self.api.power_available self.data["powerAVAILABLE"] = self.api.power_available
self.data["USAGE"] = round(self.api.usage * 100, 0) self.data["USAGE"] = round(self.api.usage * 100, 0)