Two-input event pipeline

Goal: example.start and example.stop drive a Lua script. It persists a Boolean, emits example.changed, and a rendered HTML widget displays and acknowledges the result.

Read Lua source and HTML source. Install the script as example-events and one HTML widget. Use their real IDs and address. Follow script installation and widget installation; preserve existing configuration.

Create an enabled automation policy:

{"id":"example-events","title":"Example events","enabled":true,"capabilities":["manualTrigger"],"actions":["patchState","emitEvent"]}

Create its enabled subscription record:

{"scriptId":"example-events","policyId":"example-events","enabled":true,"subscriptions":[{"event":"example.start","minimumIntervalMilliseconds":0},{"event":"example.stop","minimumIntervalMilliseconds":0}]}

Set the widget record's subscription field:

[{"event":"example.changed","minimumIntervalMilliseconds":0}]

Select the widget's page. Read widgetGet until its state has ready: true and renderedText: "Waiting"; this confirms the rendered bridge is listening. Dispatch through dikciz_automation_dispatch:

{"sourceWidgetAddress":"1H1V-example-widget","actions":[{"type":"emitEvent","event":"example.start","payload":{}}]}

Replace the example address with the widget's actual full address. Read the Lua run status and saved state.running: true. Wait for the widget's saved state.running: true and visible Running. Send example.stop, then verify both states become false and the widget shows Stopped.

Publication is asynchronous. An executed action alone does not prove either receiver ran. A hidden HTML widget does not receive events; Lua or headless JavaScript handles background work. Avoid resetting configuration to install this example.