Skip to content

Commit 7593060

Browse files
committed
Merge branch 'master' of github.com:FlyingDiver/Indigo-HA-Agent
2 parents d252b87 + a6d8964 commit 7593060

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
@@ -1472,6 +1472,15 @@ def run_automation_command(self, plugin_action, _callerWaitingForResult):
14721472
else:
14731473
self.logger.warning(f"run_automation_command: missing automation_id")
14741474

1475+
def send_scene_command(self, plugin_action, _callerWaitingForResult):
1476+
self.logger.debug(f"send_scene_command: {plugin_action.props}")
1477+
if entity_id := plugin_action.props.get("entity_id"):
1478+
msg_data = {"type": "call_service", 'domain': 'scene', 'service': 'turn_on',
1479+
'service_data': {"entity_id": entity_id}}
1480+
self.send_ws(msg_data)
1481+
else:
1482+
self.logger.warning(f"send_scene_command: missing entity_id")
1483+
14751484
def set_text_command(self, plugin_action, _callerWaitingForResult):
14761485
self.logger.debug(f"set_text_command: {plugin_action.props}")
14771486
if entity_id := plugin_action.props.get("entity_id"):

0 commit comments

Comments
 (0)