Disable controls on gridEntities

Other cover types now also have the ability to disable unused buttons in gridEntities.

Code is copied from generate_shutter_detail_page()
This commit is contained in:
illuzn
2022-05-23 13:34:01 +09:30
committed by GitHub
parent 38bec6e7b3
commit b1ab9d3f32

View File

@@ -156,11 +156,17 @@ class LuiPagesGen(object):
icon_stop = get_action_id_ha(ha_type="cover", action="stop", device_class=device_class) icon_stop = get_action_id_ha(ha_type="cover", action="stop", device_class=device_class)
icon_down = get_action_id_ha(ha_type="cover", action="close", device_class=device_class) icon_down = get_action_id_ha(ha_type="cover", action="close", device_class=device_class)
pos = int(entity.attributes.get("current_position", 50)) pos = entity.attributes.get("current_position")
if pos == 100: if pos == 100:
status = f"disable|enable|enable" status = f"disable|enable|enable"
elif pos == 0: elif pos == 0:
status = f"enable|enable|disable" status = f"enable|enable|disable"
elif pos == None:
pos_status = entity.state
if pos_status == "open":
status = f"disable|enable|enable"
elif pos_status == "closed":
status = f"enable|enable|disable"
else: else:
status = f"enable|enable|enable" status = f"enable|enable|enable"
return f"~shutter~{entityId}~{icon_id}~17299~{name}~{icon_up}|{icon_stop}|{icon_down}|{status}" return f"~shutter~{entityId}~{icon_id}~17299~{name}~{icon_up}|{icon_stop}|{icon_down}|{status}"