mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-22 07:24:24 +01:00
add lock to controller
This commit is contained in:
@@ -207,6 +207,11 @@ class LuiController(object):
|
|||||||
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
||||||
elif entity_id.startswith('light') or entity_id.startswith('switch') or entity_id.startswith('input_boolean'):
|
elif entity_id.startswith('light') or entity_id.startswith('switch') or entity_id.startswith('input_boolean'):
|
||||||
self._ha_api.get_entity(entity_id).call_service("toggle")
|
self._ha_api.get_entity(entity_id).call_service("toggle")
|
||||||
|
elif entity_id.startswith('lock'):
|
||||||
|
if self._ha_api.get_entity(entity_id).state == "locked":
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("unlock")
|
||||||
|
else:
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("lock")
|
||||||
else:
|
else:
|
||||||
self._ha_api.get_entity(entity_id).call_service("press")
|
self._ha_api.get_entity(entity_id).call_service("press")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user