diff --git a/custom_components/intellicenter/binary_sensor.py b/custom_components/intellicenter/binary_sensor.py index d8f3226..3511070 100644 --- a/custom_components/intellicenter/binary_sensor.py +++ b/custom_components/intellicenter/binary_sensor.py @@ -29,39 +29,39 @@ async def async_setup_entry( sensors = [] - object: PoolObject - for object in controller.model.objectList: - if object.objtype == CIRCUIT_TYPE and object.subtype == "FRZ": + obj: PoolObject + for obj in controller.model.objectList: + if obj.objtype == CIRCUIT_TYPE and obj.subtype == "FRZ": sensors.append( PoolBinarySensor( entry, controller, - object, + obj, icon = "mdi:snowflake" ) ) - elif object.objtype == HEATER_TYPE: + elif obj.objtype == HEATER_TYPE: sensors.append( HeaterBinarySensor( entry, controller, - object, + obj, ) ) - elif object.objtype == "SCHED": + elif obj.objtype == "SCHED": sensors.append( PoolBinarySensor( entry, controller, - object, + obj, attribute_key="ACT", name="+ (schedule)", enabled_by_default=False, extraStateAttributes={"VACFLO"}, ) ) - elif object.objtype == "PUMP": - sensors.append(PoolBinarySensor(entry, controller, object, valueForON="10")) + elif obj.objtype == "PUMP": + sensors.append(PoolBinarySensor(entry, controller, obj, valueForON="10")) async_add_entities(sensors) diff --git a/custom_components/intellicenter/light.py b/custom_components/intellicenter/light.py index 8d3b932..b77336a 100644 --- a/custom_components/intellicenter/light.py +++ b/custom_components/intellicenter/light.py @@ -50,28 +50,28 @@ async def async_setup_entry( lights = [] - object: PoolObject - for object in controller.model.objectList: - if object.isALight: + obj: PoolObject + for obj in controller.model.objectList: + if obj.isALight: lights.append( PoolLight( entry, controller, - object, - LIGHTS_EFFECTS if object.supportColorEffects else None, + obj, + LIGHTS_EFFECTS if obj.supportColorEffects else None, ) ) - elif object.isALightShow: + elif obj.isALightShow: supportColorEffects = reduce( lambda x, y: x and y, - (controller.model[obj[CIRCUIT_ATTR]].supportColorEffects for obj in controller.model.getChildren(object)), + (controller.model[obj[CIRCUIT_ATTR]].supportColorEffects for obj in controller.model.getChildren(obj)), True, ) lights.append( PoolLight( entry, controller, - object, + obj, LIGHTS_EFFECTS if supportColorEffects else None, ) ) diff --git a/custom_components/intellicenter/number.py b/custom_components/intellicenter/number.py index cfefd4c..78bb5ab 100644 --- a/custom_components/intellicenter/number.py +++ b/custom_components/intellicenter/number.py @@ -38,15 +38,15 @@ async def async_setup_entry( numbers = [] - object: PoolObject - for object in controller.model.objectList: + obj: PoolObject + for obj in controller.model.objectList: if ( - object.objtype == CHEM_TYPE - and object.subtype == "ICHLOR" - and PRIM_ATTR in object.attributes + obj.objtype == CHEM_TYPE + and obj.subtype == "ICHLOR" + and PRIM_ATTR in obj.attributes ): bodies = controller.model.getByType(BODY_TYPE) - intellichlor_bodies = object[BODY_ATTR].split(" ") + intellichlor_bodies = obj[BODY_ATTR].split(" ") body: PoolObject for body in bodies: @@ -62,7 +62,7 @@ async def async_setup_entry( entry, controller, # body, - object, + obj, unit_of_measurement=PERCENTAGE, attribute_key=attribute_key, name=f"+ Output % ({body.sname})", diff --git a/custom_components/intellicenter/sensor.py b/custom_components/intellicenter/sensor.py index 19ae15c..a273d23 100644 --- a/custom_components/intellicenter/sensor.py +++ b/custom_components/intellicenter/sensor.py @@ -49,25 +49,25 @@ async def async_setup_entry( sensors = [] - object: PoolObject - for object in controller.model.objectList: - if object.objtype == SENSE_TYPE: + obj: PoolObject + for obj in controller.model.objectList: + if obj.objtype == SENSE_TYPE: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=SensorDeviceClass.TEMPERATURE, attribute_key=SOURCE_ATTR, ) ) - elif object.objtype == PUMP_TYPE: - if object[PWR_ATTR]: + elif obj.objtype == PUMP_TYPE: + if obj[PWR_ATTR]: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=SensorDeviceClass.POWER, unit_of_measurement=UnitOfPower.WATT, attribute_key=PWR_ATTR, @@ -75,36 +75,36 @@ async def async_setup_entry( rounding_factor=25, ) ) - if object[RPM_ATTR]: + if obj[RPM_ATTR]: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, unit_of_measurement=CONST_RPM, attribute_key=RPM_ATTR, name="+ rpm", ) ) - if object[GPM_ATTR]: + if obj[GPM_ATTR]: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, unit_of_measurement=CONST_GPM, attribute_key=GPM_ATTR, name="+ gpm", ) ) - elif object.objtype == BODY_TYPE: + elif obj.objtype == BODY_TYPE: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=SensorDeviceClass.TEMPERATURE, attribute_key=LSTTMP_ATTR, name="+ last temp", @@ -114,76 +114,76 @@ async def async_setup_entry( PoolSensor( entry, controller, - object, + obj, device_class=SensorDeviceClass.TEMPERATURE, attribute_key=LOTMP_ATTR, name="+ desired temp", ) ) - elif object.objtype == CHEM_TYPE: - if object.subtype == "ICHEM": - if PHVAL_ATTR in object.attributes: + elif obj.objtype == CHEM_TYPE: + if obj.subtype == "ICHEM": + if PHVAL_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, attribute_key=PHVAL_ATTR, name="+ (pH)", ) ) - if ORPVAL_ATTR in object.attributes: + if ORPVAL_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, attribute_key=ORPVAL_ATTR, name="+ (ORP)", ) ) - if QUALTY_ATTR in object.attributes: + if QUALTY_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, attribute_key=QUALTY_ATTR, name="+ (Water Quality)", ) ) - if PHTNK_ATTR in object.attributes: + if PHTNK_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, attribute_key=PHTNK_ATTR, name="+ (Ph Tank Level)", ) ) - if ORPTNK_ATTR in object.attributes: + if ORPTNK_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, attribute_key=ORPTNK_ATTR, name="+ (ORP Tank Level)", ) ) - elif object.subtype == "ICHLOR": - if SALT_ATTR in object.attributes: + elif obj.subtype == "ICHLOR": + if SALT_ATTR in obj.attributes: sensors.append( PoolSensor( entry, controller, - object, + obj, device_class=None, unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, attribute_key=SALT_ATTR, diff --git a/custom_components/intellicenter/switch.py b/custom_components/intellicenter/switch.py index 545405f..7a5dcff 100644 --- a/custom_components/intellicenter/switch.py +++ b/custom_components/intellicenter/switch.py @@ -36,44 +36,44 @@ async def async_setup_entry( switches = [] - object: PoolObject - for object in controller.model.objectList: - if object.objtype == BODY_TYPE: - switches.append(PoolBody(entry, controller, object)) + obj: PoolObject + for obj in controller.model.objectList: + if obj.objtype == BODY_TYPE: + switches.append(PoolBody(entry, controller, obj)) elif ( - object.objtype == CHEM_TYPE - and object.subtype == "ICHLOR" - and SUPER_ATTR in object.attributes + obj.objtype == CHEM_TYPE + and obj.subtype == "ICHLOR" + and SUPER_ATTR in obj.attributes ): switches.append( PoolCircuit( entry, controller, - object, + obj, attribute_key=SUPER_ATTR, name="+ Superchlorinate", icon="mdi:alpha-s-box-outline", ) ) elif ( - object.objtype == CIRCUIT_TYPE - and not (object.isALight or object.isALightShow) - and object.isFeatured + obj.objtype == CIRCUIT_TYPE + and not (obj.isALight or obj.isALightShow) + and obj.isFeatured ): switches.append( - PoolCircuit(entry, controller, object, icon="mdi:alpha-f-box-outline")) + PoolCircuit(entry, controller, obj, icon="mdi:alpha-f-box-outline")) elif ( - object.objtype == CIRCUIT_TYPE - and object.subtype == "CIRCGRP" + obj.objtype == CIRCUIT_TYPE + and obj.subtype == "CIRCGRP" ): switches.append( - PoolCircuit(entry, controller, object, icon="mdi:alpha-g-box-outline")) - elif object.objtype == SYSTEM_TYPE: + PoolCircuit(entry, controller, obj, icon="mdi:alpha-g-box-outline")) + elif obj.objtype == SYSTEM_TYPE: switches.append( PoolCircuit( entry, controller, - object, + obj, VACFLO_ATTR, name="Vacation mode", icon="mdi:palm-tree",