mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 23:14:25 +01:00
implemented fan #175
This commit is contained in:
@@ -182,7 +182,10 @@ class LuiController(object):
|
|||||||
self._ha_api.turn_off(entity_id)
|
self._ha_api.turn_off(entity_id)
|
||||||
|
|
||||||
if button_type == "number-set":
|
if button_type == "number-set":
|
||||||
self._ha_api.get_entity(entity_id).call_service("set_value", value=value)
|
if entity_id.startswith('fan'):
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("set_percentage", percentage=value)
|
||||||
|
else:
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("set_value", value=value)
|
||||||
|
|
||||||
# for shutter / covers
|
# for shutter / covers
|
||||||
if button_type == "up":
|
if button_type == "up":
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ def map_to_mdi_name(ha_type, state=None, device_class=None):
|
|||||||
return "ray-vertex"
|
return "ray-vertex"
|
||||||
if ha_type == "light":
|
if ha_type == "light":
|
||||||
return "lightbulb"
|
return "lightbulb"
|
||||||
|
if ha_type == "fan":
|
||||||
|
return "fan"
|
||||||
if ha_type == "input_boolean":
|
if ha_type == "input_boolean":
|
||||||
return "check-circle-outline" if state == "on" else "close-circle-outline"
|
return "check-circle-outline" if state == "on" else "close-circle-outline"
|
||||||
if ha_type == "cover":
|
if ha_type == "cover":
|
||||||
|
|||||||
@@ -181,6 +181,9 @@ class LuiPagesGen(object):
|
|||||||
min_v = entity.attributes.get("min", 0)
|
min_v = entity.attributes.get("min", 0)
|
||||||
max_v = entity.attributes.get("max", 100)
|
max_v = entity.attributes.get("max", 100)
|
||||||
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.state}|{min_v}|{max_v}"
|
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.state}|{min_v}|{max_v}"
|
||||||
|
if entityType == "fan":
|
||||||
|
icon_id = get_icon_id_ha("fan", overwrite=icon)
|
||||||
|
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.percentage}|0|100"
|
||||||
if entityType == "input_text":
|
if entityType == "input_text":
|
||||||
icon_id = get_icon_id_ha("input_text", overwrite=icon)
|
icon_id = get_icon_id_ha("input_text", overwrite=icon)
|
||||||
value = entity.state
|
value = entity.state
|
||||||
|
|||||||
Reference in New Issue
Block a user