Skip to content

Commit d20c44a

Browse files
committed
feat(device): Include device type and name in outgoing message. Close #5
1 parent 7ba747b commit d20c44a

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

device-types.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,11 @@ const position = val => {
166166
//---DECORATORS---
167167

168168
const defaultDecorator = localState => {
169+
localState.name = localState.friendlyName
170+
localState.type = localState.template
169171
delete localState.friendlyName
170172
delete localState.template
173+
171174
return localState
172175
}
173176

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The _virtual smart home_ skill is available in the Amazon skill stores in the fo
2828
- Blinds
2929
- Garage Door Opener
3030
- no separate account needed. Just link your existing Amazon account.
31-
- new virtual devices can simply be draged onto the Node-RED canvas and will
31+
- new virtual devices can simply be dragged onto the Node-RED canvas and will
3232
proactively be discovered by Alexa. No need to ask Alexa to discover devices.
3333
- devices that are no longer needed can be removed from Alexa via the Node-RED
3434
editor.

virtual-device.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,39 @@ <h3>Payload attributes</h3>
157157
can be found in the 'import nodes' section underneath the 'import' menu.
158158
</p>
159159

160+
<h4>General Attributes (always present)</h4>
161+
<dl class="message-properties">
162+
<dt
163+
>payload.name
164+
<span class="property-type">string</span>
165+
</dt>
166+
<dd>Name of the virtual device</dd>
167+
</dl>
168+
169+
<dl class="message-properties">
170+
<dt
171+
>payload.type
172+
<span class="property-type">string</span>
173+
</dt>
174+
<dd>Type of the virtual device</dd>
175+
</dl>
176+
177+
<dl class="message-properties">
178+
<dt
179+
>payload.source
180+
<span class="property-type">string</span>
181+
</dt>
182+
<dd
183+
><ul
184+
><li>'alexa' if the device update was triggered by Alexa</li>
185+
<li
186+
>'device' if the device update was triggered by an incoming
187+
message.</li
188+
>
189+
</ul></dd
190+
>
191+
</dl>
192+
160193
<h4>Switch</h4>
161194
<dl class="message-properties">
162195
<dt

0 commit comments

Comments
 (0)