Removed some unnecessary files

This commit is contained in:
Yordan Suarez
2021-08-09 23:21:07 -04:00
parent 2cb7f604c1
commit f4b125357b
3 changed files with 0 additions and 214 deletions

23
.github/settings.yml vendored
View File

@@ -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"

View File

@@ -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

View File

@@ -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