diff --git a/docs/USAGE.md b/docs/USAGE.md index da79204d..82586e49 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -194,7 +194,7 @@ Switch { ga="Fireplace" } Switch { ga="Valve" [ inverted=true ] } ``` -### Sprinkler, Vacuum +### Sprinkler, Vacuum, Washer, Dishwasher | | | |---|---| @@ -206,6 +206,8 @@ Switch { ga="Valve" [ inverted=true ] } ```shell Switch { ga="Sprinkler" [ inverted=true ] } Switch { ga="Vacuum" [ inverted=false ] } +Switch { ga="Washer" [ inverted=false ] } +Switch { ga="Dishwasher" [ inverted=false ] } ``` ### Lock diff --git a/functions/devices/dishwasher.js b/functions/devices/dishwasher.js new file mode 100644 index 00000000..02d29192 --- /dev/null +++ b/functions/devices/dishwasher.js @@ -0,0 +1,9 @@ +const StartStopSwitch = require('./startstopswitch.js'); + +class Dishwasher extends StartStopSwitch { + static get type() { + return 'action.devices.types.DISHWASHER'; + } +} + +module.exports = Dishwasher; diff --git a/functions/devices/startstopswitch.js b/functions/devices/startstopswitch.js index 0274f7fe..7d8037a5 100644 --- a/functions/devices/startstopswitch.js +++ b/functions/devices/startstopswitch.js @@ -19,8 +19,7 @@ class StartStopSwitch extends DefaultDevice { state = !state; } return { - isRunning: state, - isPaused: !state + isRunning: state }; } } diff --git a/functions/devices/washer.js b/functions/devices/washer.js new file mode 100644 index 00000000..7830a2ec --- /dev/null +++ b/functions/devices/washer.js @@ -0,0 +1,9 @@ +const StartStopSwitch = require('./startstopswitch.js'); + +class Washer extends StartStopSwitch { + static get type() { + return 'action.devices.types.WASHER'; + } +} + +module.exports = Washer; diff --git a/tests/devices/startstopswitch.test.js b/tests/devices/startstopswitch.test.js index 2fcaa1d6..24d16479 100644 --- a/tests/devices/startstopswitch.test.js +++ b/tests/devices/startstopswitch.test.js @@ -15,12 +15,10 @@ describe('StartStopSwitch Device', () => { describe('getState', () => { test('getState', () => { expect(Device.getState({ state: 'ON' })).toStrictEqual({ - isRunning: true, - isPaused: false + isRunning: true }); expect(Device.getState({ state: 'OFF' })).toStrictEqual({ - isRunning: false, - isPaused: true + isRunning: false }); }); @@ -36,13 +34,11 @@ describe('StartStopSwitch Device', () => { } }; expect(Device.getState(item)).toStrictEqual({ - isRunning: false, - isPaused: true + isRunning: false }); item.state = 'OFF'; expect(Device.getState(item)).toStrictEqual({ - isRunning: true, - isPaused: false + isRunning: true }); }); });