implemented fan #175

This commit is contained in:
Johannes
2022-05-06 17:07:05 +02:00
parent c3c02f584b
commit ab3301ffbd
3 changed files with 9 additions and 1 deletions

View File

@@ -182,7 +182,10 @@ class LuiController(object):
self._ha_api.turn_off(entity_id)
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
if button_type == "up":

View File

@@ -47,6 +47,8 @@ def map_to_mdi_name(ha_type, state=None, device_class=None):
return "ray-vertex"
if ha_type == "light":
return "lightbulb"
if ha_type == "fan":
return "fan"
if ha_type == "input_boolean":
return "check-circle-outline" if state == "on" else "close-circle-outline"
if ha_type == "cover":

View File

@@ -181,6 +181,9 @@ class LuiPagesGen(object):
min_v = entity.attributes.get("min", 0)
max_v = entity.attributes.get("max", 100)
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":
icon_id = get_icon_id_ha("input_text", overwrite=icon)
value = entity.state