Skip to content

Commit

Permalink
Merge pull request #43 from heyhewmike/heyhewmike-patch-1
Browse files Browse the repository at this point in the history
Closes #21 
Closes #40 

* Change meter kwh sensor device classes to be total, not total increasing as its possible some backwards movement is seen on these sensors and HA will complain as it doesn't make sense for a total increasing value.

Thanks for the contribution!

I'm trying to understand the exact implications of this change ( https://developers.home-assistant.io/docs/core/entity/sensor/ documents these values ).  It appears the only possible issue here should be *if* this sensor eventually wraps we'd see a huge negative jump and might mess up statistics.  As the API is not even really an API I have no idea how big the storage is for this value so this is probably just something if we notice a huge negative value to investigate but reasonable for now.
  • Loading branch information
krbaker authored Mar 11, 2023
2 parents 39e9532 + 7b0bf49 commit e1e2bf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/sunpower/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Lifetime Power",
ENERGY_KILO_WATT_HOUR,
"mdi:flash",
DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING,
DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL,
],
"METER_KW": ["p_3phsum_kw", "Power", POWER_KILO_WATT, "mdi:flash",
DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT],
Expand All @@ -78,7 +78,7 @@
"METER_L12_V": ["v12_v", "Supply Volts", ELECTRIC_POTENTIAL_VOLT, "mdi:flash",
DEVICE_CLASS_VOLTAGE, STATE_CLASS_MEASUREMENT],
"METER_TO_GRID": ["neg_ltea_3phsum_kwh", "KWH To Grid", ENERGY_KILO_WATT_HOUR, "mdi:flash",
DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING],
DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL],
"METER_TO_HOME": ["pos_ltea_3phsum_kwh", "KWH To Home", ENERGY_KILO_WATT_HOUR, "mdi:flash",
DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING]
}
Expand Down

0 comments on commit e1e2bf2

Please sign in to comment.