Skip to content

Commit

Permalink
Merge ad8fdc6 into f222794
Browse files Browse the repository at this point in the history
  • Loading branch information
jsetton authored Jul 31, 2022
2 parents f222794 + ad8fdc6 commit 58f4b06
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ export default {

// Switchable Attributes
PowerState: {
itemTypes: ['Color', 'Dimmer', 'Number', 'String', 'Switch'],
itemTypes: ['Color', 'Dimmer', 'Switch'],
customTypes: ['Number', 'String'],
parameters: (item) => [
...(item.type === 'Number' || item.type === 'String'
? [p.valueMapping('OFF', true), p.valueMapping('ON', true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ export default {
supportedAttributes: ['TargetTemperature', 'CurrentTemperature', ...fanAttributes]
},
AirFreshener: {
defaultAttributes: ['FanSpeed'],
defaultAttributes: ['PowerState', 'FanSpeed'],
supportedAttributes: fanAttributes
},
AirPurifier: {
defaultAttributes: ['FanSpeed'],
defaultAttributes: ['PowerState', 'FanSpeed'],
supportedAttributes: fanAttributes
},
Automobile: {
Expand Down Expand Up @@ -118,11 +118,11 @@ export default {
groupParameters: blindParameters
},
BluetoothSpeaker: {
defaultAttributes: ['VolumeLevel'],
defaultAttributes: ['PowerState', 'VolumeLevel'],
supportedAttributes: ['BatteryLevel', ...entertainmentAttributes]
},
Camera: {
defaultAttributes: ['CameraStream'],
defaultAttributes: ['PowerState', 'CameraStream'],
supportedAttributes: cameraAttributes
},
ChristmasTree: {
Expand Down Expand Up @@ -156,15 +156,15 @@ export default {
supportedAttributes: doorAttributes
},
Doorbell: {
defaultAttributes: ['CameraStream'],
defaultAttributes: ['PowerState', 'CameraStream'],
supportedAttributes: cameraAttributes
},
Dryer: {
defaultAttributes: ['PowerState'],
supportedAttributes: genericDeviceAttributes
},
Fan: {
defaultAttributes: ['FanSpeed'],
defaultAttributes: ['PowerState', 'FanSpeed'],
supportedAttributes: fanAttributes
},
GameConsole: {
Expand All @@ -177,7 +177,7 @@ export default {
supportedAttributes: ['ObstacleAlert', ...doorAttributes]
},
Headphones: {
defaultAttributes: ['VolumeLevel'],
defaultAttributes: ['PowerState', 'VolumeLevel'],
supportedAttributes: ['BatteryLevel', ...entertainmentAttributes]
},
Hub: {
Expand Down Expand Up @@ -211,7 +211,7 @@ export default {
supportedAttributes: ['MotionDetectionState', ...sensorAttributes]
},
MusicSystem: {
defaultAttributes: ['Playback'],
defaultAttributes: ['PowerState', 'Playback'],
supportedAttributes: entertainmentAttributes
},
NetworkHardware: {
Expand Down Expand Up @@ -243,7 +243,7 @@ export default {
supportsGroup: false
},
Screen: {
defaultAttributes: ['PowerState'],
defaultAttributes: ['PowerState', 'Channel'],
supportedAttributes: entertainmentAttributes
},
SecurityPanel: {
Expand All @@ -269,11 +269,11 @@ export default {
supportedAttributes: genericDeviceAttributes
},
Speaker: {
defaultAttributes: ['VolumeLevel'],
defaultAttributes: ['PowerState', 'VolumeLevel'],
supportedAttributes: entertainmentAttributes
},
StreamingDevice: {
defaultAttributes: ['Playback'],
defaultAttributes: ['PowerState', 'Playback'],
supportedAttributes: entertainmentAttributes
},
Switch: {
Expand All @@ -286,7 +286,7 @@ export default {
groupParameters: networkParameters
},
Television: {
defaultAttributes: ['Channel'],
defaultAttributes: ['PowerState', 'Channel'],
supportedAttributes: entertainmentAttributes
},
TemperatureSensor: {
Expand All @@ -299,7 +299,7 @@ export default {
groupParameters: (item) => [p.scale(item, true)]
},
VacuumCleaner: {
defaultAttributes: ['VacuumMode'],
defaultAttributes: ['PowerState', 'VacuumMode'],
supportedAttributes: ['VacuumMode', 'FanSpeed', 'BatteryLevel', ...genericDeviceAttributes]
},
Washer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ for (const type of Object.keys(deviceTypes)) {
}

for (const attribute of supportedAttributes) {
const { itemTypes = [], parameters = [], ...properties } = deviceAttributes[attribute]
const { itemTypes = [], customTypes = [], parameters = [], ...properties } = deviceAttributes[attribute]
classes[`${type}.${attribute}`] = {}
for (const itemType of itemTypes) {
for (const itemType of [...itemTypes, ...customTypes]) {
classes[`${type}.${attribute}`][itemType] = { parameters: [defaultParameters].concat(parameters), ...properties }
}
}
Expand Down

0 comments on commit 58f4b06

Please sign in to comment.