Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SafetyBeamAlert Attribute #405

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ Device Types | Supported Attributes | Description
`Dryer` | _[`PowerState`](#powerstate)_ | A device that dries wet clothing.
`Fan` | _[`PowerState`](#powerstate)_, _[`FanSpeed`](#fanspeed)_, [`FanDirection`](#fandirection), [`FanOscillate`](#fanoscillate) | A fan.
`GameConsole` | _[`PowerState`](#powerstate)_, [`NetworkAccess`](#networkaccess) | A game console, such as Microsoft Xbox or Nintendo Switch.
`GarageDoor` | _[`OpenState`](#openstate)_, [`TargetOpenState`](#targetopenstate), [`CurrentOpenState`](#currentopenstate), [`ObstacleAlert`](#obstaclealert), [`SafetyBeamAlert`](#safetybeamalert) | A garage door. Supports unlock by voice code. Only supported in `en-US`. For other languages, use `Door` instead.
`GarageDoor` | _[`OpenState`](#openstate)_, [`TargetOpenState`](#targetopenstate), [`CurrentOpenState`](#currentopenstate), [`ObstacleAlert`](#obstaclealert) | A garage door. Supports unlock by voice code. Only supported in `en-US`. For other languages, use `Door` instead.
`Headphones` | Same as `BluetoothSpeaker` | A wearable device that transmits audio directly into the ear.
`Hub` | _[`PowerState`](#powerstate)_ | A smart-home hub.
`Laptop` | _[`PowerState`](#powerstate)_, [`BatteryLevel`](#batterylevel), [`NetworkAccess`](#networkaccess) | A laptop or other mobile computer.
Expand Down Expand Up @@ -628,18 +628,6 @@ Items that represent the current open state of a door or window blind with decou

Items that represent the alert state when an obstacle is detected preventing closing a garage door. This needs to be paired with [`OpenState`](#openstate). This attribute only works with [`GarageDoor`](#device-types) type. When in alert state, close requests will trigger an error response.

* Supported item types:
* Contact [OK="CLOSED", ALERT="OPEN"]
* Switch [OK="OFF", ALERT="ON"]
* Supported metadata parameters:
* inverted=`<boolean>`
* set to true to invert item state
* defaults to false

#### `SafetyBeamAlert`

Items that represent the alert state when a safety beam was breached preventing closing a garage door. This needs to be paired with [`OpenState`](#openstate). This attribute only works with [`GarageDoor`](#device-types) type. When in alert state, close requests will trigger an error response.

* Supported item types:
* Contact [OK="CLOSED", ALERT="OPEN"]
* Switch [OK="OFF", ALERT="ON"]
Expand Down Expand Up @@ -1897,7 +1885,7 @@ PlaybackController | [`Playback`](#playback), [`PlaybackStop`](#playbackstop) |
PowerController | [`PowerState`](#powerstate) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `fr-FR`, `it-IT`, `ja-JP`
PowerLevelController | [`PowerLevel`](#powerlevel) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `fr-FR`, `it-IT`, `ja-JP`
RangeController | [`RangeValue`](#rangevalue), [`BatteryLevel`](#batterylevel), [`CurrentHumidity`](#currenthumidity), [`FanSpeed`](#fanspeed), [`PositionState`](#positionstate), [`TiltAngle`](#tiltangle) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `fr-CA`, `fr-FR`, `it-IT`, `ja-JP`
Safety | [`ObstacleAlert`](#obstaclealert), [`SafetyBeamAlert`](#safetybeamalert) | `en-US`
Safety | [`ObstacleAlert`](#obstaclealert) | `en-US`
SceneController | [`Scene`](#scene), [`Activity`](#activity) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `fr-FR`, `it-IT`, `ja-JP`
SecurityPanelController | [`ArmState`](#armstate), [`BurglaryAlarm`](#burglaryalarm), [`CarbonMonoxideAlarm`](#carbonmonoxidealarm), [`FireAlarm`](#firealarm), [`WaterAlarm`](#wateralarm) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `it-IT`, `ja-JP`, `pt-BR`
Speaker | [`VolumeLevel`](#volumelevel), [`MuteState`](#mutestate) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `it-IT`, `ja-JP`
Expand Down
3 changes: 1 addition & 2 deletions lambda/alexa/smarthome/capabilities/safety.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ class Safety extends AlexaCapability {
*/
get supportedProperties() {
return {
[Property.OBSTACLE_ALERT]: AlertState,
[Property.SAFETY_BEAM_ALERT]: AlertState
[Property.OBSTACLE_ALERT]: AlertState
};
}

Expand Down
1 change: 0 additions & 1 deletion lambda/alexa/smarthome/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const Property = Object.freeze({
POWER_STATE: 'powerState',
RANGE_VALUE: 'rangeValue',
READY_ALERT: 'readyAlert',
SAFETY_BEAM_ALERT: 'safetyBeamAlert',
SCENE: 'scene',
TARGET_SETPOINT: 'targetSetpoint',
TEMPERATURE: 'temperature',
Expand Down
1 change: 0 additions & 1 deletion lambda/alexa/smarthome/device/attributes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ module.exports = {
PowerState: require('./powerState'),
RangeValue: require('./rangeValue'),
ReadyAlert: require('./readyAlert'),
SafetyBeamAlert: require('./safetyBeamAlert'),
Scene: require('./scene'),
TargetTemperature: require('./targetTemperature'),
Temperature: require('./temperature'),
Expand Down
39 changes: 0 additions & 39 deletions lambda/alexa/smarthome/device/attributes/safetyBeamAlert.js

This file was deleted.

4 changes: 2 additions & 2 deletions lambda/alexa/smarthome/device/types/garageDoor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

const AlexaDisplayCategory = require('@alexa/smarthome/category');
const Door = require('./door');
const { ObstacleAlert, SafetyBeamAlert } = require('../attributes');
const { ObstacleAlert } = require('../attributes');

/**
* Defines garage door device type class
Expand All @@ -33,7 +33,7 @@ class GarageDoor extends Door {
* @return {Array}
*/
static get supportedAttributes() {
return [ObstacleAlert, SafetyBeamAlert, ...super.supportedAttributes];
return [ObstacleAlert, ...super.supportedAttributes];
}

/**
Expand Down
15 changes: 0 additions & 15 deletions lambda/alexa/smarthome/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,20 +358,6 @@ class SafetyObstacleDetectedError extends SafetyError {
}
}

/**
* Defines safety beam breached error class
* @extends SafetyError
*/
class SafetyBeamBreachedError extends SafetyError {
/**
* Returns error type
* @return {String}
*/
get type() {
return 'SAFETY_BEAM_BREACHED';
}
}

/**
* Defines security panel namespace error class
* https://developer.amazon.com/docs/device-apis/alexa-securitypanelcontroller-errorresponse.html
Expand Down Expand Up @@ -624,7 +610,6 @@ module.exports = {
ValueOutOfRangeError,
AuthorizationAcceptGrantError,
SafetyObstacleDetectedError,
SafetyBeamBreachedError,
SecurityPanelAuthorizationRequiredError,
SecurityPanelBypassNeededError,
SecurityPanelNotReadyError,
Expand Down
4 changes: 1 addition & 3 deletions lambda/alexa/smarthome/handlers/safety.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

const { Interface, Property } = require('../constants');
const { SafetyBeamBreachedError, SafetyObstacleDetectedError } = require('../errors');
const { SafetyObstacleDetectedError } = require('../errors');
const { AlertState } = require('../properties');
const AlexaHandler = require('./handler');

Expand Down Expand Up @@ -58,8 +58,6 @@ class Safety extends AlexaHandler {
switch (alert.name) {
case Property.OBSTACLE_ALERT:
throw new SafetyObstacleDetectedError('Unable to close door because an obstacle is detected.');
case Property.SAFETY_BEAM_ALERT:
throw new SafetyBeamBreachedError('Unable to close door because a safety beam was breached.');
}
}
}
Expand Down
15 changes: 0 additions & 15 deletions lambda/test/alexa/cases/discovery/door.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ module.exports = {
}
}
}
},
{
type: 'Contact',
name: 'safetyBeamGarageDoor3',
metadata: {
alexa: {
value: 'SafetyBeamAlert'
}
}
}
]
},
Expand Down Expand Up @@ -413,12 +404,6 @@ module.exports = {
CLOSED: 'OPEN'
},
item: { name: 'currentGarageDoor3', type: 'Contact' }
},
{
name: 'Safety',
property: 'safetyBeamAlert',
parameters: {},
item: { name: 'safetyBeamGarageDoor3', type: 'Contact' }
}
]
},
Expand Down
55 changes: 0 additions & 55 deletions lambda/test/alexa/cases/modeController.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,61 +179,6 @@ module.exports = [
}
}
},
{
description: 'set mode open state safety beam breached error',
directive: {
header: {
namespace: 'Alexa.ModeController',
instance: 'OpenState',
name: 'SetMode'
},
endpoint: {
endpointId: 'gGarageDoor',
cookie: {
capabilities: JSON.stringify([
{
name: 'ModeController',
instance: 'OpenState',
property: 'mode',
parameters: {
capabilityNames: ['@Setting.Opening'],
supportedModes: { OPEN: ['@Value.Open'], CLOSED: ['@Value.Close'] },
actionMappings: { Close: 'CLOSED', Open: 'OPEN', Lower: 'CLOSED', Raise: 'OPEN' },
stateMappings: { Closed: 'CLOSED', Open: 'OPEN' },
CLOSED: 'ON',
OPEN: 'OFF'
},
item: { name: 'GarageDoor', type: 'Switch' }
},
{
name: 'Safety',
property: 'safetyBeamAlert',
parameters: { inverted: true },
item: { name: 'SafetyBeamAlert', type: 'Switch' }
}
])
}
},
payload: {
mode: 'CLOSED'
}
},
items: [{ name: 'SafetyBeamAlert', state: 'OFF', type: 'Switch' }],
expected: {
alexa: {
event: {
header: {
namespace: 'Alexa.Safety',
name: 'ErrorResponse'
},
payload: {
type: 'SAFETY_BEAM_BREACHED',
message: 'Unable to close door because a safety beam was breached.'
}
}
}
}
},
{
description: 'adjust mode',
directive: {
Expand Down