diff --git a/.coveragerc b/.coveragerc index 0f4c8d68d22..8d26873b7af 100644 --- a/.coveragerc +++ b/.coveragerc @@ -600,7 +600,6 @@ omit = homeassistant/components/lookin/models.py homeassistant/components/lookin/sensor.py homeassistant/components/lookin/climate.py - homeassistant/components/loopenergy/sensor.py homeassistant/components/luci/device_tracker.py homeassistant/components/luftdaten/__init__.py homeassistant/components/luftdaten/sensor.py diff --git a/CODEOWNERS b/CODEOWNERS index a349954bf65..109cb234734 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -294,7 +294,6 @@ homeassistant/components/local_ip/* @issacg homeassistant/components/logger/* @home-assistant/core homeassistant/components/logi_circle/* @evanjd homeassistant/components/lookin/* @ANMalko -homeassistant/components/loopenergy/* @pavoni homeassistant/components/lovelace/* @home-assistant/frontend homeassistant/components/luci/* @mzdrale homeassistant/components/luftdaten/* @fabaff diff --git a/homeassistant/components/loopenergy/__init__.py b/homeassistant/components/loopenergy/__init__.py deleted file mode 100644 index 4e963f2828a..00000000000 --- a/homeassistant/components/loopenergy/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The loopenergy component.""" diff --git a/homeassistant/components/loopenergy/manifest.json b/homeassistant/components/loopenergy/manifest.json deleted file mode 100644 index 01a18dc01db..00000000000 --- a/homeassistant/components/loopenergy/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "domain": "loopenergy", - "name": "Loop Energy", - "documentation": "https://www.home-assistant.io/integrations/loopenergy", - "requirements": ["pyloopenergy==0.2.1"], - "codeowners": ["@pavoni"], - "iot_class": "cloud_push" -} diff --git a/homeassistant/components/loopenergy/sensor.py b/homeassistant/components/loopenergy/sensor.py deleted file mode 100644 index 05d7f79ebfd..00000000000 --- a/homeassistant/components/loopenergy/sensor.py +++ /dev/null @@ -1,149 +0,0 @@ -"""Support for Loop Energy sensors.""" -import logging - -import pyloopenergy -import voluptuous as vol - -from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity -from homeassistant.const import ( - CONF_UNIT_SYSTEM_IMPERIAL, - CONF_UNIT_SYSTEM_METRIC, - EVENT_HOMEASSISTANT_STOP, -) -import homeassistant.helpers.config_validation as cv - -_LOGGER = logging.getLogger(__name__) - -CONF_ELEC = "electricity" -CONF_GAS = "gas" - -CONF_ELEC_SERIAL = "electricity_serial" -CONF_ELEC_SECRET = "electricity_secret" - -CONF_GAS_SERIAL = "gas_serial" -CONF_GAS_SECRET = "gas_secret" -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([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=CONF_UNIT_SYSTEM_METRIC): GAS_TYPE_SCHEMA, - vol.Optional(CONF_GAS_CALORIFIC, default=DEFAULT_CALORIFIC): vol.Coerce(float), - } -) - -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - {vol.Required(CONF_ELEC): ELEC_SCHEMA, vol.Optional(CONF_GAS): GAS_SCHEMA} -) - - -def setup_platform(hass, config, add_entities, discovery_info=None): - """Set up the Loop Energy sensors.""" - elec_config = config.get(CONF_ELEC) - gas_config = config.get(CONF_GAS, {}) - - controller = pyloopenergy.LoopEnergy( - elec_config.get(CONF_ELEC_SERIAL), - elec_config.get(CONF_ELEC_SECRET), - gas_config.get(CONF_GAS_SERIAL), - gas_config.get(CONF_GAS_SECRET), - gas_config.get(CONF_GAS_TYPE), - gas_config.get(CONF_GAS_CALORIFIC), - ) - - def stop_loopenergy(event): - """Shutdown loopenergy thread on exit.""" - _LOGGER.info("Shutting down loopenergy") - controller.terminate() - - hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_loopenergy) - - sensors = [LoopEnergyElec(controller)] - - if gas_config.get(CONF_GAS_SERIAL): - sensors.append(LoopEnergyGas(controller)) - - add_entities(sensors) - - -class LoopEnergySensor(SensorEntity): - """Implementation of an Loop Energy base sensor.""" - - def __init__(self, controller): - """Initialize the sensor.""" - self._state = None - self._unit_of_measurement = DEFAULT_UNIT - self._controller = controller - self._name = None - - @property - def name(self): - """Return the name of the sensor.""" - return self._name - - @property - def native_value(self): - """Return the state of the sensor.""" - return self._state - - @property - def should_poll(self): - """No polling needed.""" - return False - - @property - def native_unit_of_measurement(self): - """Return the unit of measurement of this entity, if any.""" - return self._unit_of_measurement - - def _callback(self): - self.schedule_update_ha_state(True) - - -class LoopEnergyElec(LoopEnergySensor): - """Implementation of an Loop Energy Electricity sensor.""" - - def __init__(self, controller): - """Initialize the sensor.""" - super().__init__(controller) - self._name = "Power Usage" - - async def async_added_to_hass(self): - """Subscribe to updates.""" - self._controller.subscribe_elecricity(self._callback) - - def update(self): - """Get the cached Loop energy reading.""" - self._state = round(self._controller.electricity_useage, 2) - - -class LoopEnergyGas(LoopEnergySensor): - """Implementation of an Loop Energy Gas sensor.""" - - def __init__(self, controller): - """Initialize the sensor.""" - super().__init__(controller) - self._name = "Gas Usage" - - async def async_added_to_hass(self): - """Subscribe to updates.""" - self._controller.subscribe_gas(self._callback) - - def update(self): - """Get the cached Loop gas reading.""" - self._state = round(self._controller.gas_useage, 2) diff --git a/requirements_all.txt b/requirements_all.txt index 4668f970b75..d7d0e76af01 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1612,9 +1612,6 @@ pylitejet==0.3.0 # homeassistant.components.litterrobot pylitterbot==2021.11.0 -# homeassistant.components.loopenergy -pyloopenergy==0.2.1 - # homeassistant.components.lutron_caseta pylutron-caseta==0.11.0