[WIP] Programmatic automation configuration

Replacement for #389

Provides an example of what code-based automation configuration looks like and a tool to generate the automation setup code matching a pattern definition template file.

Builds on top of #397. Do not merge until that PR is merged.