From f4b125357be7d861fde89b5e91ec6e5778592b24 Mon Sep 17 00:00:00 2001 From: Yordan Suarez Date: Mon, 9 Aug 2021 23:21:07 -0400 Subject: [PATCH] Removed some unnecessary files --- .github/settings.yml | 23 ------ custom_components/fpl/FplSensor.py | 68 --------------- custom_components/fpl/sensor.old.py | 123 ---------------------------- 3 files changed, 214 deletions(-) delete mode 100644 .github/settings.yml delete mode 100644 custom_components/fpl/FplSensor.py delete mode 100644 custom_components/fpl/sensor.old.py diff --git a/.github/settings.yml b/.github/settings.yml deleted file mode 100644 index 717c121..0000000 --- a/.github/settings.yml +++ /dev/null @@ -1,23 +0,0 @@ -repository: - private: false - has_issues: true - has_projects: false - has_wiki: false - has_downloads: false - default_branch: master - allow_squash_merge: true - allow_merge_commit: false - allow_rebase_merge: false -labels: - - name: "Feature Request" - color: "fbca04" - - name: "Bug" - color: "b60205" - - name: "Wont Fix" - color: "ffffff" - - name: "Enhancement" - color: a2eeef - - name: "Documentation" - color: "008672" - - name: "Stale" - color: "930191" \ No newline at end of file diff --git a/custom_components/fpl/FplSensor.py b/custom_components/fpl/FplSensor.py deleted file mode 100644 index d6639a8..0000000 --- a/custom_components/fpl/FplSensor.py +++ /dev/null @@ -1,68 +0,0 @@ -from homeassistant.helpers.entity import Entity -from homeassistant import util -from .const import DOMAIN, DOMAIN_DATA, ATTRIBUTION -from datetime import timedelta - -MIN_TIME_BETWEEN_SCANS = timedelta(minutes=30) -MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=60) - - -class FplSensor(Entity): - def __init__(self, hass, config, account, sensorName): - self._config = config - self._state = None - self.loop = hass.loop - - self._account = account - self.attr = {} - self.data = None - self.sensorName = sensorName - - @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_UPDATES) - async def async_update(self): - """Update the sensor.""" - # Send update "signal" to the component - # await self.hass.data[DOMAIN_DATA]["client"].update_data() - - # Get new data (if any) - if "data" in self.hass.data[DOMAIN_DATA]: - self.data = self.hass.data[DOMAIN_DATA]["data"][self._account] - - # Set/update attributes - self.attr["attribution"] = ATTRIBUTION - - async def async_added_to_hass(self): - await self.async_update() - - @property - def device_info(self): - return { - "identifiers": {(DOMAIN, self._account)}, - "name": f"Account {self._account}", - "manufacturer": "Florida Power & Light", - } - - @property - def unique_id(self): - """Return the ID of this device.""" - id = "{}{}{}".format( - DOMAIN, self._account, self.sensorName.lower().replace(" ", "") - ) - return id - - @property - def name(self): - return f"{DOMAIN.upper()} {self._account} {self.sensorName}" - - @property - def state(self): - return self._state - - @property - def icon(self): - return "mdi:flash" - - @property - def device_state_attributes(self): - """Return the state attributes.""" - return self.attr \ No newline at end of file diff --git a/custom_components/fpl/sensor.old.py b/custom_components/fpl/sensor.old.py deleted file mode 100644 index 5d3a7e8..0000000 --- a/custom_components/fpl/sensor.old.py +++ /dev/null @@ -1,123 +0,0 @@ -import logging -from datetime import datetime, timedelta -from .fplapi import FplApi -import aiohttp -import asyncio -from homeassistant.helpers.entity import Entity -from homeassistant import util -from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers.event import async_call_later - -from homeassistant.const import ( - CONF_NAME, - EVENT_CORE_CONFIG_UPDATE, - STATE_UNKNOWN, - CONF_USERNAME, - CONF_PASSWORD, - STATE_UNKNOWN, - ATTR_FRIENDLY_NAME, -) -from .const import DOMAIN, DOMAIN_DATA, ATTRIBUTION -from .DailyUsageSensor import FplDailyUsageSensor -from .AverageDailySensor import FplAverageDailySensor -from .ProjectedBillSensor import FplProjectedBillSensor - -_LOGGER = logging.getLogger(__name__) - -MIN_TIME_BETWEEN_SCANS = timedelta(minutes=30) -MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=60) - - -def setup(hass, config): - return True - - -async def async_setup_entry(hass, config_entry, async_add_entities): - try: - accounts = config_entry.data.get("accounts") - - fpl_accounts = [] - - for account in accounts: - _LOGGER.info(f"Adding fpl account: {account}") - fpl_accounts.append(FplSensor(hass, config_entry.data, account)) - fpl_accounts.append(FplDailyUsageSensor(hass, config_entry.data, account)) - fpl_accounts.append(FplAverageDailySensor(hass, config_entry.data, account)) - fpl_accounts.append( - FplProjectedBillSensor(hass, config_entry.data, account) - ) - - async_add_entities(fpl_accounts) - except: - raise ConfigEntryNotReady - - -class FplSensor(Entity): - def __init__(self, hass, config, account): - self._config = config - self._state = None - self.loop = hass.loop - - self._account = account - self._data = None - - async def async_added_to_hass(self): - await self.async_update() - - @property - def device_info(self): - return { - "identifiers": {(DOMAIN, self._account)}, - "name": f"Account {self._account}", - "manufacturer": "Florida Power & Light", - } - - @property - def unique_id(self): - """Return the ID of this device.""" - id = "{}{}".format(DOMAIN, self._account) - return id - - @property - def name(self): - return f"{DOMAIN.upper()} {self._account}" - - @property - def state(self): - data = self._data - - if type(data) is dict: - 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"] - - return self._state - - # @property - # def unit_of_measurement(self): - # return "$" - - @property - def icon(self): - return "mdi:flash" - - @property - def state_attributes(self): - return self._data - - @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_UPDATES) - async def async_update(self): - # Send update "signal" to the component - # await self.hass.data[DOMAIN_DATA]["client"].update_data() - - # Get new data (if any) - if "data" in self.hass.data[DOMAIN_DATA]: - data = self.hass.data[DOMAIN_DATA]["data"][self._account] - - if data != {}: - self._data = data - self._data["attribution"] = ATTRIBUTION \ No newline at end of file