@@ -383,7 +383,7 @@ module.exports = function (RED) {
383
383
}
384
384
}
385
385
386
- this . handlePing = function ( semverExpr ) {
386
+ this . handlePing = function ( { semverExpr } ) {
387
387
if ( ! semver . satisfies ( VSH_VERSION , semverExpr ) ) {
388
388
return
389
389
}
@@ -402,7 +402,7 @@ module.exports = function (RED) {
402
402
} )
403
403
}
404
404
405
- this . handleKill = function ( reason , semverExpr ) {
405
+ this . handleKill = function ( { reason, semverExpr } ) {
406
406
if ( semverExpr && ! semver . satisfies ( VSH_VERSION , semverExpr ) ) {
407
407
return
408
408
}
@@ -413,10 +413,20 @@ module.exports = function (RED) {
413
413
this . disconnect ( )
414
414
}
415
415
416
+ this . handleSetDeviceStatus = function ( { status, color, devices } ) {
417
+ devices . forEach ( ( deviceId ) => {
418
+ this . execCallbackForOne ( deviceId , 'setStatus' , {
419
+ shape : 'dot' ,
420
+ fill : color ,
421
+ text : status ,
422
+ } )
423
+ } )
424
+ }
425
+
416
426
this . handleService = function ( message ) {
417
427
switch ( message . operation ) {
418
428
case 'ping' :
419
- this . handlePing ( message . semverExpr )
429
+ this . handlePing ( message )
420
430
break
421
431
case 'overrideConfig' :
422
432
if ( message . rateLimiter ) {
@@ -425,8 +435,16 @@ module.exports = function (RED) {
425
435
}
426
436
break
427
437
case 'kill' :
428
- this . handleKill ( message . reason , message . semverExpr )
438
+ this . handleKill ( message )
429
439
break
440
+ case 'setDeviceStatus' :
441
+ this . handleSetDeviceStatus ( message )
442
+ break
443
+ default :
444
+ this . logger (
445
+ `received service request (${ message . operation } ) that is not supported by this VSH version. Updating to the latest version might fix this!` ,
446
+ 'warn'
447
+ )
430
448
}
431
449
}
432
450
0 commit comments