Skip to content

Commit

Permalink
Limit alexa parameter state description options (openhab#1621)
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <jeremy.setton@gmail.com>
Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>
  • Loading branch information
jsetton authored and crnjan committed Jan 17, 2023
1 parent b938556 commit 3a206c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const PLAYBACK_OPERATIONS = ['Play', 'Pause', 'Previous', 'Next', 'Rewind

export const PLAYBACK_STEPS = ['PLAY', 'PAUSE', 'STOP', 'START_OVER', 'PREVIOUS', 'NEXT', 'REWIND', 'FAST_FORWARD']

export const STATE_DESCRIPTION_OPTIONS_LIMIT = 150

export const TEMPERATURE_SCALES = ['CELSIUS', 'FAHRENHEIT']

export const THERMOSTAT_MODES = ['OFF', 'HEAT', 'COOL', 'ECO', 'AUTO']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
EQUALIZER_MODES,
LANGUAGES,
PLAYBACK_OPERATIONS,
STATE_DESCRIPTION_OPTIONS_LIMIT,
TEMPERATURE_SCALES,
THERMOSTAT_MODES,
UNITS_OF_MEASURE
Expand Down Expand Up @@ -232,7 +233,8 @@ export default {
stateDescription.options &&
stateDescription.options
.filter((option) => !isNaN(option.value))
.map((option) => `${option.value}=${option.label}`),
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true
}),
Expand Down Expand Up @@ -356,7 +358,9 @@ export default {
default:
stateDescription &&
stateDescription.options &&
stateDescription.options.map((option) => `${option.value}=${option.label}`),
stateDescription.options
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: placeholder.replace(/,/g, '\n'),
multiple: true,
required: !stateDescription || !stateDescription.options || !stateDescription.options.length
Expand All @@ -370,7 +374,9 @@ export default {
default:
stateDescription &&
stateDescription.options &&
stateDescription.options.map((option) => `${option.value}=${option.label}`),
stateDescription.options
.map((option) => `${option.value}=${option.label}`)
.slice(0, STATE_DESCRIPTION_OPTIONS_LIMIT),
placeholder: 'Normal=Normal:Cottons\nWhites=Whites',
multiple: true,
required: !stateDescription || !stateDescription.options || !stateDescription.options.length
Expand Down

0 comments on commit 3a206c7

Please sign in to comment.