I’m working on a py_script service that can take some actions to run. Something like (oversimplified):
from homeassistant.helpers.script import Script
from homeassistant.helpers import (
config_validation as cv
)
from homeassistant.core import (
Context,
)
@service
def run_me(actions=[]):
"""yaml
fields:
actions:
name: "Actions"
description: "List of instructions to run"
required: true
default: []
selector:
action:
"""
s = Script(
hass=hass,
sequence=cv.SCRIPT_SCHEMA(actions),
name="run_me",
domain="local_home"
)
await s.async_run(context = Context())
This seems to work but feels hacked and kludgy. Am I missing a more elegant way to do this?