Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed state and action used by the horizontal awning device #88

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions drivers/WindowCoveringsDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class WindowCoveringsDevice extends Device {
closed: 'down'
};

this.closureActionName = 'setClosure';
this.closureStateName = 'core:ClosureState';

this.registerCapabilityListener('windowcoverings_state', this.onCapabilityWindowcoveringsState.bind(this));
this.registerCapabilityListener('windowcoverings_set', this.onCapabilityWindowcoveringsSet.bind(this));
super.onInit();
Expand Down Expand Up @@ -66,7 +69,7 @@ class WindowCoveringsDevice extends Device {
const deviceData = this.getData();
if (!opts.fromCloudSync) {
const action = {
name: 'setClosure',
name: this.closureActionName,
parameters: [Math.round((1-value)*100)]
};
Tahoma.executeDeviceAction(deviceData.label, deviceData.deviceURL, action)
Expand All @@ -93,7 +96,7 @@ class WindowCoveringsDevice extends Device {
if (device) {
//device exists -> let's sync the state of the device
const states = device.states
.filter(state => state.name === 'core:OpenClosedState' || state.name === 'core:ClosureState')
.filter(state => state.name === 'core:OpenClosedState' || state.name === this.closureStateName)
.map(state => {
const value = this.windowcoveringsStatesMap[state.value] ? this.windowcoveringsStatesMap[state.value]: state.value;
return {
Expand Down
3 changes: 3 additions & 0 deletions drivers/io_horizontal_awning/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class HorizontalAwningDevice extends WindowCoveringsDevice {
open: 'down',
closed: 'up'
};

this.closureActionName = 'setPosition';
this.closureStateName = 'core:DeploymentState';
}
}

Expand Down