diff --git a/custom_components/fpl/ProjectedBillSensor.py b/custom_components/fpl/ProjectedBillSensor.py new file mode 100644 index 0000000..8945dd0 --- /dev/null +++ b/custom_components/fpl/ProjectedBillSensor.py @@ -0,0 +1,36 @@ +from .FplSensor import FplSensor + + +class FplProjectedBillSensor(FplSensor): + def __init__(self, hass, config, account): + FplSensor.__init__(self, hass, config, account, "Projected Bill") + + @property + def state(self): + data = self.data + try: + if "budget_bill" in data.keys(): + if data["budget_bill"]: + if "budget_billing_projected_bill" in data.keys(): + self._state = data["budget_billing_projected_bill"] + else: + if "projected_bill" in data.keys(): + self._state = data["projected_bill"] + except: + pass + + return self._state + + @property + def device_state_attributes(self): + """Return the state attributes.""" + + if "budget_bill" in self.data.keys(): + self.attr["budget_bill"] = self.data["budget_bill"] + + + return self._state + + @property + def icon(self): + return "mdi:currency-usd" \ No newline at end of file diff --git a/custom_components/fpl/const.py b/custom_components/fpl/const.py index 63615e0..5a418bb 100644 --- a/custom_components/fpl/const.py +++ b/custom_components/fpl/const.py @@ -3,7 +3,7 @@ NAME = "FPL Integration" DOMAIN = "fpl" DOMAIN_DATA = f"{DOMAIN}_data" -VERSION = "0.0.1" +VERSION = "0.1.0" PLATFORMS = ["sensor"] REQUIRED_FILES = [ ".translations/en.json", diff --git a/custom_components/fpl/fplDataUpdateCoordinator.py b/custom_components/fpl/fplDataUpdateCoordinator.py index e4056ac..5679cbf 100644 --- a/custom_components/fpl/fplDataUpdateCoordinator.py +++ b/custom_components/fpl/fplDataUpdateCoordinator.py @@ -7,7 +7,7 @@ from datetime import timedelta from .fplapi import FplApi from .const import DOMAIN -SCAN_INTERVAL = timedelta(seconds=7200) +SCAN_INTERVAL = timedelta(seconds=1200) _LOGGER: logging.Logger = logging.getLogger(__package__) diff --git a/custom_components/fpl/fplEntity.py b/custom_components/fpl/fplEntity.py index 1680931..01c543c 100644 --- a/custom_components/fpl/fplEntity.py +++ b/custom_components/fpl/fplEntity.py @@ -29,16 +29,13 @@ class FplEntity(CoordinatorEntity, SensorEntity): ) return id - @property - def name(self): - return f"{DOMAIN.upper()} {self.account} {self.sensorName}" - @property def device_info(self): return { "identifiers": {(DOMAIN, self.account)}, - "name": f"Account {self.account}", - "model": VERSION, + "name": f"FPL Account {self.account}", + "model": "FPL Monitoring API", + "sw_version": VERSION, "manufacturer": "Florida Power & Light", } diff --git a/custom_components/fpl/fplapi.py b/custom_components/fpl/fplapi.py index a2c2a67..db84fab 100644 --- a/custom_components/fpl/fplapi.py +++ b/custom_components/fpl/fplapi.py @@ -298,6 +298,9 @@ class FplApi(object): "cost": daily["billingCharge"], "date": daily["date"], "max_temperature": daily["averageHighTemperature"], + "netDeliveredKwh": daily["netDeliveredKwh"], + "netReceivedKwh": daily["netReceivedKwh"], + "readTime": daily["readTime"], } ) # totalPowerUsage += int(daily["kwhUsed"]) @@ -310,6 +313,7 @@ class FplApi(object): data["billToDateKWH"] = r["CurrentUsage"]["billToDateKWH"] data["recMtrReading"] = r["CurrentUsage"]["recMtrReading"] data["delMtrReading"] = r["CurrentUsage"]["delMtrReading"] + data["billStartDate"] = r["CurrentUsage"]["billStartDate"] return data async def __getDataFromApplianceUsage(self, account, lastBilledDate) -> dict: diff --git a/custom_components/fpl/manifest.json b/custom_components/fpl/manifest.json index 0397962..653f1ea 100644 --- a/custom_components/fpl/manifest.json +++ b/custom_components/fpl/manifest.json @@ -11,6 +11,12 @@ "requirements": [ "integrationhelper" ], +<<<<<<< HEAD "version": "1.0.0", "issue_tracker": "https://github.com/dotKrad/hass-fpl/issues" +======= + "homeassistant": "2021.12.7", + "version": "1.0.0", + "issue_tracker" : "https://github.com/dotKrad/hass-fpl/issues" +>>>>>>> master } \ No newline at end of file diff --git a/custom_components/fpl/sensor.py b/custom_components/fpl/sensor.py index 64d651a..6c6ff5c 100644 --- a/custom_components/fpl/sensor.py +++ b/custom_components/fpl/sensor.py @@ -23,9 +23,14 @@ from .sensor_ProjectedBillSensor import ( from .sensor_AverageDailySensor import ( FplAverageDailySensor, BudgetDailyAverageSensor, - ActualDailyAverageSensor, ) -from .sensor_DailyUsageSensor import FplDailyUsageKWHSensor, FplDailyUsageSensor +from .sensor_DailyUsageSensor import ( + FplDailyUsageKWHSensor, + FplDailyUsageSensor, + FplDailyDeliveredKWHSensor, + FplDailyReceivedKWHSensor, +) + from .const import DOMAIN from .TestSensor import TestSensor @@ -51,10 +56,10 @@ async def async_setup_entry(hass, entry, async_add_devices): # usage sensors fpl_accounts.append(FplAverageDailySensor(coordinator, entry, account)) fpl_accounts.append(BudgetDailyAverageSensor(coordinator, entry, account)) - fpl_accounts.append(ActualDailyAverageSensor(coordinator, entry, account)) - fpl_accounts.append(FplDailyUsageSensor(coordinator, entry, account)) fpl_accounts.append(FplDailyUsageKWHSensor(coordinator, entry, account)) + fpl_accounts.append(FplDailyReceivedKWHSensor(coordinator, entry, account)) + fpl_accounts.append(FplDailyDeliveredKWHSensor(coordinator, entry, account)) # date sensors fpl_accounts.append(CurrentBillDateSensor(coordinator, entry, account)) @@ -67,6 +72,9 @@ async def async_setup_entry(hass, entry, async_add_devices): fpl_accounts.append(ProjectedKWHSensor(coordinator, entry, account)) fpl_accounts.append(DailyAverageKWHSensor(coordinator, entry, account)) fpl_accounts.append(BillToDateKWHSensor(coordinator, entry, account)) + fpl_accounts.append(NetReceivedKWHSensor(coordinator, entry, account)) + fpl_accounts.append(NetDeliveredKWHSensor(coordinator, entry, account)) + fpl_accounts.append(NetReceivedKWHSensor(coordinator, entry, account)) fpl_accounts.append(NetDeliveredKWHSensor(coordinator, entry, account)) diff --git a/custom_components/fpl/sensor_AllData.py b/custom_components/fpl/sensor_AllData.py new file mode 100644 index 0000000..d8395fd --- /dev/null +++ b/custom_components/fpl/sensor_AllData.py @@ -0,0 +1,33 @@ +from .fplEntity import FplEntity + + +class AllDataSensor(FplEntity): + def __init__(self, coordinator, config, account): + super().__init__(coordinator, config, account, "") + + @property + def state(self): + budget = self.getData("budget_bill") + budget_billing_projected_bill = self.getData("budget_billing_projected_bill") + + if budget == True and budget_billing_projected_bill is not None: + return self.getData("budget_billing_projected_bill") + + try: + self._state=self.getData("projected_bill") + except: + pass + return self._state + + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Budget Projected Bill" + attributes["device_class"] = "monetary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + return attributes \ No newline at end of file diff --git a/custom_components/fpl/sensor_AverageDailySensor.py b/custom_components/fpl/sensor_AverageDailySensor.py index 3399ded..6665ced 100644 --- a/custom_components/fpl/sensor_AverageDailySensor.py +++ b/custom_components/fpl/sensor_AverageDailySensor.py @@ -13,8 +13,27 @@ class FplAverageDailySensor(FplMoneyEntity): if budget == True and budget_billing_projected_bill is not None: return self.getData("budget_billing_daily_avg") - return self.getData("daily_avg") + try: + self._state=self.getData("daily_avg") + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Daily Average" + attributes["device_class"] = "monetary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + return attributes +>>>>>>> master class BudgetDailyAverageSensor(FplMoneyEntity): def __init__(self, coordinator, config, account): @@ -22,8 +41,13 @@ class BudgetDailyAverageSensor(FplMoneyEntity): @property def state(self): - return self.getData("budget_billing_daily_avg") + try: + self._state= self.getData("budget_billing_daily_avg") + except: + pass + return self._state +<<<<<<< HEAD class ActualDailyAverageSensor(FplMoneyEntity): def __init__(self, coordinator, config, account): @@ -32,3 +56,18 @@ class ActualDailyAverageSensor(FplMoneyEntity): @property def state(self): return self.getData("daily_avg") +======= + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Budget Daily Average" + attributes["device_class"] = "monitary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + return attributes + +>>>>>>> master diff --git a/custom_components/fpl/sensor_DailyUsageSensor.py b/custom_components/fpl/sensor_DailyUsageSensor.py index 8bfa90e..23ab8ed 100644 --- a/custom_components/fpl/sensor_DailyUsageSensor.py +++ b/custom_components/fpl/sensor_DailyUsageSensor.py @@ -9,19 +9,34 @@ class FplDailyUsageSensor(FplMoneyEntity): def state(self): data = self.getData("daily_usage") - if len(data) > 0: - return data[-1]["cost"] - - return None + try: + self._state = data[-1]["cost"] + except: + pass + return self._state def defineAttributes(self): """Return the state attributes.""" data = self.getData("daily_usage") - - if len(data) > 0: - return {"date": data[-1]["date"]} - - return {} + attributes = {} + attributes["friendly_name"] = "Daily Usage" + attributes["device_class"] = "monetary" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "$" + if data is not None: + if ( + (len(data) > 0) + and (data[-1] is not None) + and (data[-1]["readTime"] is not None) + ): + attributes["date"] = data[-1]["readTime"] + if ( + (len(data) > 1) + and (data[-2] is not None) + and (data[-2]["readTime"] is not None) + ): + attributes["last_reset"] = data[-2]["readTime"] + return attributes class FplDailyUsageKWHSensor(FplEnergyEntity): @@ -32,16 +47,126 @@ class FplDailyUsageKWHSensor(FplEnergyEntity): def state(self): data = self.getData("daily_usage") - if len(data) > 0: - return data[-1]["usage"] - - return None + try: + self._state = data[-1]["usage"] + except: + pass + return self._state def defineAttributes(self): """Return the state attributes.""" data = self.getData("daily_usage") - if len(data) > 0: - return {"date": data[-1]["date"]} + attributes = {} + attributes["friendly_name"] = "Daily Usage" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if data is not None: + if ( + (len(data) > 0) + and (data[-1] is not None) + and (data[-1]["readTime"] is not None) + ): + attributes["date"] = data[-1]["readTime"] + if ( + (len(data) > 1) + and (data[-2] is not None) + and (data[-2]["readTime"] is not None) + ): + attributes["last_reset"] = data[-2]["readTime"] + + return attributes + + @property + def icon(self): + return "mdi:flash" + + +class FplDailyReceivedKWHSensor(FplEntity): + def __init__(self, coordinator, config, account): + super().__init__(coordinator, config, account, "Daily Received KWH") + + @property + def state(self): + data = self.getData("daily_usage") + try: + self._state = data[-1]["netReceivedKwh"] + except: + pass + return self._state + + def defineAttributes(self): + """Return the state attributes.""" + data = self.getData("daily_usage") + + attributes = {} + attributes["friendly_name"] = "Daily Return to Grid" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if data is not None: + if ( + (len(data) > 0) + and (data[-1] is not None) + and (data[-1]["readTime"] is not None) + ): + attributes["date"] = data[-1]["readTime"] + if ( + (len(data) > 1) + and (data[-2] is not None) + and (data[-2]["readTime"] is not None) + ): + attributes["last_reset"] = data[-2]["readTime"] + return attributes + + @property + def icon(self): + return "mdi:flash" + + +class FplDailyDeliveredKWHSensor(FplEntity): + def __init__(self, coordinator, config, account): + super().__init__(coordinator, config, account, "Daily Delivered KWH") + + @property + def state(self): + data = self.getData("daily_usage") + try: + self._state = data[-1]["netDeliveredKwh"] + except: + pass + return self._state + + def defineAttributes(self): + """Return the state attributes.""" + data = self.getData("daily_usage") + +<<<<<<< HEAD return {} +======= + attributes = {} + attributes["friendly_name"] = "Daily Consumption" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if data is not None: + if ( + (len(data) > 0) + and (data[-1] is not None) + and (data[-1]["readTime"] is not None) + ): + attributes["date"] = data[-1]["readTime"] + if ( + (len(data) > 1) + and (data[-2] is not None) + and (data[-2]["readTime"] is not None) + ): + attributes["last_reset"] = data[-2]["readTime"] + return attributes + + @property + def icon(self): + return "mdi:flash" +>>>>>>> master diff --git a/custom_components/fpl/sensor_DatesSensor.py b/custom_components/fpl/sensor_DatesSensor.py index b2f2fdb..5762532 100644 --- a/custom_components/fpl/sensor_DatesSensor.py +++ b/custom_components/fpl/sensor_DatesSensor.py @@ -1,46 +1,136 @@ +<<<<<<< HEAD from .fplEntity import FplDateEntity +======= +from .fplEntity import FplEntity +import datetime +>>>>>>> master class CurrentBillDateSensor(FplDateEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Current Bill Date") + super().__init__(coordinator, config, account, "Billing Current Date") @property def state(self): - return self.getData("current_bill_date") + try: + self._state= datetime.date.fromisoformat(self.getData("current_bill_date")) + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:calendar" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["device_class"] = "date" + attributes["friendly_name"] = "Billing Current" + return attributes +>>>>>>> master class NextBillDateSensor(FplDateEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Next Bill Date") + super().__init__(coordinator, config, account, "Billing Next") @property def state(self): - return self.getData("next_bill_date") + try: + self._state= datetime.date.fromisoformat(self.getData("next_bill_date")) + except: + pass + return self._state +<<<<<<< HEAD class ServiceDaysSensor(FplDateEntity): +======= + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["device_class"] = "date" + attributes["friendly_name"] = "Billing Next" + return attributes + +class ServiceDaysSensor(FplEntity): +>>>>>>> master def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Service Days") + super().__init__(coordinator, config, account, "Billing Total Days") @property def state(self): - return self.getData("service_days") + try: + self._state= self.getData("service_days") + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:calendar" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["unit_of_measurement"] = "days" + attributes["friendly_name"] = "Billing Total" + return attributes +>>>>>>> master class AsOfDaysSensor(FplDateEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "As Of Days") + super().__init__(coordinator, config, account, "Billing As Of") @property def state(self): - return self.getData("as_of_days") + try: + self._state= self.getData("as_of_days") + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:calendar" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["unit_of_measurement"] = "days" + attributes["friendly_name"] = "Billing As Of" + return attributes +>>>>>>> master class RemainingDaysSensor(FplDateEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Remaining Days") + super().__init__(coordinator, config, account, "Billing Remaining") @property def state(self): +<<<<<<< HEAD return self.getData("remaining_days") +======= + try: + self._state= self.getData("remaining_days") + except: + pass + return self._state + + @property + def icon(self): + return "mdi:calendar" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["unit_of_measurement"] = "days" + attributes["friendly_name"] = "Billing Remaining" + return attributes +>>>>>>> master diff --git a/custom_components/fpl/sensor_KWHSensor.py b/custom_components/fpl/sensor_KWHSensor.py index 6d48d03..89a204c 100644 --- a/custom_components/fpl/sensor_KWHSensor.py +++ b/custom_components/fpl/sensor_KWHSensor.py @@ -4,56 +4,154 @@ from .fplEntity import FplEnergyEntity class ProjectedKWHSensor(FplEnergyEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Projected KWH") + super().__init__(coordinator, config, account, "Projected") @property def state(self): - return self.getData("projectedKWH") + try: + self._state = self.getData("projectedKWH") + except: + pass + return self._state +<<<<<<< HEAD class DailyAverageKWHSensor(FplEnergyEntity): +======= + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Projected KWH" + attributes["device_class"] = "energy" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "kWh" + return attributes + + +class DailyAverageKWHSensor(FplEntity): +>>>>>>> master def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Daily Average KWH") + super().__init__(coordinator, config, account, "Daily Average") @property def state(self): - return self.getData("dailyAverageKWH") + try: + self._state = self.getData("dailyAverageKWH") + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:flash" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Daily Average" + attributes["device_class"] = "energy" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "kWh" + return attributes + +>>>>>>> master class BillToDateKWHSensor(FplEnergyEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Bill To Date KWH") + super().__init__(coordinator, config, account, "Bill To Date") @property def state(self): - return self.getData("billToDateKWH") + try: + self._state = self.getData("billToDateKWH") + except: + pass + return self._state @property def state_class(self) -> str: """Return the state class of this entity, from STATE_CLASSES, if any.""" +<<<<<<< HEAD class NetReceivedKWHSensor(FplEnergyEntity): +======= + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Billing Usage" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if self.getData("billStartDate") is not None: + attributes["last_reset"] = self.getData("billStartDate") + return attributes + + +class NetReceivedKWHSensor(FplEntity): +>>>>>>> master def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Received Meter Reading KWH") + super().__init__(coordinator, config, account, "Received Reading") @property def state(self): - return self.getData("recMtrReading") + try: + self._state = self.getData("recMtrReading") + except: + pass + return self._state @property def icon(self): return "mdi:flash" +<<<<<<< HEAD class NetDeliveredKWHSensor(FplEnergyEntity): +======= + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Meter Return to Grid" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if self.getData("billStartDate") is not None: + attributes["last_reset"] = self.getData("billStartDate") + + return attributes + + +class NetDeliveredKWHSensor(FplEntity): +>>>>>>> master def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Delivered Meter Reading KWH") + super().__init__(coordinator, config, account, "Delivered Reading") @property def state(self): - return self.getData("delMtrReading") + try: + self._state = self.getData("delMtrReading") + except: + try: + self._state = self.getData("billToDateKWH") + except: + pass + return self._state @property def icon(self): return "mdi:flash" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Meter Consumption" + attributes["device_class"] = "energy" + attributes["state_class"] = "total_increasing" + attributes["unit_of_measurement"] = "kWh" + if self.getData("billStartDate") is not None: + attributes["last_reset"] = self.getData("billStartDate") + + return attributes diff --git a/custom_components/fpl/sensor_ProjectedBillSensor.py b/custom_components/fpl/sensor_ProjectedBillSensor.py index 7f6a515..35fc24f 100644 --- a/custom_components/fpl/sensor_ProjectedBillSensor.py +++ b/custom_components/fpl/sensor_ProjectedBillSensor.py @@ -10,34 +10,55 @@ class FplProjectedBillSensor(FplMoneyEntity): budget = self.getData("budget_bill") budget_billing_projected_bill = self.getData("budget_billing_projected_bill") - if budget == True and budget_billing_projected_bill is not None: - return self.getData("budget_billing_projected_bill") - - return self.getData("projected_bill") + try: + if budget == True and budget_billing_projected_bill is not None: + self._state = self.getData("budget_billing_projected_bill") + else: + self._state = self.getData("projected_bill") + except: + self._state = None + return self._state def defineAttributes(self): """Return the state attributes.""" attributes = {} - try: - if self.getData("budget_bill") == True: - attributes["budget_bill"] = self.getData("budget_bill") - except: - pass - + attributes["friendly_name"] = "Projected Bill Payment Due" + attributes["device_class"] = "monetary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" return attributes # Defered Amount class DeferedAmountSensor(FplMoneyEntity): def __init__(self, coordinator, config, account): - super().__init__(coordinator, config, account, "Defered Amount") + super().__init__(coordinator, config, account, "Deferred Amount") @property def state(self): - if self.getData("budget_bill") == True: - return self.getData("defered_amount") - return 0 + try: + self._state = self.getData("deferred_amount") + except: + self._state = 0 + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Deferred Amount" + attributes["device_class"] = "monetary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + return attributes + +>>>>>>> master class ProjectedBudgetBillSensor(FplMoneyEntity): def __init__(self, coordinator, config, account): @@ -45,8 +66,28 @@ class ProjectedBudgetBillSensor(FplMoneyEntity): @property def state(self): - return self.getData("budget_billing_projected_bill") + try: + self._state = self.getData("budget_billing_projected_bill") + except: + pass + return self._state +<<<<<<< HEAD +======= + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Projected Budget Bill" + attributes["device_class"] = "monitary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + return attributes + +>>>>>>> master class ProjectedActualBillSensor(FplMoneyEntity): def __init__(self, coordinator, config, account): @@ -54,4 +95,26 @@ class ProjectedActualBillSensor(FplMoneyEntity): @property def state(self): +<<<<<<< HEAD return self.getData("projected_bill") +======= + try: + self._state = self.getData("projected_bill") + except: + pass + return self._state + + @property + def icon(self): + return "mdi:currency-usd" + + def defineAttributes(self): + """Return the state attributes.""" + attributes = {} + attributes["friendly_name"] = "Projected Actual Bill" + attributes["device_class"] = "monitary" + attributes["state_class"] = "total" + attributes["unit_of_measurement"] = "$" + + return attributes +>>>>>>> master diff --git a/hacs.json b/hacs.json index c1a4266..63a8870 100644 --- a/hacs.json +++ b/hacs.json @@ -1,8 +1,13 @@ { +<<<<<<< HEAD "name": "FPL", "country": "US", "domains": [ "sensor" ], "homeassistant": "2021.12.0" +======= + "name": "Hass Fpl", + "country": ["US"] +>>>>>>> master } \ No newline at end of file