PQA035 — Reference identity must be a required single deviceRef¶
A type's
identity:names a deviceRef that is optional or that holds a list of Things.
Some devices have no vendor id of their own. Their identity is the Thing they belong to: a perimeter line is "the line that starts on this line controller". identity: may name such a deviceRef, and re-discovery then pairs the node by the Thing the reference points to.
- type_id: PeridectLine
identity: [master_lcp]
unique: [master_lcp]
properties:
master_lcp:
type: PeridectLcp
required: false # an empty reference cannot identify a line
Why the build refuses this¶
An empty reference is the same key for every node. Two lines without master_lcp both carry an empty key, so re-pairing mixes them up.
A list has no single target. A node that points to three Things has no one Thing to be paired by.
How to fix it¶
Declare the reference required and single.
Or pick a scalar identity. When the device has a stable vendor id, an address or a channel, that property is the better identity.
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.