Přeskočit obsah

PQA037 — Reference identity must be unique

A type's identity: names a deviceRef, but its unique: is not the same set of properties.

Two nodes that point to the same Thing carry the same identity key. Re-pairing cannot tell them apart, so one of them would take the id of the other.

- type_id: PeridectLine
  identity: [master_lcp]     # no unique: two lines may start on one line controller
  properties:
    master_lcp:
      type: PeridectLcp
      required: true

Why the build refuses this

unique: makes the tree build refuse the pair. A tree with two lines on one line controller then fails at start with a clear error on both devices, instead of a discovery that silently merges them.

How to fix it

Declare the identity as unique.

identity: [master_lcp]
unique: [master_lcp]

What is not reported

A scalar identity. identity: [address] names no deviceRef, and this rule does not apply.

If you disagree with a report

Do not suppress it. A wrong report is a bug in the check — report it with the YAML that triggered it.