forked from cakebake/node-red-contrib-alexa-remote-cakebaked
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathalexa-remote-event.html
89 lines (85 loc) · 3.27 KB
/
alexa-remote-event.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<script type="text/x-red" data-template-name="alexa-remote-event">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Optional">
</div>
<div class="form-row">
<label for="node-input-account"><i class="fa fa-amazon"></i> Account</label>
<input id="node-input-account">
</div>
<div class="form-row">
<label for="node-input-event"><i class="fa fa-sort"></i> Command</label>
<select id="node-input-event" style="width: 70%">
<option value="ws-disconnect" >Disconnect </option>
<option value="ws-error" >Error </option>
<option value="ws-connect" >Connect </option>
<option value="ws-unknown-message" >Unknown Message </option>
<option value="ws-device-connection-change" >Device Connection Change </option>
<option value="ws-bluetooth-state-change" >Bluetooth State Change </option>
<option value="ws-audio-player-state-change">Audioplayer State Change </option>
<option value="ws-media-queue-change" >Media Queue Change </option>
<option value="ws-media-change" >Media Change </option>
<option value="ws-media-progress-change" >Media Progress Change </option>
<option value="ws-volume-change" >Volume Change </option>
<option value="ws-content-focus-change" >Content Focus Change </option>
<option value="ws-equilizer-state-change" >Equalizer State Change </option>
<option value="ws-notification-change" >Notification Change </option>
<option value="ws-device-activity" >Device Activity </option>
<option value="ws-todo-change" >Todo List Change </option>
<option value="ws-unknown-command" >Unknown Command </option>
<option value="command" >All Events (raw data) </option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="alexa-remote-event">
<style>
table, th, td {
border-collapse: collapse;
border: 1px solid rgb(204, 204, 204);
padding: 4px 8px;
}
</style>
<p>Listens to Push events.
Events must be enabled for this account.</p>
<hr>
<h3><strong>Outputs</strong></h3>
<ul>
<li><strong>payload</strong>
<ul>
<li>the event payload</li>
</ul>
</li>
</ul>
<hr>
<h3><strong>References</strong></h3>
<ul>
<li><a href="https://npmjs.com/package/node-red-contrib-alexa-remote2">npm</a> - the nodes npm repository</li>
<li><a href="https://github.com/586837r/node-red-contrib-alexa-remote2">GitHub</a> - the nodes GitHub repository
</li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('alexa-remote-event', {
category: 'alexa',
color: '#6fbad8',
defaults: {
name: { value: '' },
account: { value: '', type: 'alexa-remote-account', required: true },
event: { value: 'ws-device-activity', required: true }
},
inputs: 0,
outputs: 1,
icon: 'alexa-remote-icon.png',
paletteLabel: 'Alexa Event',
label: function () {
if (this.name) return this.name;
if (this.event == 'command') return 'On any event (raw data)';
const match = this.event.slice(3).match(/(?:[A-Z]?[a-z]+)|[A-Z]|[0-9]+/g);
var str = match.map(s => s.slice(0, 1).toUpperCase() + s.slice(1)).join(' ');
return `On ${str}`;
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
}
});
</script>