> For the complete documentation index, see [llms.txt](https://docs.simplephysx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.simplephysx.com/communications/coap.md).

# CoAP

**YAML key:** `coap_server`

Expose CoAP resources over UDP and map requests onto SPX attributes using resource/binding definitions.

## Minimal configuration

```yaml
attributes:
  temperature: 23.5
  setpoint: 18.0

communication:
  - coap_server:
      host: 127.0.0.1
      port: 5683
      default_payload_codec: json
      resources:
        - name: process
          path: [process]
          bindings:
            - name: temperature_get
              method: get
              direction: outbound
              read_attribute: "#attr(temperature)"
              payload_codec: json
              path: [temperature]
            - name: setpoint_put
              method: put
              direction: inbound
              write_attribute: "#attr(setpoint)"
              payload_codec: json
              path: [setpoint]
```

## Notes

* Dependency: requires `aiocoap` (tests are skipped when it is missing).
* Bindings support `get`, `put`, and `observe`.
