ahoernecke / ha_cellar_tracker

17 stars 17 forks source link

Bottle count as long term statistics #29

Open betheuil opened 6 months ago

betheuil commented 6 months ago

Hi folks,

I was trying to add total_bottles long term statistics on a dashboard, and the sensor doesn't pull. Looking under the hood, it seems the "state_class"="total" property is missing.

I was thinking the following would do the trick, in sensor.py, line 108:

@property
def state_class(self):
  """return the total state class"""
  if(re.match(".+value",self._sensor_type)):
    return None

  return "total"

But it doesn't work.

Any idea how to solve this?