diff --git a/README.md b/README.md
index 83c9ab22..a494b8c6 100644
--- a/README.md
+++ b/README.md
@@ -123,7 +123,7 @@ To configure your server path and credentials, you will need to setup the CloudF
```
2. If updating from ASK CLI v1:
- 1. Copy relevant settings from `lambda/smarthome/config.js` (ask-cli-v1) to [`ask-resources.json`](ask-resources.json) (ask-cli-v2). If configuring `OpenHABBaseURL`, be aware that it should now point to your server root level and not the rest endpoint. Additionally, move your client certificate to `lambda/ssl` if using that authentication method.
+ 1. Copy relevant settings from `lambda/smarthome/config.js` (ask-cli-v1) to [`ask-resources.json`](ask-resources.json) (ask-cli-v2). If configuring `OpenHABBaseURL`, beware that it should now point to your server root level and not the rest endpoint. Additionally, move your client certificate to `lambda/ssl` if using that authentication method.
2. Create the ASK CLI states file as `.ask/ask-states.json`, adding the skill ID listed in your [Alexa developer console](https://developer.amazon.com/alexa/console/ask). This will prevent duplicate skills from being created in your account.
diff --git a/docs/USAGE.md b/docs/USAGE.md
index cf61623a..f4837100 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -27,7 +27,6 @@ The skill connects your openHAB setup through the [myopenHAB.org](http://myopenH
* [Group Endpoint](#group-endpoint)
* [Item State](#item-state)
* [Item Unit of Measurement](#item-unit-of-measurement)
- * [Networking Capabilities](#networking-capabilities)
* [Generic Capabilities](#generic-capabilities)
* [Semantic Extensions](#semantic-extensions)
* [Item Configuration](#item-configuration)
@@ -312,22 +311,6 @@ Number:Temperature Temperature2 "Temperature" {alexa="CurrentTemperatu
Number:Temperature Temperature3 "Temperature" {alexa="CurrentTemperature"}
```
-## Networking Capabilities
-
-To interact with the networking capabilities of a router, such as controlling the network access for a specific device, the [networking attributes](#networking-attributes) are available to configure a representation of a home network and its connected devices.
-
-In order to take advantage of these capabilities, your router must be configured as a [group endpoint](#group-endpoint) based on [`HomeNetwork`](#homenetwork) supported device types. If it doesn't have any other capabilities, it can be an empty group. Likewise, connected devices must be configured based on [`ConnectedDevice`](#connecteddevice) supported device types and metadata parameters.
-
-```xtend
-Group Router "Router" {alexa="Router"}
-
-Group Laptop "Laptop" (Router) {alexa="Laptop" [macAddress="00:21:86:B5:6E:10"]}
-Switch Access1 "Access" (Laptop) {alexa="NetworkAccess"}
-
-Group Tablet "Tablet" (Router) {alexa="Tablet" [macAddress="00:21:86:B5:6E:11"]}
-Switch Access2 "Access" (Tablet) {alexa="NetworkAccess"}
-```
-
## Generic Capabilities
@@ -553,7 +536,7 @@ Device Types | Supported Attributes | Description
`Speaker` | *[`PowerState`](#powerstate)*, *[`VolumeLevel`](#volumelevel)*, [`VolumeStep`](#volumestep), [`MuteState`](#mutestate), [`MuteStep`](#mutestep), [`EqualizerBass`](#equalizerbass), [`EqualizerMidrange`](#equalizermidrange), [`EqualizerTreble`](#equalizertreble), [`EqualizerMode`](#equalizermode), [`Channel`](#channel), [`ChannelStep`](#channelstep), [`Input`](#input), [`Playback`](#playback), [`PlaybackStop`](#playbackstop), [`PlaybackStep`](#playbackstep) | A speaker or speaker system.
`StreamingDevice` | *[`PowerState`](#powerstate)*, *[`Playback`](#playback)*, [`PlaybackStop`](#playbackstop), [`PlaybackStep`](#playbackstep), [`Channel`](#channel), [`ChannelStep`](#channelstep), [`Input`](#input), [`VolumeLevel`](#volumelevel), [`VolumeStep`](#volumestep), [`MuteState`](#mutestate), [`MuteStep`](#mutestep), [`EqualizerBass`](#equalizerbass), [`EqualizerMidrange`](#equalizermidrange), [`EqualizerTreble`](#equalizertreble), [`EqualizerMode`](#equalizermode) | A streaming device such as Apple TV, Chromecast, or Roku.
`Switch` | *[`PowerState`](#powerstate)*, *[`PowerLevel`](#powerlevel)*, *[`Percentage`](#percentage)* | A switch wired directly to the electrical system. A switch can control a variety of devices. For lighting devices, use `Light` instead.
-`Tablet` | *[`PowerState`](#powerstate)*, [`BatteryLevel`](#batterylevel), [`NetworkAccess`](#networkaccess) | A tablet computer.
+`Tablet` | *[`PowerState`](#powerstate)*, [`BatteryLevel`](#batterylevel), [`NetworkAccess`](#networkaccess) | A tablet computer.
`Television` | *[`PowerState`](#powerstate)*, *[`Channel`](#channel)*, [`ChannelStep`](#channelstep), [`Input`](#input), [`VolumeLevel`](#volumelevel), [`VolumeStep`](#volumestep), [`MuteState`](#mutestate), [`MuteStep`](#mutestep), [`EqualizerBass`](#equalizerbass), [`EqualizerMidrange`](#equalizermidrange), [`EqualizerTreble`](#equalizertreble), [`EqualizerMode`](#equalizermode), [`Playback`](#playback), [`PlaybackStop`](#playbackstop), [`PlaybackStep`](#playbackstep) | A television.
`TemperatureSensor` | *[`CurrentTemperature`](#currenttemperature)*, [`BatteryLevel`](#batterylevel) | An endpoint that reports temperature, but does not control it. The temperature data of the endpoint doesn't appear in the Alexa app. If your endpoint also controls temperature, use `Thermostat` instead.
`Thermostat` | *[`HeatingCoolingMode`](#heatingcoolingmode)*, [`TargetTemperature`](#targettemperature), [`CoolingSetpoint`](#coolingsetpoint), [`HeatingSetpoint`](#heatingsetpoint), [`EcoCoolingSetpoint`](#ecocoolingsetpoint), [`EcoHeatingSetpoint`](#ecoheatingsetpoint), [`ThermostatHold`](#thermostathold), [`ThermostatFan`](#thermostatfan), [`CurrentTemperature`](#currenttemperature), [`CurrentHumidity`](#currenthumidity), [`BatteryLevel`](#batterylevel) | An endpoint that controls temperature, stand-alone air conditioners, or heaters with direct temperature control. If your endpoint senses temperature but does not control it, use `TemperatureSensor` instead.
@@ -561,7 +544,7 @@ Device Types | Supported Attributes | Description
`Washer` | *[`PowerState`](#powerstate)* | A device that cleans clothing.
`WaterHeater` | *[`PowerState`](#powerstate)*, [`TargetTemperature`](#targettemperature), [`CurrentTemperature`](#currenttemperature) | A device that heats water, often consisting of a large tank.
`Wearable`| *[`PowerState`](#powerstate)*, [`BatteryLevel`](#batterylevel), [`NetworkAccess`](#networkaccess) | A network-connected wearable device, such as an Apple Watch, Fitbit, or Samsung Gear.
-`Other`| [All attributes](#device-attributes), except [networking](#networking-attributes) and [scenes](#scene-attributes) | An endpoint that doesn't belong to one of the other categories.
+`Other`| [All attributes](#device-attributes), except [scenes](#scene-attributes) | An endpoint that doesn't belong to one of the other categories.
## Device Attributes
@@ -1150,48 +1133,19 @@ Items that represents a color temperature. It is important to note that temperat
### Networking Attributes
-#### `HomeNetwork`
-
-Items that represent a network router. This attribute cannot be specified by name. It is automatically added when configuring a [group endpoint](#group-endpoint) as one of the supported [device types](#device-types).
-
-* Supported device types:
- * `NetworkHardware`
- * `Router`
-
-#### `ConnectedDevice`
-
-Items that represent a network device, such as a computer or mobile phone, connected to a router. This attribute cannot be specified by name. It is automatically added when configuring a [group endpoint](#group-endpoint) as one of the supported [device types](#device-types), that is a member of the group representing the router, as [`HomeNetwork`](#homenetwork), where the device is connected to, and having at least the metadata parameter `macAddress` defined.
-
-* Supported device types:
- * `Computer`
- * `GameConsole`
- * `Laptop`
- * `MobilePhone`
- * `Tablet`
- * `Wearable`
-* Supported metadata parameters:
- * hostname=``
- * defaults to `N/A`
- * macAddress=``
- * formatted as EUI-48 or EUI-64 address with colon or dash separators (e.g. `macAddress="00:21:86:B5:6E:10"`)
-
#### `NetworkAccess`
-Items that represent the internet/network access control of a Wi-Fi/Ethernet connection to a router. This needs to be paired with [`ConnectedDevice`](#connecteddevice). To enable the access control by voice, you will need to select the configured device in your Alexa app, by going to Devices > Wi-Fi Access > Add a device. To limit the control based on voice profiles, turn on the option in the Wi-Fi Access settings.
+Items that represent the access control of a network connection to a router.
* Supported item types:
- * Switch [ALLOWED="ON", BLOCKED="OFF"]
+ * Switch
* Supported metadata parameters:
* inverted=``
* set to true to invert item state
* defaults to false
* Utterance examples:
- * *Alexa, pause the Internet for ``.*
- * *Alexa, resume the Wi-Fi for ``.*
- * *Alexa, enable the Internet for ``.*
- * *Alexa, disable the Wi-Fi for ``.*
- * *Alexa, turn on the Internet for ``.*
- * *Alexa, turn off the Wi-Fi for ``.*
+ * *Alexa, turn on the `` network access.*
+ * *Alexa, turn off the `` network access.*
### Scene Attributes
@@ -1959,7 +1913,7 @@ Items that represent components of a device that can be toggled on or off. Multi
* Alexa will respond with "Sorry something wrong, to control *device* try disabling the skill and re-enabling it from your Alexa app".
* It indicates that Alexa isn't able to control the given device because of an authentication issue.
-* To resolve this error, for users that are using the official skill, just disable and re-enable it through the Alexa app. For users that have setup their own custom skill, make sure that the proper credentials were configured in `ask-resources.json`. If running an openHAB 3.x server, make sure that the API Security Implicit User Role setting is enabled.
+* To resolve this error, for users that are using the official skill, just disable and re-enable it through the Alexa app. For users that have setup their own custom skill, make sure that the proper credentials were configured in `ask-resources.json`. For openHAB 3.0 and above, make sure that the API Security Implicit User Role setting is enabled.
### Server Not Accessible
@@ -1992,7 +1946,6 @@ EqualizerController | [`EqualizerBass`](#equalizerbass), [`EqualizerMidrange`](#
LockController | [`LockState`](#lockstate) | `ar-SA`, `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
ModeController | [`Mode`](#mode), [`FanDirection`](#fandirection), [`FanSpeed`](#fanspeed), [`Input`](#input), [`OpenState`](#openstate), [`PositionState`](#positionstate), [`TiltAngle`](#tiltangle), [`ThermostatFan`](#thermostatfan), [`VacuumMode`](#vacuummode) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
MotionSensor | [`MotionDetectionState`](#motiondetectionstate) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
-Networking | [`HomeNetwork`](#homenetwork), [`ConnectedDevice`](#connecteddevice), [`NetworkAccess`](#networkaccess) | `en-US`
PercentageController | [`Percentage`](#percentage) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
PlaybackController | [`Playback`](#playback), [`PlaybackStop`](#playbackstop), [`PlaybackStep`](#playbackstep) | `ar-SA`, `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
PlaybackStateReporter | [`Playback`](#playback), [`PlaybackStop`](#playbackstop) | `ar-SA`, `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
@@ -2006,7 +1959,7 @@ Speaker | [`VolumeLevel`](#volumelevel), [`MuteState`](#mutestate) | `de-DE`, `e
StepSpeaker | [`VolumeStep`](#volumestep), [`MuteStep`](#mutestep) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `it-IT`
TemperatureSensor | [`CurrentTemperature`](#currenttemperature) | `ar-SA`, `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
ThermostatController | [`TargetTemperature`](#targettemperature), [`CoolingSetpoint`](#coolingsetpoint), [`HeatingSetpoint`](#heatingsetpoint), [`HeatingCoolingMode`](#heatingcoolingmode), [`ThermostatHold`](#thermostathold) | `ar-SA`, `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
-ToggleController | [`ToggleState`](#togglestate), [`FanOscillate`](#fanoscillate), [`ThermostatFan`](#thermostatfan) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
+ToggleController | [`ToggleState`](#togglestate), [`FanOscillate`](#fanoscillate), [`ThermostatFan`](#thermostatfan), [`NetworkAccess`](#networkaccess) | `de-DE`, `en-AU`, `en-CA`, `en-GB`, `en-IN`, `en-US`, `es-ES`, `es-MX`, `es-US`, `fr-CA`, `fr-FR`, `hi-IN`, `it-IT`, `ja-JP`, `pt-BR`
## Asset Catalog
@@ -2124,6 +2077,7 @@ Asset Identifier | Supported Friendly Names
`@Setting.Forward` | Forward
`@Setting.Humidity` | Humidity
`@Setting.Input` | Input
+`@Setting.NetworkAccess` | Network Access
`@Setting.Position` | Position
`@Setting.RangeValue` | Range Value
`@Setting.Reverse` | Reverse
diff --git a/lambda/alexa/smarthome/capabilities/capability.js b/lambda/alexa/smarthome/capabilities/capability.js
index d2a1f238..1ce5c1d5 100644
--- a/lambda/alexa/smarthome/capabilities/capability.js
+++ b/lambda/alexa/smarthome/capabilities/capability.js
@@ -219,14 +219,6 @@ export default class AlexaCapability {
return {};
}
- /**
- * Returns relationship
- * @return {Object}
- */
- getRelationship() {
- return {};
- }
-
/**
* Returns context properties
* @return {Array}
@@ -248,7 +240,7 @@ export default class AlexaCapability {
/**
* Adds property for a given config object
- * @param {Object} config [name, component, tag, parameters, item, metadata, settings, groups]
+ * @param {Object} config [name, component, tag, parameters, item, metadata, settings]
*/
addProperty(config) {
const { name } = config;
diff --git a/lambda/alexa/smarthome/capabilities/index.js b/lambda/alexa/smarthome/capabilities/index.js
index cf2b5720..2b88f626 100644
--- a/lambda/alexa/smarthome/capabilities/index.js
+++ b/lambda/alexa/smarthome/capabilities/index.js
@@ -27,9 +27,6 @@ export { default as InputController } from './inputController.js';
export { default as LockController } from './lockController.js';
export { default as ModeController } from './modeController.js';
export { default as MotionSensor } from './motionSensor.js';
-export { default as NetworkingAccessController } from './networkingAccessController.js';
-export { default as NetworkingConnectedDevice } from './networkingConnectedDevice.js';
-export { default as NetworkingHomeNetworkController } from './networkingHomeNetworkController.js';
export { default as PercentageController } from './percentageController.js';
export { default as PlaybackController } from './playbackController.js';
export { default as PlaybackStateReporter } from './playbackStateReporter.js';
diff --git a/lambda/alexa/smarthome/capabilities/networkingAccessController.js b/lambda/alexa/smarthome/capabilities/networkingAccessController.js
deleted file mode 100644
index 05d448c4..00000000
--- a/lambda/alexa/smarthome/capabilities/networkingAccessController.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import AlexaCapability from './capability.js';
-import { Capability, Interface, Property } from '../constants.js';
-import { NetworkAccess } from '../properties/index.js';
-
-/**
- * Defines Alexa.Networking.AccessController interface capability class
- * https://developer.amazon.com/docs/networking/alexa-networking-accesscontroller.html
- * @extends AlexaCapability
- */
-export default class NetworkingAccessController extends AlexaCapability {
- /**
- * Returns name
- * @return {String}
- */
- static get name() {
- return Capability.NETWORKING_ACCESS_CONTROLLER;
- }
-
- /**
- * Returns interface
- * @return {String}
- */
- get interface() {
- return Interface.ALEXA_NETWORKING_ACCESS_CONTROLLER;
- }
-
- /**
- * Returns supported properties
- * @return {Object}
- */
- get supportedProperties() {
- return {
- [Property.NETWORK_ACCESS]: NetworkAccess
- };
- }
-
- /**
- * Returns required linked capabilities
- * @return {Array}
- */
- get requiredLinkedCapabilities() {
- return [{ name: Capability.NETWORKING_CONNECTED_DEVICE, property: Property.CONNECTED_DEVICE }];
- }
-
- /**
- * Returns capability configuration
- * @return {Object}
- */
- getCapabilityConfiguration() {
- return { supportsScheduling: false };
- }
-}
diff --git a/lambda/alexa/smarthome/capabilities/networkingConnectedDevice.js b/lambda/alexa/smarthome/capabilities/networkingConnectedDevice.js
deleted file mode 100644
index 46e85a69..00000000
--- a/lambda/alexa/smarthome/capabilities/networkingConnectedDevice.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import AlexaCapability from './capability.js';
-import { Capability, Interface, Property } from '../constants.js';
-import { ConnectedDevice } from '../properties/index.js';
-
-/**
- * Defines Alexa.Networking.ConnectedDevice interface capability class
- * https://developer.amazon.com/docs/networking/alexa-networking-connecteddevice.html
- * @extends AlexaCapability
- */
-export default class NetworkingConnectedDevice extends AlexaCapability {
- /**
- * Returns name
- * @return {String}
- */
- static get name() {
- return Capability.NETWORKING_CONNECTED_DEVICE;
- }
-
- /**
- * Returns interface
- * @return {String}
- */
- get interface() {
- return Interface.ALEXA_NETWORKING_CONNECTED_DEVICE;
- }
-
- /**
- * Returns supported properties
- * @return {Object}
- */
- get supportedProperties() {
- return {
- [Property.CONNECTED_DEVICE]: ConnectedDevice
- };
- }
-
- /**
- * Returns capability configuration
- * @return {Object}
- */
- getCapabilityConfiguration() {
- const configuration = {};
- const { deviceName, hostname, macAddress } = this.getProperty({ name: Property.CONNECTED_DEVICE });
-
- configuration.staticDeviceInformation = { deviceName, hostname, macAddress };
-
- return configuration;
- }
-
- /**
- * Returns relationship
- * @return {Object}
- */
- getRelationship() {
- const relationship = {};
- const { connectedTo: endpointId } = this.getProperty({ name: Property.CONNECTED_DEVICE });
-
- relationship.isConnectedBy = { endpointId };
-
- return relationship;
- }
-}
diff --git a/lambda/alexa/smarthome/capabilities/networkingHomeNetworkController.js b/lambda/alexa/smarthome/capabilities/networkingHomeNetworkController.js
deleted file mode 100644
index 3a9a42db..00000000
--- a/lambda/alexa/smarthome/capabilities/networkingHomeNetworkController.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import AlexaCapability from './capability.js';
-import { Capability, Interface } from '../constants.js';
-
-/**
- * Defines Alexa.Networking.HomeNetworkController interface capability class
- * https://developer.amazon.com/docs/networking/alexa-networking-homenetworkcontroller.html
- * @extends AlexaCapability
- */
-export default class NetworkingHomeNetworkController extends AlexaCapability {
- /**
- * Returns name
- * @return {String}
- */
- static get name() {
- return Capability.NETWORKING_HOME_NETWORK_CONTROLLER;
- }
-
- /**
- * Returns interface
- * @return {String}
- */
- get interface() {
- return Interface.ALEXA_NETWORKING_HOME_NETWORK_CONTROLLER;
- }
-}
diff --git a/lambda/alexa/smarthome/catalog.js b/lambda/alexa/smarthome/catalog.js
index 3a1a7264..bbfb3548 100644
--- a/lambda/alexa/smarthome/catalog.js
+++ b/lambda/alexa/smarthome/catalog.js
@@ -650,6 +650,12 @@ export default class AlexaAssetCatalog extends AlexaGlobalCatalog {
*/
static SETTING_INPUT = '@Setting.Input';
+ /**
+ * Defines setting network access
+ * @type {String}
+ */
+ static SETTING_NETWORK_ACCESS = '@Setting.NetworkAccess';
+
/**
* Defines setting position asset
* @type {String}
@@ -785,7 +791,7 @@ export default class AlexaAssetCatalog extends AlexaGlobalCatalog {
/**
* Returns custom catalog label values
* This is a temporary solution until Amazon provides the ability to upload our own catalog:
- * https://developer.amazon.com/docs/device-apis/resources-and-assets.html#upload-your-own-catalog
+ * https://developer.amazon.com/docs/device-apis/resources-and-assets.html#upload-catalog
*
* {
* '': [
diff --git a/lambda/alexa/smarthome/constants.js b/lambda/alexa/smarthome/constants.js
index 3f33c239..46d25b2a 100644
--- a/lambda/alexa/smarthome/constants.js
+++ b/lambda/alexa/smarthome/constants.js
@@ -29,9 +29,6 @@ export const Capability = Object.freeze({
LOCK_CONTROLLER: 'LockController',
MODE_CONTROLLER: 'ModeController',
MOTION_SENSOR: 'MotionSensor',
- NETWORKING_ACCESS_CONTROLLER: 'NetworkingAccessController',
- NETWORKING_CONNECTED_DEVICE: 'NetworkingConnectedDevice',
- NETWORKING_HOME_NETWORK_CONTROLLER: 'NetworkingHomeNetworkController',
PERCENTAGE_CONTROLLER: 'PercentageController',
PLAYBACK_CONTROLLER: 'PlaybackController',
PLAYBACK_STATE_REPORTER: 'PlaybackStateReporter',
@@ -68,9 +65,6 @@ export const Interface = Object.freeze({
ALEXA_LOCK_CONTROLLER: 'Alexa.LockController',
ALEXA_MODE_CONTROLLER: 'Alexa.ModeController',
ALEXA_MOTION_SENSOR: 'Alexa.MotionSensor',
- ALEXA_NETWORKING_ACCESS_CONTROLLER: 'Alexa.Networking.AccessController',
- ALEXA_NETWORKING_CONNECTED_DEVICE: 'Alexa.Networking.ConnectedDevice',
- ALEXA_NETWORKING_HOME_NETWORK_CONTROLLER: 'Alexa.Networking.HomeNetworkController',
ALEXA_PERCENTAGE_CONTROLLER: 'Alexa.PercentageController',
ALEXA_PLAYBACK_CONTROLLER: 'Alexa.PlaybackController',
ALEXA_PLAYBACK_STATE_REPORTER: 'Alexa.PlaybackStateReporter',
@@ -102,7 +96,6 @@ export const Property = Object.freeze({
CHANNEL_STEP: 'channelStep',
COLOR: 'color',
COLOR_TEMPERATURE: 'colorTemperatureInKelvin',
- CONNECTED_DEVICE: 'connectedDevice',
CONNECTIVITY: 'connectivity',
DETECTION_STATE: 'detectionState',
EQUALIZER_BANDS: 'bands',
@@ -113,7 +106,6 @@ export const Property = Object.freeze({
LOWER_SETPOINT: 'lowerSetpoint',
MODE: 'mode',
MUTED: 'muted',
- NETWORK_ACCESS: 'networkAccess',
OBSTACLE_ALERT: 'obstacleAlert',
PERCENTAGE: 'percentage',
PLAYBACK: 'playback',
@@ -148,15 +140,12 @@ export const Parameter = Object.freeze({
CAPABILITY_NAMES: 'capabilityNames',
CHANNEL_MAPPINGS: 'channelMappings',
COMFORT_RANGE: 'comfortRange',
- CONNECTED_TO: 'connectedTo',
DEFAULT_LEVEL: 'defaultLevel',
DEVICE_NAME: 'deviceName',
EXIT_DELAY: 'exitDelay',
- HOSTNAME: 'hostname',
INCREMENT: 'increment',
INVERTED: 'inverted',
LANGUAGE: 'language',
- MAC_ADDRESS: 'macAddress',
NON_CONTROLLABLE: 'nonControllable',
ORDERED: 'ordered',
PASSWORD: 'password',
diff --git a/lambda/alexa/smarthome/device/attributes/networkAccess.js b/lambda/alexa/smarthome/device/attributes/networkAccess.js
index 98364cfe..5c3fb818 100644
--- a/lambda/alexa/smarthome/device/attributes/networkAccess.js
+++ b/lambda/alexa/smarthome/device/attributes/networkAccess.js
@@ -11,6 +11,8 @@
* SPDX-License-Identifier: EPL-2.0
*/
+import { ItemType } from '#openhab/constants.js';
+import AlexaAssetCatalog from '#alexa/smarthome/catalog.js';
import { Capability, Property } from '#alexa/smarthome/constants.js';
import DeviceAttribute from './attribute.js';
@@ -27,11 +29,35 @@ export default class NetworkAccess extends DeviceAttribute {
return ['NetworkAccess'];
}
+ /**
+ * Returns capability names
+ * @return {Array}
+ */
+ static get capabilityNames() {
+ return [AlexaAssetCatalog.SETTING_NETWORK_ACCESS];
+ }
+
/**
* Returns capabilities
+ * @param {Object} item
* @return {Array}
*/
- static getCapabilities() {
- return [{ name: Capability.NETWORKING_ACCESS_CONTROLLER, property: Property.NETWORK_ACCESS }];
+ static getCapabilities(item) {
+ const itemType = item.groupType || item.type;
+
+ switch (itemType) {
+ // Switch on/off control
+ case ItemType.SWITCH:
+ return [
+ {
+ name: Capability.TOGGLE_CONTROLLER,
+ instance: NetworkAccess.name,
+ property: Property.TOGGLE_STATE,
+ parameters: {
+ capabilityNames: NetworkAccess.capabilityNames
+ }
+ }
+ ];
+ }
}
}
diff --git a/lambda/alexa/smarthome/device/types/networkDevice.js b/lambda/alexa/smarthome/device/types/networkDevice.js
index 20fe51bc..90b94bd4 100644
--- a/lambda/alexa/smarthome/device/types/networkDevice.js
+++ b/lambda/alexa/smarthome/device/types/networkDevice.js
@@ -11,7 +11,6 @@
* SPDX-License-Identifier: EPL-2.0
*/
-import { Capability, Property } from '#alexa/smarthome/constants.js';
import GenericDevice from './genericDevice.js';
import { NetworkAccess } from '../attributes/index.js';
@@ -27,12 +26,4 @@ export default class NetworkDevice extends GenericDevice {
static get supportedAttributes() {
return [NetworkAccess, ...super.supportedAttributes];
}
-
- /**
- * Returns group capabilities
- * @return {Array}
- */
- static get groupCapabilities() {
- return [{ name: Capability.NETWORKING_CONNECTED_DEVICE, property: Property.CONNECTED_DEVICE }];
- }
}
diff --git a/lambda/alexa/smarthome/device/types/networkHardware.js b/lambda/alexa/smarthome/device/types/networkHardware.js
index 9944e4f1..b9dce023 100644
--- a/lambda/alexa/smarthome/device/types/networkHardware.js
+++ b/lambda/alexa/smarthome/device/types/networkHardware.js
@@ -12,7 +12,6 @@
*/
import AlexaDisplayCategory from '#alexa/smarthome/category.js';
-import { Capability } from '#alexa/smarthome/constants.js';
import GenericDevice from './genericDevice.js';
/**
@@ -28,14 +27,6 @@ export default class NetworkHardware extends GenericDevice {
return ['NetworkHardware'];
}
- /**
- * Returns group capabilities
- * @return {Array}
- */
- static get groupCapabilities() {
- return [{ name: Capability.NETWORKING_HOME_NETWORK_CONTROLLER }];
- }
-
/**
* Returns display categories
* @return {Array}
diff --git a/lambda/alexa/smarthome/device/types/type.js b/lambda/alexa/smarthome/device/types/type.js
index 4359a209..8d590a4a 100644
--- a/lambda/alexa/smarthome/device/types/type.js
+++ b/lambda/alexa/smarthome/device/types/type.js
@@ -39,14 +39,6 @@ export default class DeviceType {
return [];
}
- /**
- * Returns group capabilities
- * @return {Array}
- */
- static get groupCapabilities() {
- return [];
- }
-
/**
* Returns display categories
* @return {Array}
diff --git a/lambda/alexa/smarthome/endpoint.js b/lambda/alexa/smarthome/endpoint.js
index 8d3f14cd..fa9d5756 100644
--- a/lambda/alexa/smarthome/endpoint.js
+++ b/lambda/alexa/smarthome/endpoint.js
@@ -273,17 +273,6 @@ export default class AlexaEndpoint {
return { ...(capabilities.length > 0 && { capabilities: compressJSON(capabilities) }) };
}
- /**
- * Returns relationships
- * @return {Object}
- */
- getRelationships() {
- return this.discoverableCapabilities.reduce(
- (relationships, capability) => ({ ...relationships, ...capability.getRelationship() }),
- {}
- );
- }
-
/**
* Adds unique supported display categories
* @param {Array} categories
@@ -307,9 +296,8 @@ export default class AlexaEndpoint {
* @param {Object} item
* @param {Object} metadata
* @param {Object} settings
- * @param {Array} groups
*/
- addCapability({ name, instance, property, component, tag, parameters, item, metadata, settings, groups }) {
+ addCapability({ name, instance, property, component, tag, parameters, item, metadata, settings }) {
// Define instance name for generic capabilities using capability/item names, if not defined already
if (!instance && item) {
instance = `${name.replace(/Controller$/, '')}:${item.name}`;
@@ -325,7 +313,7 @@ export default class AlexaEndpoint {
if (typeof capability !== 'undefined') {
// Add property to capability if name defined
if (typeof property !== 'undefined') {
- capability.addProperty({ name: property, component, tag, parameters, item, metadata, settings, groups });
+ capability.addProperty({ name: property, component, tag, parameters, item, metadata, settings });
}
// Add capability to list if new instance
if (index === -1) {
@@ -449,9 +437,8 @@ export default class AlexaEndpoint {
* Sets group endpoint based on given item
* @param {Object} item
* @param {Object} settings
- * @param {Array} groups
*/
- setGroup(item, settings, groups) {
+ setGroup(item, settings) {
// Initialize alexa metadata object
const metadata = new AlexaMetadata(item, settings);
@@ -464,10 +451,6 @@ export default class AlexaEndpoint {
// Set endpoint group properties if device type defined
if (deviceType) {
this.group = { deviceType, config: deviceType.getConfig(metadata) };
- // Add device type group capabilities
- for (const capability of deviceType.groupCapabilities) {
- this.addCapability({ ...capability, item, metadata, settings, groups });
- }
// Add device type display categories
this.addDisplayCategories(deviceType.displayCategories);
break;
@@ -482,7 +465,6 @@ export default class AlexaEndpoint {
*/
toJSON() {
const cookie = this.getCookie();
- const relationships = this.getRelationships();
return {
endpointId: this.id,
@@ -497,7 +479,6 @@ export default class AlexaEndpoint {
customIdentifier: this.customIdentifier
},
...(Object.keys(cookie).length > 0 && { cookie }),
- ...(Object.keys(relationships).length > 0 && { relationships }),
capabilities: this.getCapabilityInterfaces()
};
}
@@ -541,10 +522,9 @@ export default class AlexaEndpoint {
* Returns new endpoint object based on item object
* @param {Object} item
* @param {Object} settings
- * @param {Array} groups
* @return {Object}
*/
- static fromItem(item, settings, groups) {
+ static fromItem(item, settings) {
// Initialize alexa endpoint object using item name as id
const endpoint = new AlexaEndpoint(item.name);
// Set endpoint details
@@ -552,7 +532,7 @@ export default class AlexaEndpoint {
// Set group endpoint if is group type, otherwise add item capabilities to endpoint
if (endpoint.type === ItemType.GROUP) {
- endpoint.setGroup(item, settings, groups);
+ endpoint.setGroup(item, settings);
} else {
endpoint.addItemCapabilities(item, settings);
}
diff --git a/lambda/alexa/smarthome/handlers/discovery.js b/lambda/alexa/smarthome/handlers/discovery.js
index e17ea1fc..fffaa58d 100644
--- a/lambda/alexa/smarthome/handlers/discovery.js
+++ b/lambda/alexa/smarthome/handlers/discovery.js
@@ -65,7 +65,6 @@ export default class Discovery extends AlexaHandler {
// - all items
// - server settings
const [items, settings] = await Promise.all([openhab.getAllItems(), openhab.getServerSettings()]);
- const groups = items.filter((item) => item.type === ItemType.GROUP && !item.groupType);
const endpoints = [];
const groupItems = [];
@@ -74,7 +73,7 @@ export default class Discovery extends AlexaHandler {
// Iterate over items retrieved
for (const item of items) {
// Create new endpoint from item
- const endpoint = AlexaEndpoint.fromItem(item, settings, groups);
+ const endpoint = AlexaEndpoint.fromItem(item, settings);
// Skip item if endpoint friendly name not defined or if already part of a group
if (!endpoint.friendlyName || groupItems.includes(item.name)) {
continue;
diff --git a/lambda/alexa/smarthome/handlers/index.js b/lambda/alexa/smarthome/handlers/index.js
index 630e8f5b..80bbe616 100644
--- a/lambda/alexa/smarthome/handlers/index.js
+++ b/lambda/alexa/smarthome/handlers/index.js
@@ -26,7 +26,6 @@ export { default as EqualizerController } from './equalizerController.js';
export { default as InputController } from './inputController.js';
export { default as LockController } from './lockController.js';
export { default as ModeController } from './modeController.js';
-export { default as NetworkingAccessController } from './networkingAccessController.js';
export { default as PercentageController } from './percentageController.js';
export { default as PlaybackController } from './playbackController.js';
export { default as PowerController } from './powerController.js';
diff --git a/lambda/alexa/smarthome/handlers/networkingAccessController.js b/lambda/alexa/smarthome/handlers/networkingAccessController.js
deleted file mode 100644
index ff386897..00000000
--- a/lambda/alexa/smarthome/handlers/networkingAccessController.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import { Interface, Property } from '../constants.js';
-import AlexaHandler from './handler.js';
-
-/**
- * Defines Alexa.Networking.AccessController interface handler class
- * https://developer.amazon.com/docs/networking/alexa-networking-accesscontroller.html#directives
- * @extends AlexaHandler
- */
-export default class NetworkingAccessController extends AlexaHandler {
- /**
- * Defines set network access directive
- * @type {String}
- */
- static SET_NETWORK_ACCESS = 'SetNetworkAccess';
-
- /**
- * Defines handler namespace
- * @return {String}
- */
- static get namespace() {
- return Interface.ALEXA_NETWORKING_ACCESS_CONTROLLER;
- }
-
- /**
- * Defines handler supported directives
- * @return {Object}
- */
- static get directives() {
- return {
- [NetworkingAccessController.SET_NETWORK_ACCESS]: this.setNetworkAccess
- };
- }
-
- /**
- * Sets network access
- * @param {Object} directive
- * @param {Object} openhab
- * @return {Promise}
- */
- static async setNetworkAccess(directive, openhab) {
- const property = directive.endpoint.getCapabilityProperty({
- interface: directive.namespace,
- property: Property.NETWORK_ACCESS
- });
- const command = property.getCommand(directive.payload.networkAccess);
-
- await openhab.sendCommand(property.item.name, command);
-
- return directive.response();
- }
-}
diff --git a/lambda/alexa/smarthome/metadata.js b/lambda/alexa/smarthome/metadata.js
index 33d191ef..a7ff8fe0 100644
--- a/lambda/alexa/smarthome/metadata.js
+++ b/lambda/alexa/smarthome/metadata.js
@@ -150,8 +150,7 @@ export default class AlexaMetadata {
* @return {Object}
*/
static parseCapability(value) {
- const match = value.match(this.#CAPABILITY_PATTERN);
- return match?.groups;
+ return value.match(this.#CAPABILITY_PATTERN)?.groups;
}
/**
@@ -160,7 +159,6 @@ export default class AlexaMetadata {
* @return {Object}
*/
static parseGroupEndpoint(value) {
- const match = value.match(this.#GROUP_ENDPOINT_PATTERN);
- return match?.groups;
+ return value.match(this.#GROUP_ENDPOINT_PATTERN)?.groups;
}
}
diff --git a/lambda/alexa/smarthome/properties/binaryState.js b/lambda/alexa/smarthome/properties/binaryState.js
index 6584daa0..26bbac01 100644
--- a/lambda/alexa/smarthome/properties/binaryState.js
+++ b/lambda/alexa/smarthome/properties/binaryState.js
@@ -25,7 +25,7 @@ export default class BinaryState extends AlexaProperty {
* @return {Array}
*/
get supportedItemTypes() {
- return this.supportsCommands ? [ItemType.SWITCH] : [ItemType.CONTACT, ItemType.SWITCH];
+ return [ItemType.CONTACT, ItemType.SWITCH];
}
/**
@@ -38,14 +38,6 @@ export default class BinaryState extends AlexaProperty {
};
}
- /**
- * Returns if supports commands
- * @return {Boolean}
- */
- get supportsCommands() {
- return false;
- }
-
/**
* Returns default value map based on item type
* @return {Object}
@@ -64,21 +56,6 @@ export default class BinaryState extends AlexaProperty {
return this.parameters[Parameter.INVERTED] === true;
}
- /**
- * Returns openhab command
- * @param {String} value
- * @return {String}
- */
- getCommand(value) {
- // Invert command value if property inverted
- if (this.inverted) {
- value = this.supportedValues[0] === value ? this.supportedValues[1] : this.supportedValues[0];
- }
-
- // Return command map value from parent method
- return super.getCommand(value);
- }
-
/**
* Returns alexa state
* @param {String} value
diff --git a/lambda/alexa/smarthome/properties/connectedDevice.js b/lambda/alexa/smarthome/properties/connectedDevice.js
deleted file mode 100644
index b1ff8ed2..00000000
--- a/lambda/alexa/smarthome/properties/connectedDevice.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import { isMACAddress } from '#root/utils.js';
-import { ItemType } from '#openhab/constants.js';
-import { Capability, Parameter, ParameterType } from '../constants.js';
-import AlexaDevice from '../device/index.js';
-import AlexaProperty from './property.js';
-
-/**
- * Defines connected device property class
- * @extends AlexaProperty
- */
-export default class ConnectedDevice extends AlexaProperty {
- /**
- * Returns supported item types
- * @return {Array}
- */
- get supportedItemTypes() {
- return [ItemType.GROUP];
- }
-
- /**
- * Returns supported parameters and their type
- * @return {Object}
- */
- get supportedParameters() {
- return {
- [Parameter.CONNECTED_TO]: ParameterType.STRING,
- [Parameter.DEVICE_NAME]: ParameterType.STRING,
- [Parameter.HOSTNAME]: ParameterType.STRING,
- [Parameter.MAC_ADDRESS]: ParameterType.STRING
- };
- }
-
- /**
- * Returns if is reportable
- * @return {Boolean}
- */
- get isReportable() {
- return false;
- }
-
- /**
- * Returns if is valid
- * @return {Boolean}
- */
- get isValid() {
- return this.connectedTo && this.deviceName && this.hostname && isMACAddress(this.macAddress);
- }
-
- /**
- * Returns connected to based on parameter
- * @return {String}
- */
- get connectedTo() {
- return this.parameters[Parameter.CONNECTED_TO];
- }
-
- /**
- * Returns device name based on parameter
- * @return {String}
- */
- get deviceName() {
- return this.parameters[Parameter.DEVICE_NAME];
- }
-
- /**
- * Returns hostname based on parameter
- * @return {String}
- */
- get hostname() {
- return this.parameters[Parameter.HOSTNAME] || 'N/A';
- }
-
- /**
- * Returns mac address system based on parameter
- * @return {String}
- */
- get macAddress() {
- return this.parameters[Parameter.MAC_ADDRESS];
- }
-
- /**
- * Updates parameters
- * @param {Object} item
- * @param {Object} metadata
- * @param {Object} settings
- * @param {Array} groups
- */
- updateParameters(item, metadata, settings, groups) {
- const parameters = this.parameters;
- // Update parameters from parent method
- super.updateParameters(item, metadata, settings);
-
- // Determine router group based on group device type with home network controller capability
- const router = groups
- .filter((group) => item.groupNames.includes(group.name) && group.metadata?.alexa)
- .find(({ metadata }) => {
- const { groupCapabilities } = AlexaDevice.getDeviceType(metadata.alexa.value) || {};
- return groupCapabilities?.some(({ name }) => name === Capability.NETWORKING_HOME_NETWORK_CONTROLLER);
- });
- // Set connected to parameter using router group name if found
- parameters[Parameter.CONNECTED_TO] = router?.name;
- // Set device name parameter using metadata config name parameter, otherwise item label
- parameters[Parameter.DEVICE_NAME] = metadata.config.name || item.label;
- }
-}
diff --git a/lambda/alexa/smarthome/properties/index.js b/lambda/alexa/smarthome/properties/index.js
index 1e11cbfb..ea0ede8e 100644
--- a/lambda/alexa/smarthome/properties/index.js
+++ b/lambda/alexa/smarthome/properties/index.js
@@ -24,7 +24,6 @@ export { default as Channel } from './channel.js';
export { default as ChannelStep } from './channelStep.js';
export { default as Color } from './color.js';
export { default as ColorTemperature } from './colorTemperature.js';
-export { default as ConnectedDevice } from './connectedDevice.js';
export { default as Connectivity } from './connectivity.js';
export { default as DecoupleState } from './decoupleState.js';
export { default as DetectionState } from './detectionState.js';
@@ -37,7 +36,6 @@ export { default as LowerSetpoint } from './lowerSetpoint.js';
export { default as Mode } from './mode.js';
export { default as MuteState } from './muteState.js';
export { default as MuteStep } from './muteStep.js';
-export { default as NetworkAccess } from './networkAccess.js';
export { default as Percentage } from './percentage.js';
export { default as Playback } from './playback.js';
export { default as PlaybackAction } from './playbackAction.js';
diff --git a/lambda/alexa/smarthome/properties/networkAccess.js b/lambda/alexa/smarthome/properties/networkAccess.js
deleted file mode 100644
index 8e5b0d23..00000000
--- a/lambda/alexa/smarthome/properties/networkAccess.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-import BinaryState from './binaryState.js';
-
-/**
- * Defines network access property class
- * @extends BinaryState
- */
-export default class NetworkAccess extends BinaryState {
- /**
- * Defines allowed state
- * @type {String}
- */
- static ALLOWED = 'ALLOWED';
-
- /**
- * Defines blocked state
- * @type {String}
- */
- static BLOCKED = 'BLOCKED';
-
- /**
- * Returns supported values
- * https://developer.amazon.com/docs/networking/alexa-networking-accesscontroller.html#properties
- * @return {Array}
- */
- get supportedValues() {
- return [NetworkAccess.ALLOWED, NetworkAccess.BLOCKED];
- }
-
- /**
- * Returns if supports commands
- * @return {Boolean}
- */
- get supportsCommands() {
- return true;
- }
-}
diff --git a/lambda/alexa/smarthome/properties/property.js b/lambda/alexa/smarthome/properties/property.js
index d776168c..fb3b2fd4 100644
--- a/lambda/alexa/smarthome/properties/property.js
+++ b/lambda/alexa/smarthome/properties/property.js
@@ -318,10 +318,9 @@ export default class AlexaProperty {
* @param {Object} item
* @param {Object} metadata
* @param {Object} settings
- * @param {Array} groups
* @return {Object}
*/
- static create({ name, component, tag, parameters, item, metadata, settings, groups }) {
+ static create({ name, component, tag, parameters, item, metadata, settings }) {
const property = new this(name, component, tag, parameters, item);
// Return if property has not required component or supported item type
@@ -331,7 +330,7 @@ export default class AlexaProperty {
// Update property parameters based on metadata if provided, otherwise normalize existing parameters
if (metadata) {
- property.updateParameters(item, metadata, settings, groups);
+ property.updateParameters(item, metadata, settings);
} else {
property.normalizeParameters();
}
diff --git a/lambda/test/alexa/cases/discovery/computer.test.js b/lambda/test/alexa/cases/discovery/computer.test.js
index aad16c15..51ff7e6b 100644
--- a/lambda/test/alexa/cases/discovery/computer.test.js
+++ b/lambda/test/alexa/cases/discovery/computer.test.js
@@ -18,24 +18,9 @@ export default {
type: 'Group',
name: 'gComputer1',
label: 'Computer',
- groupNames: ['gRouter1'],
metadata: {
alexa: {
- value: 'Computer',
- config: {
- hostname: 'workstation',
- macAddress: '00:21:86:B5:6E:10'
- }
- }
- }
- },
- {
- type: 'Group',
- name: 'gRouter1',
- label: 'Router',
- metadata: {
- alexa: {
- value: 'Router'
+ value: 'Computer'
}
}
},
@@ -51,83 +36,62 @@ export default {
},
{
type: 'Switch',
- name: 'power',
+ name: 'power1',
groupNames: ['gComputer1'],
metadata: {
alexa: {
value: 'PowerState'
}
}
- },
- {
- type: 'Group',
- name: 'gComputer99',
- label: 'Invalid Computer',
- groupNames: ['gRouter99'],
- metadata: {
- alexa: {
- value: 'Computer',
- config: {
- hostname: 'workstation',
- macAddress: '00:21:86:B5:6E:10'
- }
- }
- }
- },
- {
- type: 'Group',
- name: 'gRouter99',
- label: 'Invalid Router',
- metadata: {
- alexa: {
- value: 'Invalid'
- }
- }
- },
- {
- type: 'Switch',
- name: 'networkAccess99',
- groupNames: ['gComputer99'],
- metadata: {
- alexa: {
- value: 'NetworkAccess'
- }
- }
}
],
+ catalog: {
+ '@Setting.NetworkAccess': [
+ {
+ text: 'Network Access',
+ locale: 'en-US'
+ }
+ ]
+ },
expected: {
gComputer1: {
capabilities: [
- 'Alexa.Networking.ConnectedDevice',
- 'Alexa.Networking.AccessController.networkAccess',
+ 'Alexa.ToggleController:NetworkAccess.toggleState',
'Alexa.PowerController.powerState',
'Alexa.EndpointHealth.connectivity',
'Alexa'
],
displayCategories: ['COMPUTER'],
friendlyName: 'Computer',
- configuration: {
- 'Alexa.Networking.ConnectedDevice': {
- staticDeviceInformation: {
- deviceName: 'Computer',
- hostname: 'workstation',
- macAddress: '00:21:86:B5:6E:10'
- }
- },
- 'Alexa.Networking.AccessController': {
- supportsScheduling: false
+ propertyFlags: {
+ 'Alexa.ToggleController:NetworkAccess': {
+ proactivelyReported: false,
+ retrievable: true,
+ nonControllable: false
}
},
- relationships: {
- isConnectedBy: {
- endpointId: 'gRouter1'
+ resources: {
+ 'Alexa.ToggleController:NetworkAccess': {
+ friendlyNames: ['text:Network Access:en-US']
}
- }
- },
- gRouter1: {
- capabilities: ['Alexa.Networking.HomeNetworkController', 'Alexa'],
- displayCategories: ['ROUTER'],
- friendlyName: 'Router'
+ },
+ cookie: [
+ {
+ name: 'ToggleController',
+ instance: 'NetworkAccess',
+ property: 'toggleState',
+ parameters: {
+ capabilityNames: ['@Setting.NetworkAccess']
+ },
+ item: { name: 'networkAccess1', type: 'Switch' }
+ },
+ {
+ name: 'PowerController',
+ property: 'powerState',
+ parameters: {},
+ item: { name: 'power1', type: 'Switch' }
+ }
+ ]
}
}
};
diff --git a/lambda/test/alexa/cases/discovery/router.test.js b/lambda/test/alexa/cases/discovery/router.test.js
index 3c3014fc..2f2c6567 100644
--- a/lambda/test/alexa/cases/discovery/router.test.js
+++ b/lambda/test/alexa/cases/discovery/router.test.js
@@ -42,7 +42,6 @@ export default {
expected: {
gWirelessRouter: {
capabilities: [
- 'Alexa.Networking.HomeNetworkController',
'Alexa.ToggleController:guestNetwork.toggleState',
'Alexa.PlaybackController',
'Alexa.EndpointHealth.connectivity',
diff --git a/lambda/test/alexa/cases/index.js b/lambda/test/alexa/cases/index.js
index 104f36f4..21c83523 100644
--- a/lambda/test/alexa/cases/index.js
+++ b/lambda/test/alexa/cases/index.js
@@ -77,7 +77,6 @@ import equalizerControllerTest from './equalizerController.test.js';
import inputControllerTest from './inputController.test.js';
import lockControllerTest from './lockController.test.js';
import modeControllerTest from './modeController.test.js';
-import networkingAccessControllerTest from './networkingAccessController.test.js';
import percentageControllerTest from './percentageController.test.js';
import playbackControllerTest from './playbackController.test.js';
import powerControllerTest from './powerController.test.js';
@@ -160,7 +159,6 @@ export default {
InputController: [inputControllerTest],
LockController: [lockControllerTest],
ModeController: [modeControllerTest],
- NetworkingAccessController: [networkingAccessControllerTest],
PercentageController: [percentageControllerTest],
PlaybackController: [playbackControllerTest],
PowerController: [powerControllerTest],
diff --git a/lambda/test/alexa/cases/networkingAccessController.test.js b/lambda/test/alexa/cases/networkingAccessController.test.js
deleted file mode 100644
index 6f4996bc..00000000
--- a/lambda/test/alexa/cases/networkingAccessController.test.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * Copyright (c) 2010-2024 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
- */
-
-export default [
- {
- description: 'set network access',
- directive: {
- header: {
- namespace: 'Alexa.Networking.AccessController',
- name: 'SetNetworkAccess'
- },
- endpoint: {
- endpointId: 'gComputer',
- cookie: {
- capabilities: [
- {
- name: 'NetworkingConnectedDevice',
- property: 'connectedDevice',
- parameters: {
- connectedTo: 'gRouter',
- deviceName: 'Computer',
- macAddress: '00:21:86:B5:6E:10'
- },
- item: { name: 'gComputer', type: 'Group' }
- },
- {
- name: 'NetworkingAccessController',
- property: 'networkAccess',
- parameters: {},
- item: { name: 'networkAccess', type: 'Switch' }
- }
- ]
- }
- },
- payload: {
- networkAccess: 'BLOCKED'
- }
- },
- items: [{ name: 'networkAccess', state: 'OFF', type: 'Switch' }],
- expected: {
- alexa: {
- context: {
- properties: [
- {
- namespace: 'Alexa.Networking.AccessController',
- name: 'networkAccess',
- value: 'BLOCKED'
- }
- ]
- },
- event: {
- header: {
- namespace: 'Alexa',
- name: 'Response'
- }
- }
- },
- openhab: {
- commands: [{ name: 'networkAccess', value: 'OFF' }]
- }
- }
- },
- {
- description: 'set network access allowed inverted',
- directive: {
- header: {
- namespace: 'Alexa.Networking.AccessController',
- name: 'SetNetworkAccess'
- },
- endpoint: {
- endpointId: 'gComputer',
- cookie: {
- capabilities: [
- {
- name: 'NetworkingConnectedDevice',
- property: 'connectedDevice',
- parameters: {
- connectedTo: 'gRouter',
- deviceName: 'Computer',
- macAddress: '00:21:86:B5:6E:10'
- },
- item: { name: 'gComputer', type: 'Group' }
- },
- {
- name: 'NetworkingAccessController',
- property: 'networkAccess',
- parameters: {
- inverted: true
- },
- item: { name: 'networkAccess', type: 'Switch' }
- }
- ]
- }
- },
- payload: {
- networkAccess: 'ALLOWED'
- }
- },
- items: [{ name: 'networkAccess', state: 'OFF', type: 'Switch' }],
- expected: {
- alexa: {
- context: {
- properties: [
- {
- namespace: 'Alexa.Networking.AccessController',
- name: 'networkAccess',
- value: 'ALLOWED'
- }
- ]
- },
- event: {
- header: {
- namespace: 'Alexa',
- name: 'Response'
- }
- }
- },
- openhab: {
- commands: [{ name: 'networkAccess', value: 'OFF' }]
- }
- }
- },
- {
- description: 'set network access blocked inverted',
- directive: {
- header: {
- namespace: 'Alexa.Networking.AccessController',
- name: 'SetNetworkAccess'
- },
- endpoint: {
- endpointId: 'gComputer',
- cookie: {
- capabilities: [
- {
- name: 'NetworkingConnectedDevice',
- property: 'connectedDevice',
- parameters: {
- connectedTo: 'gRouter',
- deviceName: 'Computer',
- macAddress: '00:21:86:B5:6E:10'
- },
- item: { name: 'gComputer', type: 'Group' }
- },
- {
- name: 'NetworkingAccessController',
- property: 'networkAccess',
- parameters: {
- inverted: true
- },
- item: { name: 'networkAccess', type: 'Switch' }
- }
- ]
- }
- },
- payload: {
- networkAccess: 'BLOCKED'
- }
- },
- items: [{ name: 'networkAccess', state: 'ON', type: 'Switch' }],
- expected: {
- alexa: {
- context: {
- properties: [
- {
- namespace: 'Alexa.Networking.AccessController',
- name: 'networkAccess',
- value: 'BLOCKED'
- }
- ]
- },
- event: {
- header: {
- namespace: 'Alexa',
- name: 'Response'
- }
- }
- },
- openhab: {
- commands: [{ name: 'networkAccess', value: 'ON' }]
- }
- }
- }
-];
diff --git a/lambda/test/utils.test.js b/lambda/test/utils.test.js
index c1baa7e0..4be13dda 100644
--- a/lambda/test/utils.test.js
+++ b/lambda/test/utils.test.js
@@ -12,15 +12,7 @@
*/
import { expect } from 'chai';
-import {
- clamp,
- compressJSON,
- decompressJSON,
- decamelize,
- isMACAddress,
- parseUrl,
- stripPunctuation
-} from '#root/utils.js';
+import { clamp, compressJSON, decompressJSON, decamelize, parseUrl, stripPunctuation } from '#root/utils.js';
describe('Utilities Tests', () => {
describe('clamp', () => {
@@ -61,20 +53,6 @@ describe('Utilities Tests', () => {
});
});
- describe('is mac address', () => {
- it('eui-48 format with colon separator', () => {
- expect(isMACAddress('00:21:86:B5:6E:10')).to.be.true;
- });
-
- it('eui-64 format with dash separator', () => {
- expect(isMACAddress('00-21-86-FF-FE-B5-6E-10')).to.be.true;
- });
-
- it('invalid format', () => {
- expect(isMACAddress('invalid')).to.be.false;
- });
- });
-
describe('parse url', () => {
it('url only', () => {
expect(parseUrl('https://foo/bar'))
diff --git a/lambda/utils.js b/lambda/utils.js
index 2d86f8dd..9b04405c 100644
--- a/lambda/utils.js
+++ b/lambda/utils.js
@@ -59,15 +59,6 @@ export const decamelize = (string, separator = '_') => {
.toLowerCase();
};
-/**
- * Returns if given string is a mac address
- * @param {String} string
- * @return {Boolean}
- */
-export const isMACAddress = (string) => {
- return /^([0-9a-fA-F]{2}(-|:)){7}[0-9a-fA-F]{2}$|^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/.test(string);
-};
-
/**
* Returns parsed url object
* @param {String} url
diff --git a/resources/locales/en/catalog.json b/resources/locales/en/catalog.json
index a5f63d47..f30c4d88 100644
--- a/resources/locales/en/catalog.json
+++ b/resources/locales/en/catalog.json
@@ -7,6 +7,7 @@
"@Setting.Forward": "Forward",
"@Setting.Humidity": "Humidity",
"@Setting.Input": "Input",
+ "@Setting.NetworkAccess": "Network Access",
"@Setting.Position": "Position",
"@Setting.RangeValue": "Range Value",
"@Setting.Reverse": "Reverse",