Skip to content

Commit 8f72fdf

Browse files
Move slab setpoint checks into available property
1 parent 5d96bb2 commit 8f72fdf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

custom_components/tekmar_482/number.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ async def async_setup_entry(
3434
else:
3535
entities.append(ThaHeatSetpoint(device, config_entry))
3636
entities.append(ThaCoolSetpoint(device, config_entry))
37-
if device.tha_device["attributes"].Slab_Setpoint:
38-
entities.append(ThaSlabSetpoint(device, config_entry))
37+
entities.append(ThaSlabSetpoint(device, config_entry))
3938

4039
if DEVICE_FEATURES[device.tha_device["type"]]["humid"]:
4140
entities.append(ThaHumiditySetMax(device, config_entry))
@@ -514,13 +513,15 @@ def name(self) -> str:
514513

515514
@property
516515
def available(self) -> bool:
517-
if (
518-
self._tekmar_tha.slab_setpoint == ThaValue.NA_8
519-
or not self._tekmar_tha.tha_device["attributes"].Slab_Setpoint
520-
):
521-
return False
516+
return (
517+
self._tekmar_tha.slab_setpoint != ThaValue.NA_8
518+
and self._tekmar_tha.tha_device["attributes"].Slab_Setpoint
519+
and super().available
520+
)
522521

523-
return super().available
522+
@property
523+
def entity_registry_enabled_default(self) -> bool:
524+
return self._tekmar_tha.tha_device["attributes"].Slab_Setpoint
524525

525526
@property
526527
def native_value(self):

0 commit comments

Comments
 (0)