Home Assistant integration for Siemens S7 PLCs and Logo! controllers
Direct + lightweight custom component using pys7.
No MQTT โข No REST โข No middleware
Quick Links โจ Features โข ๐ Quick Start โข ๐ Documentation โข ๐งฉ Entities โข ๐ ๏ธ Troubleshooting โข ๐ PLC Survey
Which Siemens PLC are you using with ha-s7plc?
Take our short voluntary survey and help us understand which PLC models and firmware versions are actually used by the community.
๐ Take the PLC Compatibility Survey
No information is collected automatically from Home Assistant or your PLC.
- โก Direct PLC communication over S7 protocol via
pys7 - ๐งฉ Multiple entity types:
light,dimmer light,switch,cover,button,binary_sensor,sensor,number,select,text,climate, and Entity Sync - ๐ Dual connection modes: Rack/Slot or TSAP addressing
- ๐งฎ Value multipliers: Scale raw PLC values before Home Assistant sees them
- ๐ชถ Lightweight: Minimal overhead, no broker/services required
- ๐ ๏ธ Full UI configuration: Set up and manage entirely from Home Assistant's UI
- ๐ฅ๏ธ Native side panel: Manage every PLC entity from the Home Assistant sidebar with visual and YAML editors, live states, and validation
- ๐ Optional auto-discovery: Pre-populates PLCs found on your local network
- ๐ S7 STRING support for text sensors
- ๐ State synchronization: Bidirectional sync for switches and lights with physical controls
- ๐ค Entity Sync: Push any Home Assistant entity state to PLC addresses in real-time
- ๐ก๏ธ Climate control: Direct control and setpoint modes for HVAC systems
- ๐ Import/Export: Backup and restore your entity configurations
- ๐ Performance metrics: Optional diagnostic sensors for connection health and PLC communication stats
- Home Assistant installation
- Siemens S7 PLC (S7-1200/1500/300/400) or Logo! controller (Logo! 8 / 0BA8 and newer; Logo! 0BA7 and older via TSAP) reachable over ISO-on-TCP (port 102)
- Network connectivity between Home Assistant and PLC
โน๏ธ For S7-1200/1500: Ensure data blocks have Optimized block access disabled if using absolute addressing. โน๏ธ For Logo! 8 (0BA8+): use Rack/Slot connection (
rack: 0,slot: 2). For Logo! 0BA7 and older: use TSAP connection (see addressing docs).
Via HACS (Recommended)
- Ensure HACS is installed
- Open HACS โ Integrations
- Search for "Siemens S7 PLC" and install
- Restart Home Assistant
Manual Installation
- Copy
custom_components/s7plcto your HA config directory - Restart Home Assistant
Important
Entity management through the legacy Entity Options Flow was removed in version 7.0.0. The initial Config Flow and the connection Options Flow remain available; entities are managed only through the S7 PLC Side Panel.
- Install the integration and restart Home Assistant.
- Go to Settings โ Devices & Services โ Add Integration.
- Search for and add S7 PLC.
- Choose connection type:
- Rack/Slot (default): Standard connection for most PLCs and Logo! 8
- TSAP: For specific configurations, Logo! 0BA7 and older, or legacy systems
- Enter the PLC connection details and let the Config Flow verify the connection:
- Host, Port
- Rack/Slot (typically
0/1for S7-1200/1500,0/2for S7-300/400 and Logo! 8) - or Local/Remote TSAP for TSAP mode (e.g.
10.00/10.01for Logo! 0BA7)
- Configure timeout and retry settings for your network.
- Open S7 PLC from the Home Assistant sidebar, then add and manage entities in the Side Panel.
Settings โ Devices & Services โ S7 PLC โ Configure opens the Options Flow exclusively for connection settings: name, host and port, Rack/Slot or TSAP parameters for the connection method selected during setup, pyS7 connection type, global scan interval, timeout, retry and backoff, optimized reads, write batching, and metrics. It does not manage entities. The Rack/Slot โ TSAP connection method itself cannot be changed later; create a new integration entry to use the other method.
Comprehensive documentation is available in the docs/ directory:
- Configuration Guide - Complete setup instructions, connection types, entity management
- Side Panel Guide - Visual and YAML entity editing from the Home Assistant sidebar
- S7 Addressing - Address formats, data types, PLC-specific notes
- Value Conversions - Numeric scaling and safe custom expressions
- Advanced Features - State Synchronization, Entity Sync, and Performance Metrics
- Examples - Practical use cases and configuration examples
- Troubleshooting - Common issues and solutions
| Topic | Description |
|---|---|
| Connection Types | Rack/Slot vs TSAP addressing |
| Entity Types | Switch, Light, Dimmer Light, Cover, Sensor, Number, Climate, Entity Sync |
| S7 PLC Side Panel | Visual/YAML editing, validation, live status, and multi-PLC selection |
| Value Conversions | Read/write scaling, clamping, and custom expressions |
| State Sync | Bidirectional synchronization for physical controls |
| Entity Sync | Push HA entities to PLC addresses |
| Performance Metrics | Diagnostic sensors for connection and communication stats |
| Logo! Support | Specific notes for Logo! controllers |
| Export/Import | Backup and restore configurations |
| Entity Type | Read | Write | Features |
|---|---|---|---|
| Binary Sensor | โ | โ | Device classes, bit addressing, state inversion |
| Sensor | โ | โ | Numeric types, strings, multipliers, precision |
| Switch | โ | โ | State sync, pulse command mode, separate state/command addresses |
| Light (On/Off) | โ | โ | State sync, pulse command mode, separate state/command addresses |
| Dimmer Light | โ | โ | Brightness control, configurable scale, optional actuator relay |
| Cover | โ | โ | Open/close commands, position control (0โ100%), stop, timing |
| Button | โ | โ | Pulse output with configurable duration (0.1-60s, supports decimals) |
| Number | โ | โ | Min/max/step, separate read/write addresses |
| Select | โ | โ | Map numeric PLC values to named options (modes, fan speeds, etc.) |
| Text | โ | โ | STRING/WSTRING support, pattern validation, auto-sized limits |
| Climate | โ | โ | Direct control or setpoint mode, HVAC status feedback |
| Entity Sync | โ | โ | Monitor any HA entity, write to PLC on change |
| S7 Type | Example | Description |
|---|---|---|
| Bit | DB1,X0.0 |
Boolean values |
| Byte | DB1,B0 |
Unsigned 8-bit (0-255) |
| USInt | DB1,USINT0 |
Unsigned 8-bit (0-255, explicit USINT) |
| SInt | DB1,SINT0 |
Signed 8-bit (-128 to 127) |
| Char | DB1,C0 |
Single ASCII character |
| Word | DB1,W2 |
Unsigned 16-bit (0-65535) |
| Int | DB1,I2 |
Signed 16-bit (-32768 to 32767) |
| DWord | DB1,DW4 |
Unsigned 32-bit (0-4294967295) |
| DInt | DB1,DI4 |
Signed 32-bit (-2147483648 to 2147483647) |
| Real | DB1,R4 |
IEEE 754 32-bit float |
| LReal | DB1,LR8 |
IEEE 754 64-bit double precision float |
| String | DB1,S0.20 |
S7 STRING type (ASCII) |
| WString | DB1,WS0.20 |
S7 WSTRING type (Unicode UTF-16) |
Note: Use I/DI for signed integers, W/DW for unsigned integers. Use SINT for signed 8-bit values.
See S7 Addressing for complete details.
- HVAC Control: Read temperatures, control setpoints, climate entities with direct or setpoint modes
- Lighting Systems: Multi-point control with physical switches, dimmer lights with brightness control
- Conveyor Belts: Monitor status, control motors
- Door Access: Lock control, contact monitoring
- Data Logging: Push weather, energy data to PLC
- Process Control: Tank levels, valve positions, pump control
See Examples for detailed configurations.
Q: Is MQTT required?
A: No. Direct S7 protocol communication to PLC.
Q: Which PLCs are supported?
A: Any Siemens device with ISO-on-TCP (port 102) support: S7-1200, S7-1500, S7-300, S7-400, Logo! 8 (0BA8+) via Rack/Slot, and Logo! 0BA7/0BA6/0BA5 via TSAP.
Q: Can I write values to the PLC?
A: Yes. switch, light, dimmer light, cover, button, number, select, text, climate, and Entity Sync all support writes.
Q: Do I need to know PLC programming?
A: Basic knowledge helps. You need to know your data block structure and addresses.
Q: Can I use symbolic names?
A: No, only absolute addressing (DB + offset) is supported.
Common issues:
- Connection fails: Check network, firewall, rack/slot values
- Wrong values: Verify address, data type, alignment
- Slow updates: Adjust scan interval, check network latency
- Intermittent disconnects: Review timeout settings, network stability
See Troubleshooting Guide for complete solutions.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with clear commit messages
- Add documentation for new features
- Open a Pull Request
Local development requires Python and Node.js. Install both dependency sets and run the backend and panel DOM test suites:
python -m pip install -r requirements_dev.txt
npm ci
python -m pytest tests -v
npm run test:panelSee CONTRIBUTING.md for the complete environment setup, focused test commands, frontend test structure, coverage checks, and pull request guidelines.
This project also uses pre-commit:
pre-commit run --files <file1> [<file2> ...]- Multiple entity types
- UI-only configuration
- State synchronization
- Entity sync (write HA entities to PLC)
- TSAP connection support
- Import/Export configuration
- Climate entities (direct and setpoint control)
- Dimmer light with brightness control
- Position-based cover with stop
- Performance metrics (diagnostic sensors)
- Performance optimizations
Have ideas? Open an issue or PR!
Version 7.0.0 makes the native S7 PLC Side Panel the primary workspace for managing connections and entities. It provides selectable tabbed and expandable all-entity layouts, guided simplified modes for switches, on/off and dimmable lights, traditional and position covers, and direct or setpoint climates, plus Advanced YAML import/export. The previous entity Options Flow has been removed; the remaining Options Flow edits connection parameters only. Its Rack/Slot or TSAP method remains fixed after initial setup.
Traditional covers can now derive position from a single open or closed limit switch, both limit switches, timed estimation, or mapped status-word values. Movement feedback can likewise use individual bits or a status word. Entities also gain configurable availability policies: follow the PLC connection and required data, remain available with the last known state, or require a PLC BIT. The panel's connection detail view now provides clearer diagnostics, including the active pyS7 version and communication settings.
Existing 6.5.x config entries, entity definitions, and UIDs remain compatible;
there is no destructive data migration and no need to recreate entities. After
upgrading and restarting Home Assistant, use the Side Panel instead of the old
entity Options Flow. As always, exporting an entity backup before a major
upgrade is recommended. The integration now requires pys7==3.1.1.
Breaking change / user action: entity editing in the legacy Options Flow is no longer available. No configuration conversion is required, but entity changes must now be made in the Side Panel. To change between Rack/Slot and TSAP, create a new integration entry.
See Releases for downloads and earlier release notes.
- Use on trusted networks only
- Apply standard Home Assistant secrets handling
- Consider read-only DBs for monitoring to prevent accidental writes
- Test thoroughly in non-production environments first
This project is licensed under the MIT License - see LICENSE for details.
- Built on
pyS7library - Inspired by the Home Assistant community
- Not affiliated with Siemens AG or Home Assistant
- ๐ Read the documentation
- ๐ Report bugs via GitHub Issues
- ๐ฌ Discuss in Home Assistant Community
- โ Buy me a coffee if this helps you!
