# Siemens S7 Connects to **Siemens S7** PLCs (S7-300/400/1200/1500) via the S7 communication protocol. Items are grouped per data block and read with one block read per DB, so many items on the same DB cost a single transaction per poll cycle. | | | |---|---| | Connection string | `s7.tcp://HOST/RACK/SLOT` (e.g. `s7.tcp://10.0.0.10/0/1`) | | Reads | ✔ (poll) | | Writes | ✔ | | Subscriptions | — | :::info On S7-1200/1500, DB access requires *optimized block access* to be **disabled** for the data blocks you read, and PUT/GET communication to be allowed in the CPU protection settings. ::: ## Device options None beyond the connection string. ## Address format ``` AREA::DBNUMBER::TYPE::BYTE[::BIT] ``` For example `DB::490::REAL::80::0` — the REAL at byte 80 of DB490. Read types: `bool`, `real`, `dint`, `int`, `word`, `string`. Additional types are known for sizing and the write path: `sint`, `usint`, `short`, `char`, `uint`, `s5time`, `date`, `float`, `udint`, `dword`, `time`, `tod`, `lint`, `ulint`, `lreal`, `ltime`, `ltod`, `dt`, `ldt`, `dtl`, `wstring`. ## Example configuration ```json { "devices": [ { "objectId": "press1", "name": "Press 1", "connectionString": "s7.tcp://10.0.0.10/0/1", "interval": 1000, "enabled": true, "options": {}, "extraOptions": { "host": "broker:1883", "clientId": "openconnect" } } ], "items": [ { "objectId": "pressure", "DeviceID": { "objectId": "press1" }, "address": "DB::490::REAL::80::0", "label": "Hydraulic pressure", "type": "Number", "unit": "bar", "source": { "tag": "hall1/press1" }, "enabled": true, "onChange": true, "extraOptions": {} } ] } ``` ## Writes The write topic is a full item address; the payload is the value. Example — write `21.5` to the REAL at DB490 byte 80: ```bash # HTTP curl -X POST "http://openconnect:8080/write/press1/DB::490::REAL::80::0" \ -H "Authorization: Bearer $TOKEN" -d '21.5' # MQTT (capability mqttwrite) mosquitto_pub -t 'write/press1/DB::490::REAL::80::0' -m '21.5' ``` See the [write API](../write-api.md) for authentication and the MQTT setup.