Integration: IO State API and Integration Script
Use IO State API for read-only real-time values and Integration Script for controlled automation, HTTP, MQTT, SQL, and scheduled jobs.
IO State API
IO State API is for third-party systems that only need real-time values. It is built into the HQControl main service and uses the same web port (default 8080); there is no separate service port. Configure third parties using the actual address shown on the IO State API page, with an access key.
Scoping a client key
On the IO State API page (Key management), give each third party its own key and limit what it can read. Authorize by device first; the groups (function group, device-name group) are then bound to a specific device, written as "device-code.group-code"; the same scope format menus and alarm sound use. A key then only reads the groups under the devices it is authorized for, and never the same-named group on other devices. Tick "allow all IO State" to open everything at once.
- Client name is required; fill at least one scope, or tick "allow all IO State".
- Allowed devices: enter device codes, e.g. DeviceA, DeviceB.
- Allowed function / device-name groups: write "device-code.group-code" so the group is bound to a device (same as menus and alarm sound).
- Give each third party its own key with an expiry, so it can be revoked or rotated on its own.
WebSocket
WebSocket clients should subscribe by tag, device, or grouping filters. Do not push all values to every browser.
Integration Script
Integration Script runs Python scripts and provides ReadTag, ReadTags, and WriteTag for HQControl data. Scripts can call HTTP services, write SQL, publish MQTT messages, or perform scheduled tasks. Its runner runs only on the local machine and is managed by HQControl, not exposed as a public integration endpoint. Use permissions and logs to keep operations traceable. To read one bit of a tag, use bracket syntax; e.g. ReadTagBoolean("DK.StatusWord[3]", False); the index is a 0-based bit (BYTE 0-7, WORD 0-15, DWORD 0-31), returns a boolean, and is read-only.
Script output
Script output should preserve case and original text. The demo account is allowed to run scripts, but this permission must not leak into unrelated operations.