Don't create unsupported pump sensors (#51828)

* Don't create unsupported pump sensors

* Remove old code and simplify new statements.

* Address notes
This commit is contained in:
Kevin Worrel 2021-06-15 04:19:48 -07:00 committed by GitHub
parent c0d311473c
commit 515bd18ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,11 +68,17 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
# Pump sensors
for pump_num, pump_data in coordinator.data[SL_DATA.KEY_PUMPS].items():
if pump_data["data"] != 0 and "currentWatts" in pump_data:
entities.extend(
ScreenLogicPumpSensor(coordinator, pump_num, pump_key)
for pump_key in pump_data
if pump_key in SUPPORTED_PUMP_SENSORS
)
for pump_key in pump_data:
# Considerations for Intelliflow VF
if pump_data["pumpType"] == 1 and pump_key == "currentRPM":
continue
# Considerations for Intelliflow VS
if pump_data["pumpType"] == 2 and pump_key == "currentGPM":
continue
if pump_key in SUPPORTED_PUMP_SENSORS:
entities.append(
ScreenLogicPumpSensor(coordinator, pump_num, pump_key)
)
# IntelliChem sensors
if equipment_flags & EQUIPMENT.FLAG_INTELLICHEM: