Use library data to map state class for ScreenLogic (#87649)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Kevin Worrel 2023-02-07 12:13:06 -08:00 committed by GitHub
parent e84a11963e
commit c505975940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 7 deletions

View file

@ -35,7 +35,6 @@ async def async_setup_entry(
config_entry.entry_id
]
gateway_data = coordinator.gateway_data
chemistry = gateway_data[SL_DATA.KEY_CHEMISTRY]
config = gateway_data[SL_DATA.KEY_CONFIG]
# Generic binary sensor
@ -52,6 +51,7 @@ async def async_setup_entry(
)
if config["equipment_flags"] & EQUIPMENT.FLAG_INTELLICHEM:
chemistry = gateway_data[SL_DATA.KEY_CHEMISTRY]
# IntelliChem alarm sensors
entities.extend(
[

View file

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

View file

@ -206,9 +206,7 @@ class ScreenLogicSensorEntity(ScreenlogicEntity, SensorEntity):
state_type = self.sensor.get("state_type")
if self._data_key == "scg_super_chlor_timer":
return None
return SL_STATE_TYPE_TO_HA_STATE_CLASS.get(
state_type, SensorStateClass.MEASUREMENT
)
return SL_STATE_TYPE_TO_HA_STATE_CLASS.get(state_type)
@property
def options(self) -> list[str] | None:

View file

@ -2297,7 +2297,7 @@ satel_integra==0.3.7
scapy==2.5.0
# homeassistant.components.screenlogic
screenlogicpy==0.7.0
screenlogicpy==0.7.1
# homeassistant.components.scsgate
scsgate==0.1.0

View file

@ -1618,7 +1618,7 @@ samsungtvws[async,encrypted]==2.5.0
scapy==2.5.0
# homeassistant.components.screenlogic
screenlogicpy==0.7.0
screenlogicpy==0.7.1
# homeassistant.components.backup
securetar==2022.2.0