Maintenance 2nd (#4106)
* Add link to docs * Fix link * Update line breaks * Update ordering * Align vera platofrm to only use add_devices (instead od add_devices_callback) * Remove line break * Use consts * Update ordering * Update ordering * Use const, create default name, use string formatting * Update ordering * Use const * Update import style * Update ordering and line breaks * update line breaks * Set default port * Set defaults and update ordering * Update ordering * Minor style updates * Update ordering, defaults, line breaks, and readability * Use constants * Add line breaks * use string formatting * Update line breaks * Update logger
This commit is contained in:
parent
e6ece4bf6d
commit
9f2aae1357
28 changed files with 272 additions and 271 deletions
|
@ -10,6 +10,8 @@ import voluptuous as vol
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM_METRIC, CONF_UNIT_SYSTEM_IMPERIAL)
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
|
||||
|
@ -29,19 +31,23 @@ CONF_GAS_CALORIFIC = 'gas_calorific'
|
|||
|
||||
CONF_GAS_TYPE = 'gas_type'
|
||||
|
||||
DEFAULT_CALORIFIC = 39.11
|
||||
DEFAULT_UNIT = 'kW'
|
||||
|
||||
ELEC_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_ELEC_SERIAL): cv.string,
|
||||
vol.Required(CONF_ELEC_SECRET): cv.string,
|
||||
})
|
||||
|
||||
GAS_TYPE_SCHEMA = vol.In(['imperial', 'metric'])
|
||||
GAS_TYPE_SCHEMA = vol.In([CONF_UNIT_SYSTEM_METRIC, CONF_UNIT_SYSTEM_IMPERIAL])
|
||||
|
||||
GAS_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_GAS_SERIAL): cv.string,
|
||||
vol.Required(CONF_GAS_SECRET): cv.string,
|
||||
vol.Optional(CONF_GAS_TYPE, default='metric'):
|
||||
vol.Optional(CONF_GAS_TYPE, default=CONF_UNIT_SYSTEM_METRIC):
|
||||
GAS_TYPE_SCHEMA,
|
||||
vol.Optional(CONF_GAS_CALORIFIC, default=39.11): vol.Coerce(float)
|
||||
vol.Optional(CONF_GAS_CALORIFIC, default=DEFAULT_CALORIFIC):
|
||||
vol.Coerce(float)
|
||||
})
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
|
@ -92,7 +98,7 @@ class LoopEnergyDevice(Entity):
|
|||
def __init__(self, controller):
|
||||
"""Initialize the sensor."""
|
||||
self._state = None
|
||||
self._unit_of_measurement = 'kW'
|
||||
self._unit_of_measurement = DEFAULT_UNIT
|
||||
self._controller = controller
|
||||
self._name = None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue