Bump screenlogicpy to 0.6.2 (#85725)

fixes undefined
This commit is contained in:
Kevin Worrel 2023-01-12 13:41:07 -05:00 committed by GitHub
parent 596f779254
commit 4f20b15742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 59 additions and 11 deletions

View File

@ -240,10 +240,12 @@ class ScreenlogicEntity(CoordinatorEntity[ScreenlogicDataUpdateCoordinator]):
class ScreenLogicCircuitEntity(ScreenlogicEntity):
"""ScreenLogic circuit entity."""
_attr_has_entity_name = True
@property
def name(self):
"""Get the name of the switch."""
return f"{self.gateway_name} {self.circuit['name']}"
return self.circuit["name"]
@property
def is_on(self) -> bool:

View File

@ -7,6 +7,7 @@ from homeassistant.components.binary_sensor import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ScreenlogicEntity
@ -64,10 +65,13 @@ async def async_setup_entry(
class ScreenLogicBinarySensor(ScreenlogicEntity, BinarySensorEntity):
"""Representation of the basic ScreenLogic binary sensor entity."""
_attr_has_entity_name = True
_attr_entity_category = EntityCategory.DIAGNOSTIC
@property
def name(self):
"""Return the sensor name."""
return f"{self.gateway_name} {self.sensor['name']}"
return self.sensor["name"]
@property
def device_class(self):

View File

@ -51,6 +51,8 @@ async def async_setup_entry(
class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
"""Represents a ScreenLogic climate entity."""
_attr_has_entity_name = True
_attr_hvac_modes = SUPPORTED_MODES
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
@ -71,8 +73,7 @@ class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
@property
def name(self) -> str:
"""Name of the heater."""
ent_name = self.body["heat_status"]["name"]
return f"{self.gateway_name} {ent_name}"
return self.body["heat_status"]["name"]
@property
def min_temp(self) -> float:

View File

@ -20,4 +20,5 @@ async def async_get_config_entry_diagnostics(
return {
"config_entry": config_entry.as_dict(),
"data": coordinator.data,
"debug": coordinator.gateway.get_debug(),
}

View File

@ -3,7 +3,7 @@
"name": "Pentair ScreenLogic",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/screenlogic",
"requirements": ["screenlogicpy==0.5.4"],
"requirements": ["screenlogicpy==0.6.2"],
"codeowners": ["@dieselrabbit", "@bdraco"],
"dhcp": [
{ "registered_devices": true },

View File

@ -6,6 +6,7 @@ from screenlogicpy.const import BODY_TYPE, DATA as SL_DATA, EQUIPMENT, SCG
from homeassistant.components.number import NumberEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ScreenlogicEntity
@ -42,13 +43,16 @@ async def async_setup_entry(
class ScreenLogicNumber(ScreenlogicEntity, NumberEntity):
"""Class to represent a ScreenLogic Number."""
_attr_has_entity_name = True
def __init__(self, coordinator, data_key, enabled=True):
"""Initialize of the entity."""
super().__init__(coordinator, data_key, enabled)
self._body_type = SUPPORTED_SCG_NUMBERS.index(self._data_key)
self._attr_native_max_value = SCG.LIMIT_FOR_BODY[self._body_type]
self._attr_name = f"{self.gateway_name} {self.sensor['name']}"
self._attr_name = self.sensor["name"]
self._attr_native_unit_of_measurement = self.sensor["unit"]
self._attr_entity_category = EntityCategory.CONFIG
@property
def native_value(self) -> float:

View File

@ -4,6 +4,7 @@ from screenlogicpy.const import (
DATA as SL_DATA,
DEVICE_TYPE,
EQUIPMENT,
UNIT,
)
from homeassistant.components.sensor import (
@ -12,7 +13,17 @@ from homeassistant.components.sensor import (
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
PERCENTAGE,
REVOLUTIONS_PER_MINUTE,
UnitOfElectricPotential,
UnitOfPower,
UnitOfTemperature,
UnitOfTime,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ScreenlogicEntity
@ -56,8 +67,23 @@ SUPPORTED_SCG_SENSORS = (
SUPPORTED_PUMP_SENSORS = ("currentWatts", "currentRPM", "currentGPM")
SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = {
DEVICE_TYPE.TEMPERATURE: SensorDeviceClass.TEMPERATURE,
DEVICE_TYPE.DURATION: SensorDeviceClass.DURATION,
DEVICE_TYPE.ENERGY: SensorDeviceClass.POWER,
DEVICE_TYPE.POWER: SensorDeviceClass.POWER,
DEVICE_TYPE.TEMPERATURE: SensorDeviceClass.TEMPERATURE,
DEVICE_TYPE.VOLUME: SensorDeviceClass.VOLUME,
}
SL_UNIT_TO_HA_UNIT = {
UNIT.CELSIUS: UnitOfTemperature.CELSIUS,
UNIT.FAHRENHEIT: UnitOfTemperature.FAHRENHEIT,
UNIT.MILLIVOLT: UnitOfElectricPotential.MILLIVOLT,
UNIT.WATT: UnitOfPower.WATT,
UNIT.HOUR: UnitOfTime.HOURS,
UNIT.SECOND: UnitOfTime.SECONDS,
UNIT.REVOLUTIONS_PER_MINUTE: REVOLUTIONS_PER_MINUTE,
UNIT.PARTS_PER_MILLION: CONCENTRATION_PARTS_PER_MILLION,
UNIT.PERCENT: PERCENTAGE,
}
@ -129,15 +155,18 @@ async def async_setup_entry(
class ScreenLogicSensor(ScreenlogicEntity, SensorEntity):
"""Representation of the basic ScreenLogic sensor entity."""
_attr_has_entity_name = True
@property
def name(self):
"""Name of the sensor."""
return f"{self.gateway_name} {self.sensor['name']}"
return self.sensor["name"]
@property
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self.sensor.get("unit")
sl_unit = self.sensor.get("unit")
return SL_UNIT_TO_HA_UNIT.get(sl_unit, sl_unit)
@property
def device_class(self):
@ -145,6 +174,13 @@ class ScreenLogicSensor(ScreenlogicEntity, SensorEntity):
device_type = self.sensor.get("device_type")
return SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS.get(device_type)
@property
def entity_category(self):
"""Entity Category of the sensor."""
return (
None if self._data_key == "air_temperature" else EntityCategory.DIAGNOSTIC
)
@property
def state_class(self):
"""Return the state class of the sensor."""

View File

@ -2278,7 +2278,7 @@ satel_integra==0.3.7
scapy==2.5.0
# homeassistant.components.screenlogic
screenlogicpy==0.5.4
screenlogicpy==0.6.2
# homeassistant.components.scsgate
scsgate==0.1.0

View File

@ -1599,7 +1599,7 @@ samsungtvws[async,encrypted]==2.5.0
scapy==2.5.0
# homeassistant.components.screenlogic
screenlogicpy==0.5.4
screenlogicpy==0.6.2
# homeassistant.components.backup
securetar==2022.2.0