Quickstart

KNX Quickstart: Set a Lighting Level

Set a virtual lighting circuit to 35% and verify the actual brightness through KNX group readback.

Before you begin

Install SPX with KNX and SPX UI. Have a reachable KNX/IP tunnelling gateway and a client that can send raw group values. This quickstart uses the ready-made lighting-zone model; you do not need to generate a model. SPX Setup can provide a virtual knxd gateway, or you can use your own reachable gateway.

Run the test

1. Start the lighting zone

  • In Instances → New instance, choose Building.LightingZone.Knx. If it is missing, import the linked YAML through Models → Load model from file.
  • Set the gateway address reachable from SPX and port 3671. Keep the model's default ga_main of 1, then create and start the instance.
SPX UI selecting the KNX lighting-zone model and gateway settings.
Choose the library model and configure your gateway; this earlier screenshot uses ga_main=7.

Screenshot preview

Choose the library model and configure your gateway; this earlier screenshot uses ga_main=7. Open original image

2. Send a group write

  • Connect your KNX client to the same gateway. The gateway address reachable from your client can differ from the address used by SPX in Docker.
  • Send GroupValueWrite to 1/1/10 with one raw byte 0x32 (decimal 50). This model uses uint8 percentages 0–100, rather than DPT 5.001 scaling or ASCII digits.
SPX UI showing the KNX adapter and lighting-level chart.
Check the gateway settings in the model's Communication tab.

Screenshot preview

Check the gateway settings in the model's Communication tab. Open original image

3. Observe feedback

  • Monitor outgoing writes on 1/1/10 while the actual level approaches 50%. After it settles, send GroupValueRead to 1/1/10 and inspect the response. A separate read of 1/1/15 returns daylight as DPT 9.004.
  • For a visual check, select circuit_a_target_percent and circuit_a_level_percent in SPX UI.
SPX UI graph showing target steps and the actual lighting level ramping in response.
The actual lighting level follows the target rather than changing instantaneously.

Screenshot preview

The actual lighting level follows the target rather than changing instantaneously. Open original image

Check the result

The target and actual brightness should settle at 50%, with a GroupValueResponse containing raw byte 0x32. Intermediate feedback reflects the gradual ramp. When finished, restore your test settings and stop the instance.

The reference below describes the same model with ga_main=7, so replace 7/... with 1/... when following the quickstart above.

Protocol communication

Use these settings and messages with the library’s lighting zone model.

Client / transport
KNX/IP tunnelling → GATEWAY_HOST:3671 over UDP; same gateway as SPX
Address override
ga_main=7 for this exercise; library default: 1
Brightness codec
uint8; one raw byte in 0–100, not DPT 5.001 scaling

Replace host placeholders with reachable addresses and use your published ports.

Swipe the table to see requests and replies.

Addresses, requests and expected replies
Address / messageOperation / payloadExpected reply
7/1/10Circuit A: GroupValueWrite raw 0, 100 or 35; GroupValueReadGroupValueResponse: actual brightness, eventually 0, 100 or 35
7/1/11Circuit B: same read/write uint8 formatActual Circuit B brightness in 0–100%
7/1/14Occupancy: GroupValueWrite; boolean true/false; inbound onlyNo direct readback binding; check occupancy_detected in SPX
7/1/15Daylight: read / outbound updates; DPT 9.004Measured illuminance in lx; varies with the scenario

Values describe this model’s nominal setup unless noted. Live measurements change as the simulation runs.

Example request and reply

Write 0, then 100, then 35 to 7/1/10, waiting for each ramp to settle. Issue GroupValueRead after each step and verify the actual-level response.

GroupValueWrite 7/1/10  payload: 0x64 (decimal 100)
Wait for the ramp; GroupValueRead 7/1/10
→ GroupValueResponse payload: 0x64 (100%)
GroupValueWrite 7/1/10  payload: 0x23 (decimal 35)
Wait; GroupValueRead 7/1/10
→ GroupValueResponse payload: 0x23 (35%)
No reply or an unexpected value?
  • Target writes and actual feedback share 7/1/10 in this model. An immediate read may return an intermediate ramp value.
  • Decimal 35 is raw byte 0x23; decimal 100 is 0x64. Do not send ASCII text or scale 100% to 255.
  • Allow enough gateway tunnels for SPX and your client. If your instance uses ga_main=1, replace 7/... with 1/... on every group address.

Ask your AI agent

Open your SPX workspace in a local AI agent. This is the prompt we tested using a dedicated temporary knx_gateway dummy container. Adapt the gateway address to your own isolated test environment; do not delete an existing gateway.

Prompt for your AI agent

Run a single isolated KNX/IP integration test with the SPX model `Building.LightingZone.Knx` against the virtual knxd dummy bus at `knx_gateway:3671`. Use only group addresses `1/1/10` through `1/1/18`; never connect to or transmit to a physical KNX network. Preserve all existing SPX instances. Use the one available license slot for one temporary instance named `knx_lighting_zone_test`, configure `knx_router_host=knx_gateway`, `knx_router_port=3671`, `ga_main=1`, and start it. Use a KNX client on the same Docker-only network to send a 50% circuit-A write to `1/1/10` and an occupancy write to `1/1/14`, then observe outbound lighting level/daylight and alarms on the configured GAs. Capture the client telegrams and before/after SPX attributes. Stop and delete only the temporary test instance and remove only the temporary knxd container when verification is complete. Report simulated results as virtual-bus evidence, not physical KNX interoperability.

Tested with GPT-6 Luna · Medium

Estimated API cost · $0.0113 per run

In the measured GPT-6 Luna · Medium run, the client sent 0x32 to 1/1/10. The model sent successive levels of 66%, 54% and 50%, and SPX showed both the target and actual level at 50%. SPX reflected the occupancy writes on 1/1/14, and the client received a daylight response on 1/1/15. Toggling the emergency override on 1/1/16 produced an alarm value of 1 on 1/1/17. After restoring the override, both alarm reads returned 0. All traffic ran through a dedicated virtual knxd dummy bus.

Next steps

Create a custom KNX device with an AI agent. For adapter settings, use the KNX guide.