{"id":35117036,"url":"https://github.com/xtimmy86x/ha-s7plc","last_synced_at":"2026-02-26T23:13:13.126Z","repository":{"id":312159043,"uuid":"1046533312","full_name":"xtimmy86x/ha-s7plc","owner":"xtimmy86x","description":"Home Assistant Integration for S7 PLCs","archived":false,"fork":false,"pushed_at":"2026-02-22T17:24:17.000Z","size":1118,"stargazers_count":21,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-22T18:50:08.615Z","etag":null,"topics":["automation","home-assistant","integration"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtimmy86x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-28T20:35:12.000Z","updated_at":"2026-02-22T17:24:20.000Z","dependencies_parsed_at":"2025-08-29T02:50:53.815Z","dependency_job_id":"986e379c-0271-4c44-a465-ee695d48037a","html_url":"https://github.com/xtimmy86x/ha-s7plc","commit_stats":null,"previous_names":["xtimmy86x/ha-s7plc"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/xtimmy86x/ha-s7plc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtimmy86x%2Fha-s7plc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtimmy86x%2Fha-s7plc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtimmy86x%2Fha-s7plc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtimmy86x%2Fha-s7plc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtimmy86x","download_url":"https://codeload.github.com/xtimmy86x/ha-s7plc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtimmy86x%2Fha-s7plc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29876424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T22:37:10.609Z","status":"ssl_error","status_checked_at":"2026-02-26T22:37:09.019Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","home-assistant","integration"],"created_at":"2025-12-27T21:07:45.927Z","updated_at":"2026-02-26T23:13:13.115Z","avatar_url":"https://github.com/xtimmy86x.png","language":"Python","funding_links":["https://www.buymeacoffee.com/xtimmy86x"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# ha-s7plc\n\n**Home Assistant integration for Siemens S7 PLCs**  \nDirect + lightweight custom component using `pys7`.  \n**No MQTT • No REST • No middleware**\n\n\u003cbr/\u003e\n\n![ha-s7plc banner](https://raw.githubusercontent.com/xtimmy86x/ha-s7plc/main/docs/banner.png)\n\n\u003cbr/\u003e\n\n[![Release](https://img.shields.io/github/v/release/xtimmy86x/ha-s7plc)](https://github.com/xtimmy86x/ha-s7plc/releases)\n[![Home Assistant](https://img.shields.io/badge/Home%20Assistant-Custom%20Component-41BDF5)](https://www.home-assistant.io/)\n[![Python](https://img.shields.io/badge/Python-3.x-3776AB)](https://www.python.org/)\n[![pyS7](https://img.shields.io/badge/Library-pys7-informational)](https://github.com/xtimmy86x/pyS7)\n\n\u003cbr/\u003e\n\n\u003ca href=\"https://www.buymeacoffee.com/xtimmy86x\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"175\" /\u003e\n\u003c/a\u003e\n\n\u003cbr/\u003e\n\n**Quick Links**  \n[✨ Features](#features) •\n[🚀 Quick Start](#quick-start) •\n[📚 Documentation](#documentation) •\n[🧩 Entities](#supported-entities) •\n[🛠️ Troubleshooting](#troubleshooting)\n\n\u003c/div\u003e\n\n---\n\n## Features\n\n- ⚡ **Direct PLC communication** over S7 protocol via `pys7`\n- 🧩 **Multiple entity types**: `light`, `dimmer light`, `switch`, `cover`, `button`, `binary_sensor`, `sensor`, `number`, `text`, `climate`, and Entity Sync\n- 🔌 **Dual connection modes**: Rack/Slot or TSAP addressing\n- 🧮 **Value multipliers**: Scale raw PLC values before Home Assistant sees them\n- 🪶 **Lightweight**: Minimal overhead, no broker/services required\n- 🛠️ **Full UI configuration**: Set up and manage entirely from Home Assistant's UI\n- 🔍 **Optional auto-discovery**: Pre-populates PLCs found on your local network\n- 📄 **S7 STRING support** for text sensors\n- 🔄 **State synchronization**: Bidirectional sync for switches and lights with physical controls\n- 📤 **Entity Sync**: Push any Home Assistant entity state to PLC addresses in real-time\n- 🌡️ **Climate control**: Direct control and setpoint modes for HVAC systems\n- 📊 **Import/Export**: Backup and restore your entity configurations\n\n---\n\n## Quick Start\n\n### Requirements\n\n- **Home Assistant** installation\n- **Siemens S7 PLC** (S7-1200/1500/300/400) reachable over ISO-on-TCP (port 102)\n- Network connectivity between Home Assistant and PLC\n\n\u003e ℹ️ For S7-1200/1500: Ensure data blocks have **Optimized block access disabled** if using absolute addressing.\n\n### Installation\n\n**Via HACS (Recommended)**\n\n1. Ensure [HACS](https://hacs.xyz) is installed\n2. Open **HACS → Integrations**\n3. Search for **\"Siemens S7 PLC\"** and install\n4. Restart Home Assistant\n\n**Manual Installation**\n\n1. Copy `custom_components/s7plc` to your HA config directory\n2. Restart Home Assistant\n\n### Basic Setup\n\n1. Go to **Settings → Devices \u0026 Services** → **Add Integration**\n2. Search for **\"S7 PLC\"**\n3. Choose connection type:\n   - **Rack/Slot** (default): Standard connection for most PLCs\n   - **TSAP**: For specific configurations or legacy systems\n4. Enter PLC connection details:\n   - Host, Port\n   - Rack/Slot (typically `0/1` for S7-1200/1500, `0/2` for S7-300/400)\n   - or Local/Remote TSAP for TSAP mode\n5. Configure timeout and retry settings for your network\n6. Add entities through **Configure** → **Add items**\n\n---\n\n## Documentation\n\nComprehensive documentation is available in the [`docs/`](docs/) directory:\n\n- **[Configuration Guide](docs/configuration.md)** - Complete setup instructions, connection types, entity management\n- **[S7 Addressing](docs/addressing.md)** - Address formats, data types, PLC-specific notes\n- **[Advanced Features](docs/advanced-features.md)** - State Synchronization and Entity Sync\n- **[Examples](docs/examples.md)** - Practical use cases and configuration examples\n- **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions\n\n### Quick Links\n\n| Topic | Description |\n|-------|-------------|\n| [Connection Types](docs/configuration.md#connection-types) | Rack/Slot vs TSAP addressing |\n| [Entity Types](docs/configuration.md#entity-type-details) | Switch, Light, Dimmer Light, Cover, Sensor, Number, Climate, Entity Sync |\n| [State Sync](docs/advanced-features.md#state-synchronization) | Bidirectional synchronization for physical controls |\n| [Entity Sync](docs/advanced-features.md#entity-sync) | Push HA entities to PLC addresses |\n| [Logo! Support](docs/addressing.md#logo-8-addressing) | Specific notes for Logo! controllers |\n| [Export/Import](docs/configuration.md#export-and-import) | Backup and restore configurations |\n\n---\n\n## Supported Entities\n\n| Entity Type | Read | Write | Features |\n|-------------|------|-------|----------|\n| **Binary Sensor** | ✅ | ❌ | Device classes, bit addressing, state inversion |\n| **Sensor** | ✅ | ❌ | Numeric types, strings, multipliers, precision |\n| **Switch** | ✅ | ✅ | State sync, pulse command mode, separate state/command addresses |\n| **Light (On/Off)** | ✅ | ✅ | State sync, pulse command mode, separate state/command addresses |\n| **Dimmer Light** | ✅ | ✅ | Brightness control, configurable scale, optional actuator relay |\n| **Cover** | ✅ | ✅ | Open/close commands, position control (0–100%), stop, timing |\n| **Button** | ❌ | ✅ | Pulse output with configurable duration (0.1-60s, supports decimals) |\n| **Number** | ✅ | ✅ | Min/max/step, separate read/write addresses |\n| **Text** | ✅ | ✅ | STRING/WSTRING support, pattern validation, auto-sized limits |\n| **Climate** | ✅ | ✅ | Direct control or setpoint mode, HVAC status feedback |\n| **Entity Sync** | ❌ | ✅ | Monitor any HA entity, write to PLC on change |\n\n---\n\n## Supported Data Types\n\n| S7 Type | Example | Description |\n|---------|---------|-------------|\n| Bit | `DB1,X0.0` | Boolean values |\n| Byte | `DB1,B0` | Unsigned 8-bit (0-255) |\n| Char | `DB1,C0` | Single ASCII character |\n| Word | `DB1,W2` | Unsigned 16-bit (0-65535) |\n| Int | `DB1,I2` | Signed 16-bit (-32768 to 32767) |\n| DWord | `DB1,DW4` | Unsigned 32-bit (0-4294967295) |\n| DInt | `DB1,DI4` | Signed 32-bit (-2147483648 to 2147483647) |\n| Real | `DB1,R4` | IEEE 754 32-bit float |\n| LReal | `DB1,LR8` | IEEE 754 64-bit double precision float |\n| String | `DB1,S0.20` | S7 STRING type (ASCII) |\n| WString | `DB1,WS0.20` | S7 WSTRING type (Unicode UTF-16) |\n\n**Note**: Use `I`/`DI` for signed integers, `W`/`DW` for unsigned integers.\n\nSee [S7 Addressing](docs/addressing.md) for complete details.\n\n---\n\n## Example Use Cases\n\n- **HVAC Control**: Read temperatures, control setpoints, climate entities with direct or setpoint modes\n- **Lighting Systems**: Multi-point control with physical switches, dimmer lights with brightness control\n- **Conveyor Belts**: Monitor status, control motors\n- **Door Access**: Lock control, contact monitoring\n- **Data Logging**: Push weather, energy data to PLC\n- **Process Control**: Tank levels, valve positions, pump control\n\nSee [Examples](docs/examples.md) for detailed configurations.\n\n---\n\n## FAQ\n\n**Q: Is MQTT required?**  \nA: No. Direct S7 protocol communication to PLC.\n\n**Q: Which PLCs are supported?**  \nA: Any S7 PLC with ISO-on-TCP (port 102) support: S7-1200, S7-1500, S7-300, S7-400, Logo! 8.\n\n**Q: Can I write values to the PLC?**  \nA: Yes. `switch`, `light`, `dimmer light`, `cover`, `button`, `number`, `text`, `climate`, and Entity Sync all support writes.\n\n**Q: Do I need to know PLC programming?**  \nA: Basic knowledge helps. You need to know your data block structure and addresses.\n\n**Q: Can I use symbolic names?**  \nA: No, only absolute addressing (DB + offset) is supported.\n\n---\n\n## Troubleshooting\n\nCommon issues:\n\n- **Connection fails**: Check network, firewall, rack/slot values\n- **Wrong values**: Verify address, data type, alignment\n- **Slow updates**: Adjust scan interval, check network latency\n- **Intermittent disconnects**: Review timeout settings, network stability\n\nSee [Troubleshooting Guide](docs/troubleshooting.md) for complete solutions.\n\n---\n\n## Contributing\n\nContributions welcome! Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes with clear commit messages\n4. Add documentation for new features\n5. Open a Pull Request\n\n### Development\n\nFor local development/testing, install dev dependencies (kept separate from runtime deps):\n\n```bash\npip install -r requirements_dev.txt\n```\n\nRun quality checks:\n\n```bash\nruff check custom_components tests\npytest -q\n```\n\nThis project also uses [pre-commit](https://pre-commit.com/):\n\n```bash\npre-commit run --files \u003cfile1\u003e [\u003cfile2\u003e ...]\n```\n\n---\n\n## Roadmap\n\n- [x] Multiple entity types\n- [x] UI-only configuration\n- [x] State synchronization\n- [x] Entity sync (write HA entities to PLC)\n- [x] TSAP connection support\n- [x] Import/Export configuration\n- [x] Climate entities (direct and setpoint control)\n- [x] Dimmer light with brightness control\n- [x] Position-based cover with stop\n- [ ] Additional diagnostics entities\n- [ ] Performance optimizations\n\n\u003e Have ideas? Open an **issue** or **PR**!\n\n---\n\n## Releases\n\nSee [Releases](https://github.com/xtimmy86x/ha-s7plc/releases) for changelogs and downloads.\n\n---\n\n## Security \u0026 Safety\n\n- Use on **trusted networks** only\n- Apply standard Home Assistant secrets handling\n- Consider read-only DBs for monitoring to prevent accidental writes\n- Test thoroughly in non-production environments first\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n## Acknowledgements\n\n- Built on [`pyS7`](https://github.com/xtimmy86x/pyS7) library\n- Inspired by the Home Assistant community\n- Not affiliated with Siemens AG or Home Assistant\n\n---\n\n## Support\n\n- 📖 Read the [documentation](docs/)\n- 🐛 Report bugs via [GitHub Issues](https://github.com/xtimmy86x/ha-s7plc/issues)\n- 💬 Discuss in [Home Assistant Community](https://community.home-assistant.io/)\n- ☕ [Buy me a coffee](https://www.buymeacoffee.com/xtimmy86x) if this helps you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtimmy86x%2Fha-s7plc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtimmy86x%2Fha-s7plc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtimmy86x%2Fha-s7plc/lists"}