Skip to content

Commit

Permalink
Restrict endpoint health connectivity property (#458)
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <jeremy.setton@gmail.com>
  • Loading branch information
jsetton authored Dec 24, 2021
1 parent 31faf64 commit 9779dea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
8 changes: 8 additions & 0 deletions lambda/alexa/smarthome/properties/connectivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ class Connectivity extends AlexaProperty {
*/
static UNREACHABLE = 'UNREACHABLE';

/**
* Returns if is valid
* @return {Boolean}
*/
get isValid() {
return !this.item;
}

/**
* Returns alexa state
* @param {Array} items
Expand Down
55 changes: 35 additions & 20 deletions lambda/test/alexa/cases/discovery/light.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,42 @@ module.exports = {
}
},
{
type: 'Dimmer',
name: 'light7',
label: 'Dimmer Light 7',
groupNames: ['gLight9'],
type: 'Switch',
name: 'connectivity6',
groupNames: ['gLight6'],
metadata: {
alexa: {
value: 'EndpointHealth.connectivity' // Not configurable capability
}
}
},
{
groupType: 'Switch',
type: 'Group',
name: 'gLight7',
label: 'Light Group 7',
metadata: {
alexa: {
value: 'Light'
}
}
},
{
type: 'Color',
type: 'Dimmer',
name: 'light8',
label: 'Color Light 8',
groupNames: ['gLight9'],
label: 'Dimmer Light 8',
groupNames: ['gLight7'],
metadata: {
alexa: {
value: 'Light'
}
}
},
{
groupType: 'Switch',
type: 'Group',
name: 'gLight9',
label: 'Light Group 9',
type: 'Color',
name: 'light9',
label: 'Color Light 9',
groupNames: ['gLight7'],
metadata: {
alexa: {
value: 'Light'
Expand Down Expand Up @@ -338,20 +348,30 @@ module.exports = {
property: 'colorTemperatureInKelvin',
parameters: { binding: 'hue:bulb' },
item: { name: 'colorTemperature6', type: 'Dimmer' }
},
{
name: 'EndpointHealth',
property: 'connectivity',
parameters: {}
}
]
},
light7: {
gLight7: {
capabilities: ['Alexa.PowerController.powerState', 'Alexa.EndpointHealth.connectivity', 'Alexa'],
displayCategories: ['LIGHT'],
friendlyName: 'Light Group 7'
},
light8: {
capabilities: [
'Alexa.PowerController.powerState',
'Alexa.BrightnessController.brightness',
'Alexa.EndpointHealth.connectivity',
'Alexa'
],
displayCategories: ['LIGHT'],
friendlyName: 'Dimmer Light 7'
friendlyName: 'Dimmer Light 8'
},
light8: {
light9: {
capabilities: [
'Alexa.PowerController.powerState',
'Alexa.BrightnessController.brightness',
Expand All @@ -360,12 +380,7 @@ module.exports = {
'Alexa'
],
displayCategories: ['LIGHT'],
friendlyName: 'Color Light 8'
},
gLight9: {
capabilities: ['Alexa.PowerController.powerState', 'Alexa.EndpointHealth.connectivity', 'Alexa'],
displayCategories: ['LIGHT'],
friendlyName: 'Light Group 9'
friendlyName: 'Color Light 9'
},
light10: {
capabilities: ['Alexa.PowerController.powerState', 'Alexa.EndpointHealth.connectivity', 'Alexa'],
Expand Down

0 comments on commit 9779dea

Please sign in to comment.