Action commit

This commit is contained in:
ludeeus
2019-03-08 18:25:29 +00:00
parent ad2e54a710
commit bf3dab8782
3 changed files with 17 additions and 13 deletions

View File

@ -11,10 +11,11 @@ from homeassistant.helpers import discovery
from .const import * # pylint: disable=wildcard-import
VERSION = '0.0.1'
VERSION = "0.0.1"
_LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument
# pylint: disable=unused-argument
async def async_setup(hass, config):
"""Set up this component."""
@ -34,7 +35,8 @@ async def async_setup(hass, config):
# Load platforms
for platform in PLATFORMS:
hass.async_create_task(
discovery.async_load_platform(hass, platform, DOMAIN, {}, config))
discovery.async_load_platform(hass, platform, DOMAIN, {}, config)
)
return True

View File

@ -1,11 +1,11 @@
"""Consts"""
DOMAIN = 'blueprint'
DOMAIN_DATA = '{}_data'.format(DOMAIN)
VERSION = '0.0.1'
URL = 'https://blueprint.com/api'
REQUIRED_FILES = ['sensor.py', 'const.py']
ISSUE_URL = 'https://github.com/custom-components/blueprint/issues'
PLATFORMS = ['sensor']
DOMAIN = "blueprint"
DOMAIN_DATA = "{}_data".format(DOMAIN)
VERSION = "0.0.1"
URL = "https://blueprint.com/api"
REQUIRED_FILES = ["sensor.py", "const.py"]
ISSUE_URL = "https://github.com/custom-components/blueprint/issues"
PLATFORMS = ["sensor"]
STARTUP = """
----------------------------------------------

View File

@ -3,17 +3,19 @@ from homeassistant.helpers.entity import Entity
from . import update_data
from .const import * # pylint: disable=wildcard-import, unused-wildcard-import
ICON = 'mdi:format-quote-close'
ICON = "mdi:format-quote-close"
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None): # pylint: disable=unused-argument
hass, config, async_add_entities, discovery_info=None
): # pylint: disable=unused-argument
"""Setup sensor platform."""
async_add_entities([blueprintSensor(hass)], True)
class blueprintSensor(Entity):
"""blueprint Sensor class."""
def __init__(self, hass):
self.hass = hass
self._state = None
@ -21,7 +23,7 @@ class blueprintSensor(Entity):
async def async_update(self):
"""Update the sensor."""
await update_data(self.hass)
updated = self.hass.data[DOMAIN_DATA].get('compliment')
updated = self.hass.data[DOMAIN_DATA].get("compliment")
if updated is None:
updated = self._state
self._state = updated.capitalize()