Skip to content

Commit

Permalink
Merge 068a978 into 53f93b5
Browse files Browse the repository at this point in the history
  • Loading branch information
jsetton authored Jan 3, 2022
2 parents 53f93b5 + 068a978 commit 4be267d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,17 +396,7 @@ export default {
]
},
RangeValue: {
itemTypes: [
'Dimmer',
'Number',
'Number:Angle',
'Number:Dimensionless',
'Number:Length',
'Number:Mass',
'Number:Temperature',
'Number:Volume',
'Rollershutter'
],
itemTypes: ['Dimmer', 'Number', 'Number:*', 'Rollershutter'],
supports: ['multiInstance'],
parameters: (item) => [
p.capabilityNames(item.groups.length ? item.label : '@Setting.RangeValue', '@Setting.FanSpeed,Speed'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,16 @@ export default {
},
isVisible (cl) {
const { visible = () => true } = this.getDefinition(cl)
return !!AlexaDefinitions[cl] && !!AlexaDefinitions[cl][this.itemType] && visible(this.item)
return this.hasDefinition(cl) && visible(this.item)
},
getDefinition (cl, item) {
const itemType = item ? item.groupType || item.type : this.itemType
return (AlexaDefinitions[cl] && AlexaDefinitions[cl][itemType]) || {}
const defTypes = Object.keys(AlexaDefinitions[cl] || {})
const dt = defTypes.find((dt) => dt === itemType || (dt.endsWith('*') && itemType.startsWith(dt.slice(0, -1))))
return (dt && AlexaDefinitions[cl][dt]) || {}
},
hasDefinition (cl, item) {
return Object.keys(this.getDefinition(cl, item)).length > 0
},
hasRequiredGroupAttributes (cl, item, items) {
const { requires = [] } = this.getDefinition(cl, item)
Expand Down

0 comments on commit 4be267d

Please sign in to comment.