-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add air quality monitor + remote device types (#601)
Signed-off-by: jsetton <[email protected]>
- Loading branch information
Showing
9 changed files
with
1,330 additions
and
866 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) 2010-2023 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 AlexaDisplayCategory from '#alexa/smarthome/category.js'; | ||
import Sensor from './sensor.js'; | ||
import { Temperature, Humidity } from '../attributes/index.js'; | ||
|
||
/** | ||
* Defines air quality monitor device type class | ||
* @extends Sensor | ||
*/ | ||
export default class AirQualityMonitor extends Sensor { | ||
/** | ||
* Returns supported names | ||
* @return {Array} | ||
*/ | ||
static get supportedNames() { | ||
return ['AirQualityMonitor']; | ||
} | ||
|
||
/** | ||
* Returns supported attributes | ||
* @return {Array} | ||
*/ | ||
static get supportedAttributes() { | ||
return [Temperature, Humidity, ...super.supportedAttributes]; | ||
} | ||
|
||
/** | ||
* Returns display categories | ||
* @return {Array} | ||
*/ | ||
static get displayCategories() { | ||
return [AlexaDisplayCategory.AIR_QUALITY_MONITOR]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2010-2023 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 AlexaDisplayCategory from '#alexa/smarthome/category.js'; | ||
import GenericDevice from './genericDevice.js'; | ||
|
||
/** | ||
* Defines remote device type class | ||
* @extends GenericDevice | ||
*/ | ||
export default class Remote extends GenericDevice { | ||
/** | ||
* Returns supported names | ||
* @return {Array} | ||
*/ | ||
static get supportedNames() { | ||
return ['Remote']; | ||
} | ||
|
||
/** | ||
* Returns display categories | ||
* @return {Array} | ||
*/ | ||
static get displayCategories() { | ||
return [AlexaDisplayCategory.REMOTE]; | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
lambda/test/alexa/cases/discovery/airQualityMonitor.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/** | ||
* Copyright (c) 2010-2023 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: 'air quality monitor', | ||
items: [ | ||
{ | ||
type: 'Group', | ||
name: 'gAirQualityMonitor', | ||
label: 'Air Quality Monitor', | ||
metadata: { | ||
alexa: { | ||
value: 'AirQualityMonitor' | ||
} | ||
} | ||
}, | ||
{ | ||
type: 'Number:Dimensionless', | ||
name: 'humidity', | ||
groupNames: ['gAirQualityMonitor'], | ||
metadata: { | ||
alexa: { | ||
value: 'CurrentHumidity' | ||
} | ||
} | ||
}, | ||
{ | ||
type: 'Number:Temperature', | ||
name: 'temperature', | ||
groupNames: ['gAirQualityMonitor'], | ||
metadata: { | ||
alexa: { | ||
value: 'CurrentTemperature' | ||
} | ||
} | ||
} | ||
], | ||
catalog: { | ||
'@Setting.Humidity': [ | ||
{ | ||
text: 'Humidity', | ||
locale: 'en-US' | ||
} | ||
] | ||
}, | ||
expected: { | ||
gAirQualityMonitor: { | ||
capabilities: [ | ||
'Alexa.RangeController:Humidity.rangeValue', | ||
'Alexa.RangeController:Temperature.rangeValue', | ||
'Alexa.EndpointHealth.connectivity', | ||
'Alexa' | ||
], | ||
displayCategories: ['AIR_QUALITY_MONITOR'], | ||
friendlyName: 'Air Quality Monitor', | ||
propertyFlags: { | ||
'Alexa.RangeController:Humidity': { | ||
proactivelyReported: false, | ||
retrievable: true, | ||
nonControllable: true | ||
}, | ||
'Alexa.RangeController:Temperature': { | ||
proactivelyReported: false, | ||
retrievable: true, | ||
nonControllable: true | ||
} | ||
}, | ||
resources: { | ||
'Alexa.RangeController:Humidity': { | ||
friendlyNames: ['text:Humidity:en-US'] | ||
}, | ||
'Alexa.RangeController:Temperature': { | ||
friendlyNames: ['asset:Alexa.Setting.Temperature'] | ||
} | ||
}, | ||
configuration: { | ||
'Alexa.RangeController:Humidity': { | ||
supportedRange: { minimumValue: 0, maximumValue: 100, precision: 1 }, | ||
unitOfMeasure: 'Alexa.Unit.Percent' | ||
}, | ||
'Alexa.RangeController:Temperature': { | ||
supportedRange: { minimumValue: -50, maximumValue: 100, precision: 0.5 }, | ||
unitOfMeasure: 'Alexa.Unit.Temperature.Celsius' | ||
} | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright (c) 2010-2023 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: 'remote', | ||
items: [ | ||
{ | ||
type: 'Switch', | ||
name: 'remote', | ||
label: 'Remote', | ||
metadata: { | ||
alexa: { | ||
value: 'Remote' | ||
} | ||
} | ||
} | ||
], | ||
expected: { | ||
remote: { | ||
capabilities: ['Alexa.PowerController.powerState', 'Alexa.EndpointHealth.connectivity', 'Alexa'], | ||
displayCategories: ['REMOTE'], | ||
friendlyName: 'Remote' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.