Skip to content

Commit 8fb7267

Browse files
authored
Merge pull request #391 from NRCHKB/bugfix/onChange
Fixed onChange fired when value not changed #390
2 parents f790bc9 + 83fa28f commit 8fb7267

File tree

4 files changed

+231
-239
lines changed

4 files changed

+231
-239
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ All notable changes to this project will be documented in this file.
1111
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
1212
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1313

14+
## [1.3.4]
15+
16+
### Fixed
17+
18+
- onChange fired when value not changed #390 - thanks for reporting @Delphius7
19+
1420
## [1.3.3]
1521

1622
### Fixed

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-homekit-bridged",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"description": "Node-RED nodes to simulate Apple HomeKit devices.",
55
"main": "build/nodes/nrchkb.js",
66
"scripts": {
@@ -57,21 +57,21 @@
5757
"@types/node-persist": "^3.1.1",
5858
"@types/node-red": "^1.1.1",
5959
"@types/semver": "^7.3.4",
60-
"@typescript-eslint/eslint-plugin": "^4.20.0",
61-
"@typescript-eslint/parser": "^4.20.0",
60+
"@typescript-eslint/eslint-plugin": "^4.22.0",
61+
"@typescript-eslint/parser": "^4.22.0",
6262
"babel-eslint": "^10.1.0",
63-
"eslint": "^7.23.0",
64-
"eslint-config-prettier": "^8.1.0",
63+
"eslint": "^7.24.0",
64+
"eslint-config-prettier": "^8.2.0",
6565
"eslint-plugin-prettier": "^3.3.1",
6666
"husky": "^6.0.0",
6767
"lint-staged": "^10.5.4",
6868
"mocha": "^8.3.2",
69-
"node-red": "^1.2.9",
69+
"node-red": "^1.3.2",
7070
"node-red-node-test-helper": "^0.2.7",
7171
"pinst": "^2.1.6",
7272
"prettier": "^2.2.1",
7373
"ts-node": "^9.1.1",
74-
"typescript": "^4.2.3"
74+
"typescript": "^4.2.4"
7575
},
7676
"husky": {
7777
"hooks": {

src/lib/utils/ServiceUtils.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,18 @@ module.exports = function (node: HAPServiceNodeType) {
168168
}`
169169
)
170170

171-
onValueChange.call(
172-
this,
173-
0,
174-
{
175-
oldValue,
176-
newValue,
177-
context,
178-
},
179-
originator
180-
)
171+
if (oldValue != newValue) {
172+
onValueChange.call(
173+
this,
174+
0,
175+
{
176+
oldValue,
177+
newValue,
178+
context,
179+
},
180+
originator
181+
)
182+
}
181183
}
182184

183185
const onInput = function (msg: Record<string, any>) {

0 commit comments

Comments
 (0)