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

Update alexa blind and channel attributes #1220

Merged
merged 1 commit into from
Dec 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,52 @@ export default {
itemTypes: ['Dimmer', 'Rollershutter'],
parameters: (item) => [
p.inverted(item.type === 'Rollershutter'),
p.presets(item.stateDescription, '20=Morning,60=Afternoon,80=Evening:@Setting.Night', true),
p.language(item.settings && item.settings.regional.language)
p.presets(item.stateDescription, '20=Morning,60=Afternoon,80=Evening:@Setting.Night'),
p.language(item.settings && item.settings.regional.language),
p.actionMappings(
{ default: 'value' },
'Close=0,Open=100,Lower=0,Raise=100',
(config) => {
if (item.type === 'Dimmer') {
return config.inverted === true
? ['Close=100', 'Open=0', 'Lower=100', 'Raise=0']
: ['Close=0', 'Open=100', 'Lower=0', 'Raise=100']
}
if (item.type === 'Rollershutter') {
return ['Close=DOWN', 'Open=UP', 'Lower=DOWN', 'Raise=UP', 'Stop=STOP']
}
}
)
]
},
TiltAngle: {
itemTypes: ['Dimmer', 'Number', 'Number:Angle', 'Rollershutter'],
parameters: (item) => [
p.inverted(item.type === 'Rollershutter'),
p.presets(item.stateDescription, '20=Morning,60=Afternoon,80=Evening:@Setting.Night', true),
p.language(item.settings && item.settings.regional.language)
p.presets(item.stateDescription, '20=Morning,60=Afternoon,80=Evening:@Setting.Night'),
p.language(item.settings && item.settings.regional.language),
p.actionMappings(
{ default: 'value' },
'Close=0,Open=100',
(config) => {
if (item.type === 'Dimmer') {
return config.inverted === true ? ['Close=100', 'Open=0'] : ['Close=0', 'Open=100']
}
if (item.type === 'Number' || item.type === 'Number:Angle') {
return config.inverted === true ? ['Close=90', 'Open=0'] : ['Close=-90', 'Open=0']
}
if (item.type === 'Rollershutter') {
return ['Close=DOWN', 'Open=UP', 'Stop=STOP']
}
}
)
]
},

// Entertainment Attributes
Channel: {
itemTypes: ['Number', 'String'],
parameters: () => [p.channelMappings(), p.retrievable()]
parameters: (item) => [p.channelMappings(item.stateDescription), p.channelRange(), p.retrievable()]
},
Input: {
itemTypes: ['Number', 'String'],
Expand Down Expand Up @@ -396,9 +425,12 @@ export default {
]
},
ToggleState: {
itemTypes: ['Switch'],
itemTypes: ['Number', 'String', 'Switch'],
supports: ['multiInstance'],
parameters: (item) => [
...(item.type === 'Number' || item.type === 'String'
? [p.valueMapping('OFF', true), p.valueMapping('ON', true)]
: []),
p.capabilityNames(item.groups.length ? item.label : '@Setting.ToggleState', '@Setting.Oscillate,Rotate'),
p.nonControllable(item.stateDescription),
p.retrievable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export default {
supportsGroup: false
},
AirConditioner: {
defaultAttributes: ['HeatingCoolingMode'],
supportedAttributes: ['HeatingCoolingMode', 'TargetTemperature', 'CurrentTemperature', ...fanAttributes]
defaultAttributes: ['PowerState'],
supportedAttributes: ['PowerState', 'TargetTemperature', 'CurrentTemperature', ...fanAttributes]
},
AirFreshener: {
defaultAttributes: ['FanSpeed'],
Expand All @@ -96,6 +96,7 @@ export default {
'FanSpeed',
'LockState',
'PowerState',
'TargetTemperature',
'CurrentTemperature',
...genericAttributes
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import {
} from './helpers.js'

export default {
actionMappings: (format, placeholder) => ({
actionMappings: (format, placeholder, defaultValue) => ({
name: 'actionMappings',
label: 'Action Mappings',
description: `Each mapping formatted as ${getSemanticFormat('action', format)} (${docLink('Semantic Extensions')})`,
type: 'TEXT',
default: defaultValue,
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true
multiple: true,
advanced: !!defaultValue
}),
capabilityNames: (defaultValue, placeholder) => ({
name: 'capabilityNames',
Expand All @@ -36,14 +38,29 @@ export default {
multiple: true,
required: !defaultValue
}),
channelMappings: () => ({
channelMappings: (stateDescription) => ({
name: 'channelMappings',
label: 'Channel Mappings',
description: 'Each mapping formatted as <code>channelName=channelNumber<code>',
description: 'Each mapping formatted as <code>channelNumber=channelName<code>',
type: 'TEXT',
placeholder: 'CBS=2\nNBC=4\nABC=7\nPBS=13',
default:
stateDescription &&
stateDescription.options &&
stateDescription.options
.filter((option) => !isNaN(option.value))
.map((option) => `${option.value}=${option.label}`),
placeholder: '2=CBS\n4=NBC\n7=ABC\n13=PBS',
multiple: true
}),
channelRange: () => ({
name: 'range',
label: 'Channel Range',
description: 'Formatted as <code>minValue:maxValue</code>',
type: 'TEXT',
default: '1:9999',
pattern: '[0-9]+:[0-9]+',
advanced: true
}),
colorTemperatureBinding: () => ({
name: 'binding',
label: 'Binding/Device Type',
Expand All @@ -69,7 +86,7 @@ export default {
colorTemperatureRange: () => ({
name: 'range',
label: 'Temperature Range in Kelvin',
description: 'Formatted as <code>minRange:maxRange</code>',
description: 'Formatted as <code>minValue:maxValue</code>',
type: 'TEXT',
default: '1000:10000',
pattern: '[0-9]+:[0-9]+',
Expand Down Expand Up @@ -122,7 +139,7 @@ export default {
equalizerRange: (defaultValue) => ({
name: 'range',
label: 'Equalizer Range',
description: 'Formatted as <code>minRange:maxRange</code>',
description: 'Formatted as <code>minValue:maxValue</code>',
type: 'TEXT',
default: defaultValue,
pattern: '[+-]?[0-9]+:[+-]?[0-9]+'
Expand Down Expand Up @@ -196,7 +213,7 @@ export default {
multiple: true,
advanced: true
}),
presets: (stateDescription, placeholder, advanced = false) => ({
presets: (stateDescription, placeholder) => ({
name: 'presets',
label: 'Presets',
description:
Expand All @@ -210,8 +227,7 @@ export default {
.filter((option) => !isNaN(option.value))
.map((option) => `${option.value}=${option.label}`),
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true,
advanced
multiple: true
}),
primaryControl: () => ({
name: 'primaryControl',
Expand Down Expand Up @@ -257,7 +273,7 @@ export default {
setpointRange: (item) => ({
name: 'setpointRange',
label: 'Setpoint Range',
description: 'Formatted as <code>minRange:maxRange</code>',
description: 'Formatted as <code>minValue:maxValue</code>',
type: 'TEXT',
default: (config) => {
const scale = config.scale || getGroupParameter('scale', item.groups) || getTemperatureScale(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{ cl }}
</option>
</optgroup>
<optgroup label="Generic Attributes" v-if="!multiple">
<optgroup label="Generic Attributes">
<option v-for="cl in genericClasses" :value="cl" :key="cl" :selected="isSelected(cl)">
{{ cl }}
</option>
Expand Down