homieiot/convention

Changes

Changes from v3.0.1 to v4.0.0

Commits

Commit title Date Hash
Remove array brackets in super-car example (#177) 2019-08-27 14:01:18 +0200 12453d8
Corections to meta extension (#173) 2019-07-18 00:07:23 +0200 2c1999e
Fixed typos and broken links, removed whitespace in homie_legacy_stat… (#172) 2019-07-17 21:13:33 +0200 608541a
Extension Convention (#171) 2019-07-16 22:55:32 +0200 eaf3edc
remove references to deprecated arrays (#169) 2019-07-03 19:56:14 +0800 9ac3433
Point Last Will section to $state (#157) 2019-03-07 17:30:43 +0900 a3ea000
Remove timings paragraph. Rename behaviour to lifecycle. (#155) 2019-01-21 09:57:06 +0100 96dcc73
Fix typos (#153) 2019-01-10 20:50:15 -0700 616f8af
Fix extension suffix typo (#147) 2018-12-05 16:20:32 +0100 1c417dc
Correct spelling and wording (#144) 2018-11-29 19:15:19 +0100 0c012f4
Add subheading for “Property command topic” (#145) 2018-11-29 19:13:30 +0100 ecc7aa4
Remove 3.x arrays 2018-11-26 19:45:36 +0100 bb58910
$stats: Remove from device 2018-11-26 21:53:13 +0100 2827c1e
Remove $stats 2018-11-26 19:53:41 +0100 3fa7acd
Move property settable/retained explanation down 2018-11-26 19:48:57 +0100 98ae53d
Fix wording in timing 2018-11-26 19:44:48 +0100 d976e02
Fix formatting for the webpage markdown renderer 2018-11-26 19:42:49 +0100 80c5fdb
Remove requirement for the homie/ base topic 2018-11-26 14:35:33 +0100 79a214d
Fix travis-ci file 2018-11-23 10:54:02 +0100 cfe82b1
Additional specificity on payload definitions (#133) 2018-11-22 23:21:28 -0500 e83bbc2
Fix image link 2018-11-21 09:28:32 +0100 b0e33fd
Last will limitation 2018-11-20 12:13:44 +0100 bcdd965
Add travis-ci file to trigger webpage build 2018-11-20 11:54:33 +0100 e92702e
Array, Broadcast Channel, Extensions are on heading level 2 2018-11-18 13:46:21 +0100 84b36f3
Table clean up 2018-11-18 13:29:28 +0100 0678972
Updates to 2018-11-12 09:47:50 +0100 dea1380
Update extension section 2018-11-08 08:16:07 +0100 c2f1fcb
Add $specs for extension specification. 2018-11-07 14:54:40 +0100 99dc487
Update convention.md 2018-11-07 00:22:18 +0100 8b001ee
FIX: Numeric payload decimal separator is a dot 2018-11-04 23:48:54 +0100 c056ccc
Fix: Overflowing table 2018-11-06 01:11:34 +0100 5da9704
$stats/interval fix 2018-11-04 23:45:22 +0100 98ce2a3
BREAKING: Homie is about Lightweight topic discovery 2018-10-31 14:43:10 +0100 240f0bb
Change values to payload 2018-11-04 13:54:32 -0500 f23e16c
Remove parts that belong on a web page instead. License. 2018-10-28 21:30:59 +0100 84d2388
Fixed wording on init state. (#116) 2018-10-29 14:52:53 -0400 910f936

Differences


v3.0.1
v4.0.0
n2source: README.mdn2source: convention.md
3version: v3.0.13version: v4.0.0
4releasedate: 27. October 20184releasedate: 27. August 2019
n11## Table of Contentsn
12
13* [Motivation](#motivation)
14* [MQTT restrictions](#mqtt-restrictions)
15 * [Topic IDs](#topic-ids)
16 * [Payload](#payload)
17 * [QoS and retained messages](#qos-and-retained-messages)
18* [Topology](#topology)
19 * [Base topic](#base-topic)
20 * [Devices](#devices)
21 * [Device attributes](#device-attributes)
22 * [Device behavior](#device-behavior)
23 * [Device statistics](#device-statistics)
24 * [Nodes](#nodes)
25 * [Node attributes](#node-attributes)
26 * [Properties](#properties)
27 * [Property attributes](#property-attributes)
28 * [Arrays](#arrays)
29 * [Broadcast channel](#broadcast-channel)
30* [FAQ and Rationale](#faq)
31
32
33## Motivation
34
35The Homie convention strives to be a **communication definition on top of MQTT** between IoT devices and controlling entities.
36
37> [MQTT](http://mqtt.org) is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol.
38> It was designed as an extremely lightweight publish/subscribe messaging transport.
39
40MQTT supports easy and unrestricted message-based communication.
41However, MQTT doesn't define the structure and content of these messages and their relation.
42An IoT device publishes data and provides interaction possibilities but a controlling entity will need to be specifically configured to be able to interface with the device.
43
44The Homie convention defines a **standardized way** of how IoT devices and services announce themselves and their data on the communication channel.
45The Homie convention is thereby a crucial aspect in the support of **automatic discovery, configuration and usage** of devices and services over the MQTT protocol.
46
47----
48
n60The underscore (`_`) is used and reserved for Homie *node arrays*.n
n64Every MQTT message payload MUST be sent as string.n25- Every MQTT message payload MUST be sent as a UTF-8 encoded string
65If a value is of a numeric data type, it MUST be converted to string.26- The value published as payload MUST be valid for the respective property/attribute type as per the list below
66Booleans MUST be converted to "true" or "false".27
67All values MUST be encoded as UTF-8 strings. 28#### String
29
30- String types are limited to 268,435,456 characters
31- An empty string ("") is a valid payload
32
33#### Integer
34
35- Integer types are UTF-8 encoded string literal representations of 64-bit signed whole numbers
36- Integers range from -9,223,372,036,854,775,808 (-2<sup>63</sup>) to 9,223,372,036,854,775,807 (2<sup>63</sup>-1)
37- The payload may only contain whole numbers and the negation character "-". No other characters including spaces (" ") are permitted
38- A string with just a negation sign ("-") is not a valid payload
39- An empty string ("") is not a valid payload
40
41#### Float
42
43- Float types are UTF-8 encoded string literal representations of 64-bit signed floating point numbers
44- Floats range from 2<sup>-1074</sup> to (2-2<sup>-52</sup>)&ast;2<sup>1023</sup>
45- The payload may only contain whole numbers, the negation character "-", the exponent character "e" or "E" and the decimal separator ".", no other characters, including spaces (" ") are permitted
46- The dot character (".") is the decimal separator (used if necessary) and may only have a single instance present in the payload
47- Representations of numeric concepts such as "NaN" (Not a Number) and "Infinity" are not a valid payload
48- A string with just a negation sign ("-") is not a valid payload
49- An empty string ("") is not a valid payload
50
51#### Boolean
52
53- Booleans must be converted to the string literals "true" or "false"
54- Representation is case sensitive, e.g. "TRUE" or "FALSE" are not valid payloads.
55- An empty string ("") is not a valid payload
56
57#### Enum
58
59- Enum payloads must be one of the values specified in the format definition of the property
60- Enum payloads are case sensitive, e.g. "Car" will not match a format definition of "car"
61- Payloads should have leading and trailing whitespace removed
62- An empty string ("") is not a valid payload
63
64#### Color
65
66- Color payload validity varies depending on the property format definition of either "rgb" or "hsv"
67- Both payload types contain comma separated whole numbers of differing restricted ranges
68- The encoded string may only contain whole numbers and the comma character ",", no other characters are permitted, including spaces (" ")
69- Payloads for type "rgb" contains 3 comma separated values of numbers with a valid range between 0 and 255. e.g. 100,100,100
70- Payloads for type "hsv" contains 3 comma separated values of numbers. The first number has a range of 0 to 360, the second and third numbers have a range of 0 to 100. e.g. 300,50,75
71- An empty string ("") is not a valid payload
72
nn78
79### Last will
80
81MQTT only allows one last will message per connection.
82Homie requires the last will (LWT) to set the `homie` / `device ID` / `$state` attribute to the value **`lost`**, see [Device Lifecycle](#device-lifecycle).
83As a consequence a new MQTT connection to the broker is required per published device.
84
85## Base Topic
86
87The root topic in this document is `homie/`.
88If this root topic does not suit your needs (in case of, e.g., a public broker or because of branding),
89you can choose another.
90
91Homie controllers must by default perform auto-discovery on the wildcard topic "+/+/$homie".
92Controllers are free to restrict discovery to a specific root topic, configurable by the user.
n84 n
85Nodes can be **arrays**.
86For example, instead of creating two `lights` node to control front lights and back lights independently, we can set the `lights` node to be an array with two elements.
n95Properties can be **settable**.n
96For example, you don't want your `temperature` property to be settable in case of a temperature sensor (like the car example), but to be settable in case of a thermostat.
97
98Properties can be **retained**.
99A property is retained by default. A non-retained property would be useful for momentary events (door bell pressed).
100
101A combination of those flags compiles into this list:
102
103* **retained + non-settable**: The node publishes a property state (temperature sensor)
104* **retained + settable**: The node publishes a property state, and can receive commands for the property (by controller or other party) (lamp power)
105* **non-retained + non-settable**: The node publishes momentary events (door bell pressed)
106* **non-retained + settable**: The node publishes momentary events, and can receive commands for the property (by controller or other party) (brew coffee)
107
n115----n
116
117### Base Topic
118
119The base topic you will see in the following convention will be `homie/`.
120If this base topic does not suit your needs (in case of, e.g., a public broker), you can choose another.
121
122Be aware, that only the default base topic `homie/` is eligible for automatic discovery by third party controllers.
123
124----
125
n134When the MQTT connection to the broker is established or re-established, the device MUST send its attributes to the broker immediately.n
n136<table>n128The following device attributes are mandatory and MUST be send, even if it is just an empty string.
137 <tr>
138 <th>Topic</th>
139 <th>Direction</th>
140 <th>Description</th>
141 <th>Retained</th>
142 <th>Required</th>
143 </tr>
144 <tr>
145 <td>$homie</td>
146 <td>Device → Controller</td>
147 <td>Version of the Homie convention the device conforms to</td>
148 <td>Yes</td>
149 <td>Yes</td>
150 </tr>
151 <tr>
152 <td>$name</td>
153 <td>Device → Controller</td>
154 <td>Friendly name of the device</td>
155 <td>Yes</td>
156 <td>Yes</td>
157 </tr>
158 <tr>
159 <td>$state</td>
160 <td>Device → Controller</td>
161 <td>
162 See <a href="#device-behavior">Device behavior</a>
163 </td>
164 <td>Yes</td>
165 <td>Yes</td>
166 </tr>
167 <tr>
168 <td>$localip</td>
169 <td>Device → Controller</td>
170 <td>IP of the device on the local network</td>
171 <td>Yes</td>
172 <td>Yes</td>
173 </tr>
174 <tr>
175 <td>$mac</td>
176 <td>Device → Controller</td>
177 <td>Mac address of the device network interface. The format MUST be of the type <code>A1:B2:C3:D4:E5:F6</code></td>
178 <td>Yes</td>
179 <td>Yes</td>
180 </tr>
181 <tr>
182 <td>$fw/name</td>
183 <td>Device → Controller</td>
184 <td>Name of the firmware running on the device. Allowed characters are the same as the device ID</td>
185 <td>Yes</td>
186 <td>Yes</td>
187 </tr>
188 <tr>
189 <td>$fw/version</td>
190 <td>Device → Controller</td>
191 <td>Version of the firmware running on the device</td>
192 <td>Yes</td>
193 <td>Yes</td>
194 </tr>
195 <tr>
196 <td>$nodes</td>
197 <td>Device → Controller</td>
198 <td>
199 Nodes the device exposes, with format <code>id</code> separated by a <code>,</code> if there are multiple nodes.
200 To make a node an array, append <code>[]</code> to the ID.
201 </td>
202 <td>Yes</td>
203 <td>Yes</td>
204 </tr>
205 <tr>
206 <td>$implementation</td>
207 <td>Device → Controller</td>
208 <td>An identifier for the Homie implementation (example <code>esp8266</code>)</td>
209 <td>Yes</td>
210 <td>Yes</td>
211 </tr>
212 <tr>
213 <td>$implementation/#</td>
214 <td>Controller → Device or Device → Controller</td>
215 <td>You can use any subtopics of <code>$implementation</code> for anything related to your specific Homie implementation.</td>
216 <td>Yes or No, depending of your implementation</td>
217 <td>No</td>
218 </tr>
219 <tr>
220 <td>$stats</td>
221 <td>Device → Controller</td>
222 <td>Specify all optional stats that the device will announce, with format <code>stats</code> separated by a <code>,</code> if there are multiple stats. See next section for an example</td>
223 <td>Yes</td>
224 <td>Yes</td>
225 </tr>
226 <tr>
227 <td>$stats/interval</td>
228 <td>Device → Controller</td>
229 <td>Interval in seconds at which the device refreshes its <code>$stats/+</code>: See next section for details about statistical attributes</td>
230 <td>Yes</td>
231 <td>Yes</td>
232 </tr>
233</table>
nn130| Topic | Description |
131|-------------|--------------------------------------------------------------------------:|
132| $homie | The implemented Homie convention version |
133| $name | Friendly name of the device |
134| $state | See [Device Lifecycle](#device-lifecycle) |
135| $nodes | [Nodes](#nodes) the device exposes, separated by `,` for multiple ones. |
136| $extensions | Supported extensions, separated by `,` for multiple ones. |
137
138Optional topics include:
139
140| Topic | Description |
141|-----------------|-------------------------------|
142| $implementation | An identifier for the Homie implementation (example "esp8266") |
143
235For example, a device with an ID of `super-car` that comprises off a `wheels`, `engine` and a `lights` node would send:144For example, a device with an ID of `super-car` that comprises of a `wheels`, `engine` and a `lights` node would send:
n240homie/super-car/$localip → "192.168.0.10"n
241homie/super-car/$mac → "DE:AD:BE:EF:FE:ED"
242homie/super-car/$fw/name → "weatherstation-firmware"
243homie/super-car/$fw/version → "1.0.0"
244homie/super-car/$nodes → "wheels,engine,lights[]"149homie/super-car/$nodes → "wheels,engine,lights"
n246homie/super-car/$stats/interval → "60"n
n250#### Device Behaviorn154#### Device Lifecycle
n252The `$state` device attribute represents, as the name suggests, the current state of the device.n156The `$state` device attribute represents the current state of the device.
n256This is the first message that must that must be sent.n160This state is optional, and may be sent if the device takes a long time to initialize, but wishes to announce to consumers that it is coming online.
257* **`ready`**: this is the state the device is in when it is connected to the MQTT broker, has sent all Homie messages and is ready to operate.161* **`ready`**: this is the state the device is in when it is connected to the MQTT broker, has sent all Homie messages and is ready to operate. A Homie Controller can assume default values for all optional topics.
258You have to send this message after all other announcements message have been sent.
n268#### Device Statisticsn
269
270* `homie` / `device ID` / `$stats`/ **`$device-statistic-attribute`**:
271The `$stats/` hierarchy allows to send device attributes that change over time. The device MUST send them every `$stats/interval` seconds.
272
273<table>
274 <tr>
275 <th>Topic</th>
276 <th>Direction</th>
277 <th>Description</th>
278 <th>Retained</th>
279 <th>Required</th>
280 </tr>
281 <tr>
282 <td>$stats/uptime</td>
283 <td>Device → Controller</td>
284 <td>Time elapsed in seconds since the boot of the device</td>
285 <td>Yes</td>
286 <td>Yes</td>
287 </tr>
288 <tr>
289 <td>$stats/signal</td>
290 <td>Device → Controller</td>
291 <td>Signal strength in %</td>
292 <td>Yes</td>
293 <td>No</td>
294 </tr>
295 <tr>
296 <td>$stats/cputemp</td>
297 <td>Device → Controller</td>
298 <td>CPU Temperature in °C</td>
299 <td>Yes</td>
300 <td>No</td>
301 </tr>
302 <tr>
303 <td>$stats/cpuload</td>
304 <td>Device → Controller</td>
305 <td>
306 CPU Load in %.
307 Average of last <code>$interval</code> including all CPUs
308 </td>
309 <td>Yes</td>
310 <td>No</td>
311 </tr>
312 <tr>
313 <td>$stats/battery</td>
314 <td>Device → Controller</td>
315 <td>Battery level in %</td>
316 <td>Yes</td>
317 <td>No</td>
318 </tr>
319 <tr>
320 <td>$stats/freeheap</td>
321 <td>Device → Controller</td>
322 <td>Free heap in bytes</td>
323 <td>Yes</td>
324 <td>No</td>
325 </tr>
326 <tr>
327 <td>$stats/supply</td>
328 <td>Device → Controller</td>
329 <td>Supply Voltage in V</td>
330 <td>Yes</td>
331 <td>No</td>
332 </tr>
333</table>
334
335For example, our `super-car` device with `$stats/interval` value "60" is supposed to send its current values every 60 seconds:
336
337```java
338homie/super-car/$stats → "uptime,cputemp,signal,battery"
339homie/super-car/$stats/uptime → "120"
340homie/super-car/$stats/cputemp → "48"
341homie/super-car/$stats/signal → "24"
342homie/super-car/$stats/battery → "80"
343```
344
345----
346
n355A node attribute MUST be one of these:n
n357<table>n180All listed attributes are **required**. A node attribute MUST be one of these:
358 <tr>181
359 <th>Topic</th>182| Topic | Description |
360 <th>Direction</th>183|-------------|-------------------------------------------------------------------------------------------|
361 <th>Description</th>184| $name | Friendly name of the Node |
362 <th>Retained</th>185| $type | Type of the node |
363 <th>Required</th>186| $properties | Exposed properties, separated by `,` for multiple ones. |
364 </tr>
365 <tr>
366 <td>$name</td>
367 <td>Device → Controller</td>
368 <td>Friendly name of the Node</td>
369 <td>Yes</td>
370 <td>Yes</td>
371 </tr>
372 <tr>
373 <td>$type</td>
374 <td>Device → Controller</td>
375 <td>Type of the node</td>
376 <td>Yes</td>
377 <td>Yes</td>
378 </tr>
379 <tr>
380 <td>$properties</td>
381 <td>Device → Controller</td>
382 <td>
383 Properties the node exposes, with format <code>id</code> separated by a <code>,</code> if there are multiple nodes.
384 </td>
385 <td>Yes</td>
386 <td>Yes</td>
387 </tr>
388 <tr>
389 <td>$array</td>
390 <td>Device → Controller</td>
391 <td>Range separated by a <code>-</code>. e.g. <code>0-2</code> for an array with the indexes <code>0</code>, <code>1</code> and <code>2</code></td>
392 <td>Yes</td>
393 <td>Yes, if the node is an array</td>
394 </tr>
395</table>
n405----n
406
n412* A property value (e.g. a sensor reading) is directly published to the property topic, e.g.:n201* A property payload (e.g. a sensor reading) is directly published to the property topic, e.g.:
nn205
206* Properties can be **settable**.
207 For example, you don't want your `temperature` property to be settable in case of a temperature sensor
208 (like the car example), but to be settable in case of a thermostat.
209
210* Properties can be **retained**.
211 A property is retained by default. A non-retained property would be useful for momentary events (door bell pressed).
212
213A combination of those flags compiles into this list:
214
215* **retained + non-settable**: The node publishes a property state (temperature sensor)
216* **retained + settable**: The node publishes a property state, and can receive commands for the property (by controller or other party) (lamp power)
217* **non-retained + non-settable**: The node publishes momentary events (door bell pressed)
218* **non-retained + settable**: The node publishes momentary events, and can receive commands for the property (by controller or other party) (brew coffee)
219
n420A property attribute MUST be one of these:n
n422<table>n225The following attributes are required:
423 <tr>226
424 <th>Topic</th>227| Topic | Description | Payload type |
425 <th>Direction</th>228|-----------|------------------------------------------------------|---------------------------------------------|
426 <th>Description</th>229| $name | Friendly name of the property. | String |
427 <th>Valid values</th>230| $datatype | The data type. See [Payloads](#payloads). | Enum: \[integer, float, boolean,string, enum, color\] |
428 <th>Retained</th>231
429 <th>Required (Default)</th>232The following attributes are optional:
430 </tr>233
431 <tr>234| Topic | Description | Payload type |
432 <td>$name</td>235|-----------|------------------------------------------------------|---------------------------------------------|
433 <td>Device → Controller</td>236| $format | Specifies restrictions or options for the given data type | See below |
434 <td>Friendly name of the property.</td>237| $settable | Settable (<code>true</code>). Default is read-only (<code>false</code>) | Boolean |
435 <td>Any String</td>238| $retained | Non-retained (<code>false</code>). Default is Retained (<code>true</code>). | Boolean |
436 <td>Yes</td>239| $unit | Optional unit of this property. See list below. | String |
437 <td>No ("")</td>
438 </tr>
439 <tr>
440 <td>$settable</td>
441 <td>Device → Controller</td>
442 <td>Specifies whether the property is settable (<code>true</code>) or readonly (<code>false</code>)</td>
443 <td><code>true</code> or <code>false</code></td>
444 <td>Yes</td>
445 <td>No (<code>false</code>)</td>
446 </tr>
447 <tr>
448 <td>$retained</td>
449 <td>Device → Controller</td>
450 <td>Specifies whether the property is retained (<code>true</code>) or non-retained (<code>false</code>). Publishing to a non-retained property topic MUST always happen with the MQTT 'retain' flag off.</td>
451 <td><code>true</code> or <code>false</code></td>
452 <td>Yes</td>
453 <td>No (<code>true</code>)</td>
454 </tr>
455 <tr>
456 <td>$unit</td>
457 <td>Device → Controller</td>
458 <td>
459 A string containing the unit of this property.
460 You are not limited to the recommended values, although they are the only well known ones that will have to be recognized by any Homie consumer.
461 </td>
462 <td>
463 Recommended:<br>
464 <code>°C</code> Degree Celsius<br>
465 <code>°F</code> Degree Fahrenheit<br>
466 <code>°</code> Degree<br>
467 <code>L</code> Liter<br>
468 <code>gal</code> Galon<br>
469 <code>V</code> Volts<br>
470 <code>W</code> Watt<br>
471 <code>A</code> Ampere<br>
472 <code>%</code> Percent<br>
473 <code>m</code> Meter<br>
474 <code>ft</code> Feet<br>
475 <code>Pa</code> Pascal<br>
476 <code>psi</code> PSI<br>
477 <code>#</code> Count or Amount
478 </td>
479 <td>Yes</td>
480        <td>No ("")</td>
481 </tr>
482 <tr>
483 <td>$datatype</td>
484 <td>Device → Controller</td>
485 <td>Describes the format of data.</td>
486 <td>
487 <code>integer</code>,
488 <code>float</code>,
489 <code>boolean</code>,
490 <code>string</code>,
491 <code>enum</code>,
492 <code>color</code>
493 </td>
494 <td>Yes</td>
495 <td>No (<code>string</code>)</td>
496 </tr>
497 <tr>
498 <td>$format</td>
499 <td>Device → Controller</td>
500 <td>
501 Describes what are valid values for this property.
502 </td>
503 <td>
504 <ul>
505 <li>
506 <code>from:to</code> Describes a range of values e.g. <code>10:15</code>.
507 <br>Valid for datatypes <code>integer</code>, <code>float</code>
508 </li>
509 <li>
510 <code>value,value,value</code> for enumerating all valid values.
511 Escape <code>,</code> by using <code>,,</code>. e.g. <code>A,B,C</code> or <code>ON,OFF,PAUSE</code>.
512 <br>Valid for datatypes <code>enum</code>
513 </li>
514 <li>
515 <code>rgb</code> to provide colors in RGB format e.g. <code>255,255,0</code> for yellow.
516 <code>hsv</code> to provide colors in HSV format e.g. <code>60,100,100</code> for yellow.
517 <br>Valid for datatype <code>color</code>
518 </li>
519 </ul>
520 </td>
521 <td>Yes</td>
522 <td>No for $datatype <code>string</code>,<code>integer</code>,<code>float</code>,<code>boolean</code>. Yes for <code>enum</code>,<code>color</code></td>
523 </tr>
524</table>
nn252Format:
253
254* For `integer` and `float`: Describes a range of payloads e.g. `10:15`
255* For `enum`: `payload,payload,payload` for enumerating all valid payloads.
256* For `color`:
257 - `rgb` to provide colors in RGB format e.g. `255,255,0` for yellow.
258 - `hsv` to provide colors in HSV format e.g. `60,100,100` for yellow.
259
260Recommended unit strings:
261
262* `°C`: Degree Celsius
263* `°F`: Degree Fahrenheit
264* `°`: Degree
265* `L`: Liter
266* `gal`: Galon
267* `V`: Volts
268* `W`: Watt
269* `A`: Ampere
270* `%`: Percent
271* `m`: Meter
272* `ft`: Feet
273* `Pa`: Pascal
274* `psi`: PSI
275* `#`: Count or Amount
276
277You are not limited to the recommended values, although they are the only well known ones that will have to be recognized by any Homie consumer.
278
279#### Property command topic
280
537* `homie` / `device ID` / `node ID` / `property ID` / **`set`**: the device can subscribe to this topic if the property is **settable** from the controller, in case of actuators.281* `homie` / `device ID` / `node ID` / `property ID` / **`set`**: The device must subscribe to this topic if the property is **settable** (in case of actuators for example).
n539Homie is state-based.n283A Homie controller publishes to the `set` command topic with non-retained messages only.
540You don't tell your smartlight to `turn on`, but you tell it to put its `power` state to `on`.
541This especially fits well with MQTT, because of retained message.
n543For example, a `kitchen-light` device exposing a `light` node would subscribe to `homie/kitchen-light/light/power/set` and it would receive:n285The assigned and processed payload must be reflected by the Homie device in the property topic `homie` / `device ID` / `node ID` / `property ID` as soon as possible.
286This property state update not only informs other devices about the change but closes the control loop for the commanding controller, important for deterministic interaction with the client device.
287
288To give an example: A `kitchen-light` device exposing the `light` node with a settable `power` property subscribes to the topic `homie/kitchen-light/light/power/set` for commands:
n549The device would then turn on the light, and update its `power` state.n294In response the device will turn on the light and upon success update its `power` property state accordingly:
550This provides pessimistic feedback, which is important for home automation.
n556### Arraysn
557
558A node can be an array if you've added `[]` to its ID in the `$nodes` device attribute, and if its `$array` attribute is set to the range of the array.
559Let's consider we want to control independently the front lights and back lights of our `super-car`. Our `lights` node array would look like this. Note that the topic for an element of the array node is the name of the node followed by a `_` and the index getting updated:
560
561```java
562homie/super-car/$nodes → "lights[]"
563
564homie/super-car/lights/$name → "Lights"
565homie/super-car/lights/$properties → "intensity"
566homie/super-car/lights/$array → "0-1"
567
568homie/super-car/lights/intensity/$name → "Intensity"
569homie/super-car/lights/intensity/$settable → "true"
570homie/super-car/lights/intensity/$unit → "%"
571homie/super-car/lights/intensity/$datatype → "integer"
572homie/super-car/lights/intensity/$format → "0:100"
573
574homie/super-car/lights_0/$name → "Back lights"
575homie/super-car/lights_0/intensity → "0"
576homie/super-car/lights_1/$name → "Front lights"
577homie/super-car/lights_1/intensity → "100"
578```
579
580Note that you can name each element in your array individually ("Back lights", etc.).
581
582----
583
584### Broadcast Channel300## Broadcast Channel
n586Homie defines a broadcast channel, so a controller is able to broadcast a message to every Homie devices:n302Homie defines a broadcast channel, so a controller is able to broadcast a message to all Homie devices:
n601----n317## Extensions
602----
n604## FAQn319This convention only covers discoverability of devices and its capabilities.
320The aim is to have standardized MQTT topics for all kind of complex scenarios.
321A Homie device may therefore support extensions, defined in separate documents.
322Every extension is identified by a unique ID.
n606In this section frequently asked questions will be answered.n324The ID consists of the reverse domain name and a freely chosen suffix.
607This includes design decisions and drawn compromises in the specifics of the Homie convention.325The proper term `homie` is reserved and must not be used as the suffix or as part of the domain name.
n609### How do I query/request a property?n327For example, an organization `example.org` wanting to add a feature `our-feature` would choose the extension ID `org.example.our-feature`.
n611You don't.n329Every extension must be published using a license.
612The MQTT protocol does not implement the request-reply but rather the publish-subscribe messaging pattern.330The license can be chosen freely, even proprietary licenses are possible.
613The Homie convention follows the publish-subscribe principle by publishing data as retained messages on a regular basis.331The recommended license is the [CCA 4.0](https://homieiot.github.io/license), since this is the license Homie itself uses.
614You might want to rethink the design of your application - in most scenarios a regularly updated information is sufficient.
n616*Workaround:* You are free to implement your own ideas on top of the basic structure of the Homie convention.n
617You could either implement a `get` getter topic and its logic to trigger a value update, or you may exploit the concept of Homie properties and define a settable property to trigger a value update.
t619A discussion on the matter can be found in issue [#79](https://github.com/homieiot/convention/issues/79).t
620
621