diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 17c30952..26b9c601 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -546,7 +546,6 @@ class LuiPagesGen(object): device_class = entity.attributes.get("device_class", "window") icon_id = get_icon_id_ha(entityType, state=entity.state, device_class=device_class) - pos_translation = get_translation(self._locale, "frontend.ui.card.cover.position") pos = entity.attributes.get("current_position") if pos is None: pos_status = entity.state @@ -554,6 +553,7 @@ class LuiPagesGen(object): else: pos_status = pos + pos_translation = "" icon_up = "" icon_stop = "" icon_down = "" @@ -570,15 +570,19 @@ class LuiPagesGen(object): tilt_pos = "disable" bits = entity.attributes.supported_features + + # position supported + if bits & 0b00001111: + pos_translation = get_translation(self._locale, "frontend.ui.card.cover.position") if bits & 0b00000001: # SUPPORT_OPEN - icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class) - if pos != 100 and not (pos_status == "open" and pos == "disable"): + if pos != 100 and not (entity.state == "open" and pos == "disable"): icon_up_status = "enable" + icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class) if bits & 0b00000010: # SUPPORT_CLOSE - icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class) - if pos != 0 and not (pos_status == "closed" and pos == "disable"): + if pos != 0 and not (entity.state == "closed" and pos == "disable"): icon_down_status = "enable" - #if bits & 0b000000100: # SUPPORT_SET_POSITION + icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class) + #if bits & 0b00000100: # SUPPORT_SET_POSITION if bits & 0b00001000: # SUPPORT_STOP icon_stop = get_action_id_ha(ha_type=entityType, action="stop", device_class=device_class) icon_stop_status = "enable"