@@ -13,6 +13,7 @@ module.exports = function (RED) {
13
13
this . isSubscribed = false
14
14
this . isError = false
15
15
this . isKilled = false
16
+ this . killedStatusText = 'KILLED'
16
17
17
18
this . jobQueue = [ ]
18
19
@@ -141,12 +142,6 @@ module.exports = function (RED) {
141
142
this . discover ( nodeId )
142
143
}
143
144
144
- // this.handleUpdateDelta = function (nodeId, message) {
145
- // this.execCallbackForOne(nodeId, 'setLocalState', message.state)
146
- // this.execCallbackForOne(nodeId, 'emitLocalState')
147
- // this.updateShadow({ nodeId, type: 'reported' })
148
- // }
149
-
150
145
this . handleUpdateAccepted = function ( nodeId , message ) {
151
146
if ( message . state . desired && ! message . state . reported ) {
152
147
//update must have been initiated from Alexa!
@@ -209,7 +204,7 @@ module.exports = function (RED) {
209
204
this . execCallbackForAll ( 'setStatus' , {
210
205
shape : 'dot' ,
211
206
fill : 'red' ,
212
- text : this . isKilled ? 'KILLED' : 'offline'
207
+ text : this . isKilled ? this . killedStatusText : 'offline'
213
208
} )
214
209
}
215
210
} ,
@@ -241,13 +236,16 @@ module.exports = function (RED) {
241
236
this . handleGetRejected ( nodeId , message )
242
237
} else if ( topic . includes ( '/delete/accepted' ) ) {
243
238
this . handleDeleteAccepted ( nodeId )
244
- // } else if (topic.includes('/update/delta')) {
245
- // this.handleUpdateDelta(nodeId, message)
246
239
} else if ( topic . includes ( '/update/accepted' ) ) {
247
240
this . handleUpdateAccepted ( nodeId , message )
248
241
}
249
242
} else if ( topic == `vsh/${ this . credentials . thingId } /kill` ) {
243
+ console . warn (
244
+ 'CONNECTION KILLED! Reason:' ,
245
+ message . reason || 'undefined'
246
+ )
250
247
this . isKilled = true
248
+ this . killedStatusText = message . reason ? message . reason : 'KILLED'
251
249
this . mqttClient . disconnect ( )
252
250
}
253
251
}
@@ -259,7 +257,6 @@ module.exports = function (RED) {
259
257
`$aws/things/${ this . credentials . thingId } /shadow/name/+/delete/accepted` ,
260
258
`$aws/things/${ this . credentials . thingId } /shadow/name/+/get/accepted` ,
261
259
`$aws/things/${ this . credentials . thingId } /shadow/name/+/get/rejected` ,
262
- //`$aws/things/${this.credentials.thingId}/shadow/name/+/update/delta`,
263
260
`$aws/things/${ this . credentials . thingId } /shadow/name/+/update/accepted` ,
264
261
`vsh/${ this . credentials . thingId } /kill`
265
262
]
0 commit comments