WTH can't we annotate sequence steps for logging? ('Executing step call service - "Make lights blue"')

Currently, you can call “system_log.write” as a step in your script to get this:

[homeassistant.components.script.test_system_log_write] Test System Log Write: Running script
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service
[homeassistant.components.system_log.external] TURNING OFF LIGHTS
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service
[homeassistant.components.system_log.external] WAIT FOR LIGHT TO TURN OFF
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step wait template
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service
[homeassistant.components.system_log.external] TURNING OFF TELEVISION
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service

But this adds two log lines for every write (one for the message, and one for the service call), and clutters your automations.

What if we could instead “annotate” steps, like this (pardon my awful html):

Producing logs like this:

[homeassistant.components.script.test_system_log_write] Test System Log Write: Running script
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service - "TURNING OFF LIGHTS"
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step wait template - "WAIT FOR LIGHT TO TURN OFF"
[homeassistant.components.script.test_system_log_write] Test System Log Write: Executing step call service - "TURNING OFF TELEVISION"

This looks cleaner, is easier to see what each step does, and keeps automations free from the extra service call steps.

Went ahead and put up a PR for this myself:

Frontend support PR:

https://github.com/home-assistant/frontend/pull/7153

Update: Turns out most script action steps already support using “alias” for annotations and logging! So I switched gears and added support for alias in the remaining action steps.

Next step: surfacing that information in the UI

1 Like