mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
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:
@@ -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}"
|
||||||
|
|||||||
Reference in New Issue
Block a user