Add Entity Type "Valve" (#1347)

* Update pages.py

* Update controller.py

* Update pages.py

* Update pages.py
This commit is contained in:
patricknitsch
2025-06-06 19:24:56 +02:00
committed by GitHub
parent 8059905579
commit 54c8d302a8
2 changed files with 12 additions and 0 deletions

View File

@@ -334,6 +334,11 @@ class LuiController(object):
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
elif entity_id.startswith('service'):
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **entity_config.data)
elif entity_id.startswith('valve'):
if apis.ha_api.get_entity(entity_id).state == "open":
apis.ha_api.get_entity(entity_id).call_service("close_valve")
else:
apis.ha_api.get_entity(entity_id).call_service("open_valve")
# for media page
if button_type == "media-next":

View File

@@ -396,6 +396,13 @@ class LuiPagesGen(object):
color = self.get_entity_color(entity, ha_type=entityType, stateOverwrite=entity.attributes['forecast'][item.stype]['condition'], overwrite=colorOverride)
else:
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
elif entityType == "valve":
entityTypePanel = "valve"
value = get_translation(self._locale, f"backend.component.binary_sensor.state.door.{entity.state}")
if entity.state == "open":
icon_id = get_icon_id("valve-open")
else:
icon_id = get_icon_id("valve-closed")
else:
name = "unsupported"
# Overwrite for value