diff --git a/USAGE.md b/USAGE.md index 7a3297b1..ce8eceda 100644 --- a/USAGE.md +++ b/USAGE.md @@ -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. @@ -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=`` - * 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"] @@ -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` diff --git a/lambda/alexa/smarthome/capabilities/safety.js b/lambda/alexa/smarthome/capabilities/safety.js index bf23bbc0..5fd61ae6 100644 --- a/lambda/alexa/smarthome/capabilities/safety.js +++ b/lambda/alexa/smarthome/capabilities/safety.js @@ -36,8 +36,7 @@ class Safety extends AlexaCapability { */ get supportedProperties() { return { - [Property.OBSTACLE_ALERT]: AlertState, - [Property.SAFETY_BEAM_ALERT]: AlertState + [Property.OBSTACLE_ALERT]: AlertState }; } diff --git a/lambda/alexa/smarthome/constants.js b/lambda/alexa/smarthome/constants.js index 5659972f..7dc83a24 100644 --- a/lambda/alexa/smarthome/constants.js +++ b/lambda/alexa/smarthome/constants.js @@ -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', diff --git a/lambda/alexa/smarthome/device/attributes/index.js b/lambda/alexa/smarthome/device/attributes/index.js index e075a367..98344a52 100644 --- a/lambda/alexa/smarthome/device/attributes/index.js +++ b/lambda/alexa/smarthome/device/attributes/index.js @@ -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'), diff --git a/lambda/alexa/smarthome/device/attributes/safetyBeamAlert.js b/lambda/alexa/smarthome/device/attributes/safetyBeamAlert.js deleted file mode 100644 index b2899276..00000000 --- a/lambda/alexa/smarthome/device/attributes/safetyBeamAlert.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2010-2021 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ - -const { Capability, Property } = require('@alexa/smarthome/constants'); -const DeviceAttribute = require('./attribute'); - -/** - * Defines safety beam alert attribute class - * @extends DeviceAttribute - */ -class SafetyBeamAlert extends DeviceAttribute { - /** - * Returns supported names - * @return {Array} - */ - static get supportedNames() { - return ['SafetyBeamAlert']; - } - - /** - * Returns capabilities - * @return {Array} - */ - static getCapabilities() { - return [{ name: Capability.SAFETY, property: Property.SAFETY_BEAM_ALERT }]; - } -} - -module.exports = SafetyBeamAlert; diff --git a/lambda/alexa/smarthome/device/types/garageDoor.js b/lambda/alexa/smarthome/device/types/garageDoor.js index 18fc0605..1625ac47 100644 --- a/lambda/alexa/smarthome/device/types/garageDoor.js +++ b/lambda/alexa/smarthome/device/types/garageDoor.js @@ -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 @@ -33,7 +33,7 @@ class GarageDoor extends Door { * @return {Array} */ static get supportedAttributes() { - return [ObstacleAlert, SafetyBeamAlert, ...super.supportedAttributes]; + return [ObstacleAlert, ...super.supportedAttributes]; } /** diff --git a/lambda/alexa/smarthome/errors.js b/lambda/alexa/smarthome/errors.js index 479ce9d1..af576d35 100644 --- a/lambda/alexa/smarthome/errors.js +++ b/lambda/alexa/smarthome/errors.js @@ -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 @@ -624,7 +610,6 @@ module.exports = { ValueOutOfRangeError, AuthorizationAcceptGrantError, SafetyObstacleDetectedError, - SafetyBeamBreachedError, SecurityPanelAuthorizationRequiredError, SecurityPanelBypassNeededError, SecurityPanelNotReadyError, diff --git a/lambda/alexa/smarthome/handlers/safety.js b/lambda/alexa/smarthome/handlers/safety.js index 7d03547d..22627396 100644 --- a/lambda/alexa/smarthome/handlers/safety.js +++ b/lambda/alexa/smarthome/handlers/safety.js @@ -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'); @@ -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.'); } } } diff --git a/lambda/test/alexa/cases/discovery/door.test.js b/lambda/test/alexa/cases/discovery/door.test.js index 6922250c..ae720c1d 100644 --- a/lambda/test/alexa/cases/discovery/door.test.js +++ b/lambda/test/alexa/cases/discovery/door.test.js @@ -96,15 +96,6 @@ module.exports = { } } } - }, - { - type: 'Contact', - name: 'safetyBeamGarageDoor3', - metadata: { - alexa: { - value: 'SafetyBeamAlert' - } - } } ] }, @@ -413,12 +404,6 @@ module.exports = { CLOSED: 'OPEN' }, item: { name: 'currentGarageDoor3', type: 'Contact' } - }, - { - name: 'Safety', - property: 'safetyBeamAlert', - parameters: {}, - item: { name: 'safetyBeamGarageDoor3', type: 'Contact' } } ] }, diff --git a/lambda/test/alexa/cases/modeController.test.js b/lambda/test/alexa/cases/modeController.test.js index 8ea74f71..c69766cc 100644 --- a/lambda/test/alexa/cases/modeController.test.js +++ b/lambda/test/alexa/cases/modeController.test.js @@ -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: {