PLC THINKING FOR YOUR HOME

Automations.
In Structured Text.

Write your Home Assistant logic in ST. The integration translates your code into native automations and binds variables to your entities.

2.2.0 · Home Assistant · MIT

Motion_Light.stStructured Text
// Example: hallway light
{mode: restart}
PROGRAM Motion_Light
VAR
  {trigger}
  motion AT %I* : BOOL :=
    'binary_sensor.hallway_motion';
  light AT %Q* : BOOL :=
    'light.hallway_ceiling';
END_VAR

IF motion THEN
  light := TRUE;
ELSE
  light := FALSE;
END_IF;
END_PROGRAM
light = FALSE
Illustrated code view with a local logic demo. No Home Assistant connection and no ST compiler execution.
Structured TextConditions, variables and timers
Native automationsTranslation rather than an ST interpreter
HACSInstall as a custom integration
Online modeRead entity values in the editor
01 / LOGIC IN CODE

A condition.
A clear response.

The ST editor connects familiar programming logic to Home Assistant’s event model.

01

Bind entities

Bind inputs with %I*, outputs with %Q* and helpers with %M*. The Entity Browser supports selecting and inserting bindings.

02

Express behaviour

Use conditions, state variables and timers such as TON, TOF or TP. Pragmas control triggers, persistence and execution mode.

03

Inspect values

Syntax highlighting and autocomplete help while writing. Online mode displays current entity values in the editor.

02 / FROM PROGRAM TO AUTOMATION

Write ST.
Let Home Assistant run it.

An input event starts the generated HA automation. State and timers use the corresponding Home Assistant helpers.

Deployment backs up configuration and includes error handling and rollback. Review the preview and start by testing a small automation.

01Structured TextMotion_Light.st
02Transpiler + helpersTriggers, variables, timers
03Home AssistantNative automations and scripts
No TwinCAT project needed. The integration runs in Home Assistant. It uses its own ST implementation with documented bindings and pragmas; vendor-specific PLC libraries are not imported automatically.
03 / SETUP

Your first
ST automation.

Add the HACS repository

Add the repository as a custom Integration in HACS and install ST for Home Assistant.

Restart and add

Restart Home Assistant. Add ST for Home Assistant under Settings → Devices & services.

Open ST Editor

Open the new sidebar panel and create your first program. Replace the example IDs with real entities.

Preview and test

Check the diagnostics, click Deploy and test the behavior with two Toggle helpers first.

HACS · Custom repository, type Integration

https://github.com/Auda29/ST_HA_Automation

Requirements

Home Assistant 2024.7.0 or newer and HACS for the recommended installation. No additional PLC hardware is required.

Manual installation

Alternatively, extract the release archive and copy custom_components/st_hass into your custom_components directory. Then restart and add the integration.

ST for Home Assistant 2.2.0

Release, source archive and changelog

Open release ↗
04 / START WITH AN EXAMPLE

From a hallway light
to your own logic.

DOCUMENTATION

Your next step.

Guides and technical details in the repository.

GOOD TO KNOW

Before you start.

Does my ST code run in a continuous loop?

The integration generates native, event-driven Home Assistant automations. It does not emulate a cyclic PLC task with real-time guarantees.

Can I connect the example switch to my home?

The demo on this page only shows the IF logic in your browser. Install the integration and replace the entity IDs in the program to use real entities.

Is the application interface bilingual too?

This project site is available in German and English. The editor interface and most technical references are in English.