Skip to content

Commit 4ad26c5

Browse files
authored
Merge pull request #59 from nikkow/bugfix/custom-position
Bugfix/custom position
2 parents 334955d + 609fdae commit 4ad26c5

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [3.0.0-beta.5] - 2022-06-04
6+
7+
---
8+
9+
⚠️ This release is a **beta** release. Use it at your own risk.
10+
11+
---
12+
13+
---
14+
15+
🚨 **This release is a major version and contains some breaking changes. Please read the list below.**
16+
17+
---
18+
19+
### Fixed
20+
21+
- Nothing happened when a `customPosition` command was issued.
22+
523
## [3.0.0-beta.4] - 2022-05-19
624

725
---

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-tahoma",
3-
"version": "3.0.0-beta.4",
3+
"version": "3.0.0-beta.5",
44
"description": "Control a Somfy Tahoma box from Node RED",
55
"main": "index.js",
66
"scripts": {

src/interfaces/command.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface ICommand {
22
name: string;
3-
parameters?: ICommandParameter[];
3+
parameters?: number[];
44
}
55

66
export interface ICommandParameter {

src/nodes/tahoma.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ interface ITahomaControlPayload {
1616
}
1717

1818
interface ITahomaControlInstructions {
19-
command: 'open' | 'close' | 'position' | 'rotation' | 'stop';
20-
parameters?: Array<{ name: string; value: number | string }>;
19+
command: 'open' | 'close' | 'rotation' | 'stop' | 'setClosure';
20+
parameters?: number[];
2121
expectedState?: { open?: boolean; position?: number; orientation?: number };
2222
labels: {
2323
done: string;
@@ -74,7 +74,7 @@ export = (RED: nodered.NodeAPI) => {
7474
if (msg.payload.lowspeed && instructions.command !== 'stop') {
7575
const targetPosition = instructions.expectedState.position || 0;
7676
command.name = 'position_low_speed';
77-
command.parameters = [{ name: 'position', value: targetPosition }];
77+
command.parameters = [targetPosition];
7878
}
7979

8080
this.status({
@@ -135,7 +135,7 @@ function generateInstructionsFromPayload(
135135

136136
case 'customPosition':
137137
return {
138-
command: 'position',
138+
command: 'setClosure',
139139
expectedState: {
140140
open: true,
141141
position: parseInt(payload.position, 10),
@@ -144,9 +144,7 @@ function generateInstructionsFromPayload(
144144
done: `Set to ${payload.position}`,
145145
progress: `Setting to ${payload.position}`,
146146
},
147-
parameters: [
148-
{ name: 'position', value: parseInt(payload.position, 10) },
149-
],
147+
parameters: [parseInt(payload.position, 10)],
150148
};
151149

152150
case 'customRotation':
@@ -157,9 +155,7 @@ function generateInstructionsFromPayload(
157155
done: `Rotated to ${payload.orientation}`,
158156
progress: `Rotating to ${payload.orientation}...`,
159157
},
160-
parameters: [
161-
{ name: 'orientation', value: parseInt(payload.orientation, 10) },
162-
],
158+
parameters: [parseInt(payload.orientation, 10)],
163159
};
164160

165161
case 'stop':

0 commit comments

Comments
 (0)