Skip to content

Commit a6d8964

Browse files
authored
Merge pull request #29 from anyone2/master
Add Activate Scene action
2 parents 0f9778a + 42542a6 commit a6d8964

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

HomeAssistantAgent.indigoPlugin/Contents/Server Plugin/Actions.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,19 @@
174174
</Field>
175175
</ConfigUI>
176176
</Action>
177-
177+
178+
<Action id="send_scene_command">
179+
<Name>Activate Scene</Name>
180+
<CallbackMethod>send_scene_command</CallbackMethod>
181+
<ConfigUI>
182+
<Field id="entity_id" type="menu">
183+
<Label>Scene Entity:</Label>
184+
<List class="self" method="get_entity_list" filter="scene" dynamicReload="true"/>
185+
<CallbackMethod>menuChanged</CallbackMethod>
186+
</Field>
187+
</ConfigUI>
188+
</Action>
189+
178190
<Action id="sep2" />
179191

180192
<Action id="set_text">

HomeAssistantAgent.indigoPlugin/Contents/Server Plugin/plugin.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,15 @@ def run_automation_command(self, plugin_action, _callerWaitingForResult):
14761476
else:
14771477
self.logger.warning(f"run_automation_command: missing automation_id")
14781478

1479+
def send_scene_command(self, plugin_action, _callerWaitingForResult):
1480+
self.logger.debug(f"send_scene_command: {plugin_action.props}")
1481+
if entity_id := plugin_action.props.get("entity_id"):
1482+
msg_data = {"type": "call_service", 'domain': 'scene', 'service': 'turn_on',
1483+
'service_data': {"entity_id": entity_id}}
1484+
self.send_ws(msg_data)
1485+
else:
1486+
self.logger.warning(f"send_scene_command: missing entity_id")
1487+
14791488
def set_text_command(self, plugin_action, _callerWaitingForResult):
14801489
self.logger.debug(f"set_text_command: {plugin_action.props}")
14811490
if entity_id := plugin_action.props.get("entity_id"):

0 commit comments

Comments
 (0)