Skip to content

Commit

Permalink
Update thermostat hold attribute (#1222)
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <jeremy.setton@gmail.com>
  • Loading branch information
jsetton committed Dec 7, 2021
1 parent 7ee8d9c commit 67ab42d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ export default {
ThermostatHold: {
itemTypes: ['Number', 'String', 'Switch'],
requires: ['HeatingCoolingMode'],
parameters: (item) => [p.valueMapping('RESUME')]
parameters: (item) => [
...(item.type === 'Switch' ? [p.inverted()] : [p.valueMapping('OFF'), p.valueMapping('ON')]),
p.requiresSetpointHold()
]
},
ThermostatFan: {
itemTypes: ['String', 'Switch'],
Expand Down Expand Up @@ -405,9 +408,9 @@ export default {
supports: ['multiInstance'],
parameters: (item) => [
p.capabilityNames(item.groups.length ? item.label : '@Setting.RangeValue', '@Setting.FanSpeed,Speed'),
p.inverted(item.type === 'Rollershutter'),
p.nonControllable(item.stateDescription),
p.retrievable(),
p.inverted(item.type === 'Rollershutter'),
...(item.type === 'Dimmer'
? [p.supportedCommands(['ON', 'OFF', 'INCREASE', 'DECREASE'], 'INCREASE=@Value.Up,DECREASE=@Value.Down')]
: item.type === 'Rollershutter'
Expand All @@ -428,13 +431,10 @@ export default {
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'),
...(item.type === 'Switch' ? [p.inverted()] : [p.valueMapping('OFF', true), p.valueMapping('ON', true)]),
p.nonControllable(item.stateDescription),
p.retrievable(),
p.inverted(),
p.language(item.settings && item.settings.regional.language),
p.actionMappings(['ON', 'OFF'], 'Close=OFF,Open=ON'),
p.stateMappings(['ON', 'OFF'], 'Closed=OFF,Open=ON')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ export default {
required: true,
pattern: 'https://.+'
}),
requiresSetpointHold: () => ({
name: 'requiresSetpointHold',
label: 'Requires Hold on Setpoint Requests',
type: 'BOOLEAN',
default: false
}),
resolution: () => ({
name: 'resolution',
label: 'Resolution',
Expand Down

0 comments on commit 67ab42d

Please sign in to comment.