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

Elaborate on the $type idea #92

Closed
wants to merge 2 commits into from
Closed
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
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,21 +353,21 @@ A node attribute MUST be one of these:
<th>Direction</th>
<th>Description</th>
<th>Retained</th>
<th>Required</th>
<th>Required (default)</th>
</tr>
<tr>
<td>$name</td>
<td>Device → Controller</td>
<td>Friendly name of the Node</td>
<td>Yes</td>
<td>Yes</td>
<td>No (the node ID is used)</td>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds like the view by someone who implements the controller side of the convention 😃
From the convention side of things: Do we want to give such promises or do we want to leave this decision to the controller?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I'm not sure about this one. It potentially saves space on the device if the node is called "Temperature" and the name would be the same.

</tr>
<tr>
<td>$type</td>
<td>Device → Controller</td>
<td>Type of the node</td>
<td>Yes</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>$properties</td>
Expand All @@ -391,10 +391,15 @@ For example, our `engine` node would send:

```java
homie/super-car/engine/$name → "Car engine"
homie/super-car/engine/$type → "V8"
homie/super-car/engine/$type → "engine"
homie/super-car/engine/$properties → "speed,direction,temperature"
```

`$type` can be any Topic ID string. The following predefined node types allow controllers to identify and present a node in a more distinct way:

* "light": A controller can assume the node is a lamp. A lamp node should have a power and optionally a color property.
* "switch": A switch has a power property and can be stateless (push button).

----

### Properties
Expand Down Expand Up @@ -464,6 +469,14 @@ A property attribute MUST be one of these:
<td>Yes</td>
       <td>No ("")</td>
</tr>
<tr>
<td>$type</td>
<td>Device → Controller</td>
<td>The type/category of this property</td>
<td>Topic ID string, see recommended types below</td>
<td>Yes</td>
<td>No (The property ID is used)</td>
</tr>
<tr>
<td>$datatype</td>
<td>Device → Controller</td>
Expand Down Expand Up @@ -508,6 +521,10 @@ A property attribute MUST be one of these:
</tr>
</table>

`$type` can be any Topic ID string. If it is not specified, the property ID is used for `$type`. The following predefined property types allow controllers to identify and present a property in a more distinct way:

* "temperature": The integer or float value represents a temperature reading

For example, our `temperature` property would send:

```java
Expand Down