fix and improve assumed state

This commit is contained in:
Sylvain Garcia
2022-08-22 14:14:15 +02:00
committed by joBr99
parent 9e8c528f23
commit 33a345891a

View File

@@ -242,11 +242,11 @@ class LuiPagesGen(object):
else: else:
pos_status = pos pos_status = pos
if bits & 0b00000001: # SUPPORT_OPEN if bits & 0b00000001: # SUPPORT_OPEN
if pos != 100 and not (entity.state == "open" and pos == "disable") and not item.assumedState: if ( pos != 100 and not (entity.state == "open" and pos == "disable") ) or item.assumedState:
icon_up_status = "enable" icon_up_status = "enable"
icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class) icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class)
if bits & 0b00000010: # SUPPORT_CLOSE if bits & 0b00000010: # SUPPORT_CLOSE
if pos != 0 and not (entity.state == "closed" and pos == "disable") and not item.assumedState: if ( pos != 0 and not (entity.state == "closed" and pos == "disable") ) or item.assumedState:
icon_down_status = "enable" icon_down_status = "enable"
icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class) icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class)
if bits & 0b00001000: # SUPPORT_STOP if bits & 0b00001000: # SUPPORT_STOP
@@ -632,11 +632,11 @@ class LuiPagesGen(object):
if bits & 0b00001111: if bits & 0b00001111:
pos_translation = get_translation(self._locale, "frontend.ui.card.cover.position") pos_translation = get_translation(self._locale, "frontend.ui.card.cover.position")
if bits & 0b00000001: # SUPPORT_OPEN if bits & 0b00000001: # SUPPORT_OPEN
if pos != 100 and not (entity.state == "open" and pos == "disable"): if ( pos != 100 and not (entity.state == "open" and pos == "disable") ) or entity.assumedState:
icon_up_status = "enable" icon_up_status = "enable"
icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class) icon_up = get_action_id_ha(ha_type=entityType, action="open", device_class=device_class)
if bits & 0b00000010: # SUPPORT_CLOSE if bits & 0b00000010: # SUPPORT_CLOSE
if pos != 0 and not (entity.state == "closed" and pos == "disable"): if ( pos != 0 and not (entity.state == "closed" and pos == "disable") ) or entity.assumedState:
icon_down_status = "enable" icon_down_status = "enable"
icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class) icon_down = get_action_id_ha(ha_type=entityType, action="close", device_class=device_class)
#if bits & 0b00000100: # SUPPORT_SET_POSITION #if bits & 0b00000100: # SUPPORT_SET_POSITION