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

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