mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add support for imperial meter and user soecified calorific value.
This commit is contained in:
parent
37a28c799f
commit
31f061f4d3
@ -8,12 +8,13 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||||
|
from homeassistant.util import convert
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DOMAIN = "loopenergy"
|
DOMAIN = "loopenergy"
|
||||||
|
|
||||||
REQUIREMENTS = ['pyloopenergy==0.0.7']
|
REQUIREMENTS = ['pyloopenergy==0.0.10']
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
@ -24,6 +25,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
elec_secret = config.get('electricity_secret')
|
elec_secret = config.get('electricity_secret')
|
||||||
gas_serial = config.get('gas_serial')
|
gas_serial = config.get('gas_serial')
|
||||||
gas_secret = config.get('gas_secret')
|
gas_secret = config.get('gas_secret')
|
||||||
|
gas_type = config.get('gas_type', 'metric')
|
||||||
|
gas_calorific = convert(config.get('gas_calorific'), float, 39.11)
|
||||||
|
|
||||||
if not (elec_serial and elec_secret):
|
if not (elec_serial and elec_secret):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
@ -39,11 +42,20 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
"serial and secret tokens")
|
"serial and secret tokens")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if gas_type not in ['imperial', 'metric']:
|
||||||
|
_LOGGER.error(
|
||||||
|
"Configuration Error, 'gas_type' "
|
||||||
|
"can only be 'imperial' or 'metric' ")
|
||||||
|
return None
|
||||||
|
|
||||||
|
# pylint: disable=too-many-function-args
|
||||||
controller = pyloopenergy.LoopEnergy(
|
controller = pyloopenergy.LoopEnergy(
|
||||||
elec_serial,
|
elec_serial,
|
||||||
elec_secret,
|
elec_secret,
|
||||||
gas_serial,
|
gas_serial,
|
||||||
gas_secret
|
gas_secret,
|
||||||
|
gas_type,
|
||||||
|
gas_calorific
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop_loopenergy(event):
|
def stop_loopenergy(event):
|
||||||
|
@ -196,7 +196,7 @@ pyfttt==0.3
|
|||||||
pyicloud==0.7.2
|
pyicloud==0.7.2
|
||||||
|
|
||||||
# homeassistant.components.sensor.loopenergy
|
# homeassistant.components.sensor.loopenergy
|
||||||
pyloopenergy==0.0.7
|
pyloopenergy==0.0.10
|
||||||
|
|
||||||
# homeassistant.components.device_tracker.netgear
|
# homeassistant.components.device_tracker.netgear
|
||||||
pynetgear==0.3.3
|
pynetgear==0.3.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user