Created new sensor with specific data and group them by devices(account)
This commit is contained in:
16
custom_components/fpl/DailyUsageSensor.py
Normal file
16
custom_components/fpl/DailyUsageSensor.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from .FplSensor import FplSensor
|
||||
|
||||
|
||||
class FplDailyUsageSensor(FplSensor):
|
||||
def __init__(self, hass, config, account):
|
||||
FplSensor.__init__(self, hass, config, account, "Daily Usage")
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
return self.data["daily_usage"][-1]["cost"]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
self.attr["date"] = self.data["daily_usage"][-1]["date"]
|
||||
return self.attr
|
||||
Reference in New Issue
Block a user