Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateful attribute for properties #108

Merged
merged 2 commits into from
Oct 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ The `lights` node might expose an `intensity` and a `color` property.
Properties can be **settable**.
For 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.

Properties can be **retained**.
A property is retained by default. A non-retained property would be useful for momentary events (door bell pressed).

A combination of those flags compiles into this list:

* **retained + non-settable**: The node publishes a property state (temperature sensor)
* **retained + settable**: The node publishes a property state, and can receive commands for the property (by controller or other party) (lamp power)
* **non-retained + non-settable**: The node publishes momentary events (door bell pressed)
* **non-retained + settable**: The node publishes momentary events, and can receive commands for the property (by controller or other party) (brew coffee)

**Attributes:**
*Devices, nodes and properties* have specific *attributes* characterizing them.
Attributes are represented by topic identifier starting with `$`.
Expand Down Expand Up @@ -437,6 +447,14 @@ A property attribute MUST be one of these:
<td>Yes</td>
<td>No (<code>false</code>)</td>
</tr>
<tr>
<td>$retained</td>
<td>Device → Controller</td>
<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>
Copy link

@bodiroga bodiroga Oct 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the last sentence be "Publishing to a non-retained property topic MUST always happen with the MQTT 'retain' flag 'false'."? IMHO, the 'off' word could be confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"with the MQTT 'retain' flag off" means without the retain flag, not with the flag set to 'off', so I'd say it's fine.

<td><code>true</code> or <code>false</code></td>
<td>Yes</td>
<td>No (<code>true</code>)</td>
</tr>
<tr>
<td>$unit</td>
<td>Device → Controller</td>
Expand Down