mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove Plugwise Auxiliary sensors (#66259)
This commit is contained in:
parent
3896b4a31d
commit
51e14cebe3
@ -39,26 +39,10 @@ ZEROCONF_MAP = {
|
|||||||
# Default directives
|
# Default directives
|
||||||
DEFAULT_MAX_TEMP = 30
|
DEFAULT_MAX_TEMP = 30
|
||||||
DEFAULT_MIN_TEMP = 4
|
DEFAULT_MIN_TEMP = 4
|
||||||
DEFAULT_NAME = "Smile"
|
|
||||||
DEFAULT_PORT = 80
|
DEFAULT_PORT = 80
|
||||||
DEFAULT_SCAN_INTERVAL = {
|
DEFAULT_SCAN_INTERVAL = {
|
||||||
"power": timedelta(seconds=10),
|
"power": timedelta(seconds=10),
|
||||||
"stretch": timedelta(seconds=60),
|
"stretch": timedelta(seconds=60),
|
||||||
"thermostat": timedelta(seconds=60),
|
"thermostat": timedelta(seconds=60),
|
||||||
}
|
}
|
||||||
DEFAULT_TIMEOUT = 60
|
|
||||||
DEFAULT_USERNAME = "smile"
|
DEFAULT_USERNAME = "smile"
|
||||||
|
|
||||||
# Configuration directives
|
|
||||||
CONF_GAS = "gas"
|
|
||||||
CONF_MAX_TEMP = "max_temp"
|
|
||||||
CONF_MIN_TEMP = "min_temp"
|
|
||||||
CONF_POWER = "power"
|
|
||||||
CONF_THERMOSTAT = "thermostat"
|
|
||||||
|
|
||||||
# Icons
|
|
||||||
COOL_ICON = "mdi:snowflake"
|
|
||||||
FLAME_ICON = "mdi:fire"
|
|
||||||
FLOW_OFF_ICON = "mdi:water-pump-off"
|
|
||||||
FLOW_ON_ICON = "mdi:water-pump"
|
|
||||||
IDLE_ICON = "mdi:circle-off-outline"
|
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import COOL_ICON, DOMAIN, FLAME_ICON, IDLE_ICON, LOGGER, UNIT_LUMEN
|
from .const import DOMAIN, LOGGER, UNIT_LUMEN
|
||||||
from .coordinator import PlugwiseDataUpdateCoordinator
|
from .coordinator import PlugwiseDataUpdateCoordinator
|
||||||
from .entity import PlugwiseEntity
|
from .entity import PlugwiseEntity
|
||||||
|
|
||||||
@ -295,21 +295,6 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if coordinator.data.gateway["single_master_thermostat"] is False:
|
|
||||||
# These sensors should actually be binary sensors.
|
|
||||||
for description in INDICATE_ACTIVE_LOCAL_DEVICE_SENSORS:
|
|
||||||
if description.key not in device:
|
|
||||||
continue
|
|
||||||
|
|
||||||
entities.append(
|
|
||||||
PlugwiseAuxSensorEntity(
|
|
||||||
coordinator,
|
|
||||||
device_id,
|
|
||||||
description,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
break
|
|
||||||
|
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
@ -326,9 +311,7 @@ class PlugwiseSensorEnity(PlugwiseEntity, SensorEntity):
|
|||||||
super().__init__(coordinator, device_id)
|
super().__init__(coordinator, device_id)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_unique_id = f"{device_id}-{description.key}"
|
self._attr_unique_id = f"{device_id}-{description.key}"
|
||||||
self._attr_name = (
|
self._attr_name = (f"{self.device.get('name', '')} {description.name}").lstrip()
|
||||||
f"{coordinator.data.devices[device_id].get('name', '')} {description.name}"
|
|
||||||
).lstrip()
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
@ -340,34 +323,3 @@ class PlugwiseSensorEnity(PlugwiseEntity, SensorEntity):
|
|||||||
|
|
||||||
self._attr_native_value = data["sensors"].get(self.entity_description.key)
|
self._attr_native_value = data["sensors"].get(self.entity_description.key)
|
||||||
super()._handle_coordinator_update()
|
super()._handle_coordinator_update()
|
||||||
|
|
||||||
|
|
||||||
class PlugwiseAuxSensorEntity(PlugwiseSensorEnity):
|
|
||||||
"""Auxiliary Device Sensors."""
|
|
||||||
|
|
||||||
_cooling_state = False
|
|
||||||
_heating_state = False
|
|
||||||
|
|
||||||
@callback
|
|
||||||
def _handle_coordinator_update(self) -> None:
|
|
||||||
"""Handle updated data from the coordinator."""
|
|
||||||
if not (data := self.coordinator.data.devices.get(self._dev_id)):
|
|
||||||
LOGGER.error("Received no data for device %s", self._dev_id)
|
|
||||||
super()._handle_coordinator_update()
|
|
||||||
return
|
|
||||||
|
|
||||||
if data.get("heating_state") is not None:
|
|
||||||
self._heating_state = data["heating_state"]
|
|
||||||
if data.get("cooling_state") is not None:
|
|
||||||
self._cooling_state = data["cooling_state"]
|
|
||||||
|
|
||||||
self._attr_native_value = "idle"
|
|
||||||
self._attr_icon = IDLE_ICON
|
|
||||||
if self._heating_state:
|
|
||||||
self._attr_native_value = "heating"
|
|
||||||
self._attr_icon = FLAME_ICON
|
|
||||||
if self._cooling_state:
|
|
||||||
self._attr_native_value = "cooling"
|
|
||||||
self._attr_icon = COOL_ICON
|
|
||||||
|
|
||||||
super()._handle_coordinator_update()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user