homebridge-lgwebos-tv 4.2.2 → 4.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/config.schema.json +4 -5
- package/package.json +1 -1
- package/src/lgwebossocket.js +32 -28
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
|
15
15
|
- For plugin < v4.1.0 use Homebridge UI <= v5.5.0
|
|
16
16
|
- For plugin >= v4.1.0 use Homebridge UI >= v5.13.0
|
|
17
17
|
|
|
18
|
+
## [4.2.3] - (23.01.2026)
|
|
19
|
+
|
|
20
|
+
## Changes
|
|
21
|
+
|
|
22
|
+
- fix sensor state update on initial power on, thanks @stanislc, closes [#300](https://github.com/grzegorz914/homebridge-lgwebos-tv/pull/300)
|
|
23
|
+
- config schema update
|
|
24
|
+
- cleanup
|
|
25
|
+
|
|
18
26
|
## [4.2.2] - (20.01.2026)
|
|
19
27
|
|
|
20
28
|
## Changes
|
package/config.schema.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"title": "IP/Hostname",
|
|
30
30
|
"type": "string",
|
|
31
31
|
"placeholder": "192.168.1.8 or tv.local",
|
|
32
|
-
"pattern": "^(
|
|
32
|
+
"pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)(\\.([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?))*)$"
|
|
33
33
|
},
|
|
34
34
|
"mac": {
|
|
35
35
|
"title": "Address Mac",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"minimum": 0,
|
|
44
44
|
"maximum": 4,
|
|
45
45
|
"default": 1,
|
|
46
|
-
"description": "Accessory type for Home app",
|
|
47
46
|
"anyOf": [
|
|
48
47
|
{
|
|
49
48
|
"title": "Disabled",
|
|
@@ -1583,13 +1582,13 @@
|
|
|
1583
1582
|
"title": "Turn Screen ON/OFF",
|
|
1584
1583
|
"type": "boolean",
|
|
1585
1584
|
"default": false,
|
|
1586
|
-
"description": "This enable possibility turn screen ON/OFF, webOS >= 4.0."
|
|
1585
|
+
"description": "This enable possibility turn screen ON/OFF, webOS >= 4.0.0"
|
|
1587
1586
|
},
|
|
1588
1587
|
"saverOnOff": {
|
|
1589
1588
|
"title": "Turn Screen Saver ON/OFF",
|
|
1590
1589
|
"type": "boolean",
|
|
1591
1590
|
"default": false,
|
|
1592
|
-
"description": "This enable possibility turn screen saver ON/OFF, webOS >= 4.0."
|
|
1591
|
+
"description": "This enable possibility turn screen saver ON/OFF, webOS >= 4.0.0"
|
|
1593
1592
|
}
|
|
1594
1593
|
}
|
|
1595
1594
|
},
|
|
@@ -1741,7 +1740,7 @@
|
|
|
1741
1740
|
"title": "IP/Hostname",
|
|
1742
1741
|
"type": "string",
|
|
1743
1742
|
"placeholder": "192.168.1.20 or mqtt.local",
|
|
1744
|
-
"pattern": "^(
|
|
1743
|
+
"pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)(\\.([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?))*)$",
|
|
1745
1744
|
"description": "Here set the IP/Hostname of MQTT Broker.",
|
|
1746
1745
|
"condition": {
|
|
1747
1746
|
"functionBody": "return model.devices[arrayIndices].mqtt.enable === true;"
|
package/package.json
CHANGED
package/src/lgwebossocket.js
CHANGED
|
@@ -97,17 +97,24 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
97
97
|
this.cidCount = 0;
|
|
98
98
|
this.power = false;
|
|
99
99
|
this.screenState = 'Suspend';
|
|
100
|
+
this.updateTvState();
|
|
100
101
|
};
|
|
101
102
|
|
|
102
103
|
updateTvState() {
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.emit('
|
|
106
|
-
this.emit('
|
|
107
|
-
this.emit('
|
|
108
|
-
this.emit('
|
|
109
|
-
this.emit('
|
|
110
|
-
this.emit('
|
|
104
|
+
this.power = false;
|
|
105
|
+
this.updateSensors();
|
|
106
|
+
this.emit('powerState', this.power, this.screenState);
|
|
107
|
+
this.emit('currentApp', this.appId, this.power);
|
|
108
|
+
this.emit('audioState', this.volume, this.mute, this.power);
|
|
109
|
+
this.emit('pictureSettings', this.brightness, this.backlight, this.contrast, this.color, this.power);
|
|
110
|
+
this.emit('pictureMode', this.pictureMode, this.power);
|
|
111
|
+
this.emit('soundMode', this.soundMode, this.power);
|
|
112
|
+
this.emit('soundOutput', this.soundOutput, this.power);
|
|
113
|
+
this.emit('mediainfo', this.appId, this.playState, this.appType, this.power);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
updateSensors() {
|
|
117
|
+
this.emit('updateSensors', this.power, this.screenState, this.appId, this.volume, this.mute, this.soundMode, this.soundOutput, this.pictureMode, this.playState, this.channelId);
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
async getCid(type) {
|
|
@@ -206,10 +213,6 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
206
213
|
await this.send('subscribe', ApiUrls.GetForegroundAppMediaInfo, undefined, this.mediaInfoId);
|
|
207
214
|
}
|
|
208
215
|
|
|
209
|
-
//Request specjalized socket
|
|
210
|
-
this.specializedSocketId = await this.getCid();
|
|
211
|
-
await this.send('request', ApiUrls.SocketUrl, undefined, this.specializedSocketId);
|
|
212
|
-
|
|
213
216
|
if (this.logDebug) this.emit('debug', `Subscribe tv status successful`);
|
|
214
217
|
|
|
215
218
|
return true;
|
|
@@ -283,11 +286,6 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
async updateSensors() {
|
|
287
|
-
this.emit('updateSensors', this.power, this.screenState, this.appId, this.volume, this.mute, this.soundMode, this.soundOutput, this.pictureMode, this.playState, this.channelId);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
289
|
async registerToTv() {
|
|
292
290
|
try {
|
|
293
291
|
Pairing['client-key'] = this.pairingKey;
|
|
@@ -319,7 +317,6 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
319
317
|
.on('close', () => {
|
|
320
318
|
if (this.logDebug) this.emit('debug', `Socket closed`);
|
|
321
319
|
this.cleanupSocket();
|
|
322
|
-
this.updateTvState();
|
|
323
320
|
})
|
|
324
321
|
.on('open', async () => {
|
|
325
322
|
if (this.logDebug) this.emit('debug', `Plugin received heartbeat from TV`);
|
|
@@ -367,14 +364,21 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
367
364
|
this.emit('success', 'Pairing key saved');
|
|
368
365
|
}
|
|
369
366
|
|
|
367
|
+
//Request specjalized socket
|
|
368
|
+
this.specializedSocketId = await this.getCid();
|
|
369
|
+
await this.send('request', ApiUrls.SocketUrl, undefined, this.specializedSocketId);
|
|
370
|
+
|
|
370
371
|
//Send initial power state
|
|
371
372
|
if (!this.power) {
|
|
372
|
-
this.
|
|
373
|
+
this.power = true;
|
|
374
|
+
this.screenState = 'Active';
|
|
375
|
+
|
|
376
|
+
this.updateSensors();
|
|
377
|
+
this.emit('powerState', this.power, 'Active');
|
|
373
378
|
|
|
374
379
|
//Request system info data
|
|
375
380
|
this.systemInfoId = await this.getCid();
|
|
376
381
|
await this.send('request', ApiUrls.GetSystemInfo, undefined, this.systemInfoId);
|
|
377
|
-
this.power = true;
|
|
378
382
|
}
|
|
379
383
|
break;
|
|
380
384
|
case 'error':
|
|
@@ -665,7 +669,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
665
669
|
return;
|
|
666
670
|
}
|
|
667
671
|
|
|
668
|
-
|
|
672
|
+
this.updateSensors();
|
|
669
673
|
this.emit('powerState', this.power, this.screenState);
|
|
670
674
|
if (!this.power) this.updateTvState();
|
|
671
675
|
|
|
@@ -699,7 +703,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
699
703
|
if (!appId) return;
|
|
700
704
|
this.appId = appId;
|
|
701
705
|
|
|
702
|
-
|
|
706
|
+
this.updateSensors();
|
|
703
707
|
this.emit('currentApp', appId, this.power);
|
|
704
708
|
|
|
705
709
|
//restFul
|
|
@@ -725,7 +729,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
725
729
|
this.volume = volume;
|
|
726
730
|
this.mute = mute
|
|
727
731
|
|
|
728
|
-
|
|
732
|
+
this.updateSensors();
|
|
729
733
|
this.emit('audioState', volume, mute, this.power);
|
|
730
734
|
|
|
731
735
|
const soundOutput = messageData.soundOutput ?? this.soundOutput;
|
|
@@ -758,7 +762,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
758
762
|
if (!channelId) return;
|
|
759
763
|
this.channelId = channelId;
|
|
760
764
|
|
|
761
|
-
|
|
765
|
+
this.updateSensors();
|
|
762
766
|
this.emit('currentChannel', channelId, channelName, channelNumber, this.power);
|
|
763
767
|
|
|
764
768
|
//restFul
|
|
@@ -816,7 +820,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
816
820
|
if (!pictureMode) return;
|
|
817
821
|
this.pictureMode = pictureMode;
|
|
818
822
|
|
|
819
|
-
|
|
823
|
+
this.updateSensors();
|
|
820
824
|
this.emit('pictureMode', pictureMode, this.power);
|
|
821
825
|
|
|
822
826
|
//restFul
|
|
@@ -843,7 +847,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
843
847
|
const soundMode = settings.soundMode ?? this.soundMode;
|
|
844
848
|
this.soundMode = soundMode;
|
|
845
849
|
|
|
846
|
-
|
|
850
|
+
this.updateSensors();
|
|
847
851
|
this.emit('soundMode', soundMode, this.power);
|
|
848
852
|
|
|
849
853
|
//restFul
|
|
@@ -868,7 +872,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
868
872
|
if (!soundOutput) return;
|
|
869
873
|
this.soundOutput = soundOutput;
|
|
870
874
|
|
|
871
|
-
|
|
875
|
+
this.updateSensors();
|
|
872
876
|
this.emit('soundOutput', soundOutput, this.power);
|
|
873
877
|
|
|
874
878
|
//restFul
|
|
@@ -902,7 +906,7 @@ class LgWebOsSocket extends EventEmitter {
|
|
|
902
906
|
this.playState = playState;
|
|
903
907
|
this.appType = appType;
|
|
904
908
|
|
|
905
|
-
|
|
909
|
+
this.updateSensors();
|
|
906
910
|
this.emit('mediaInfo', appId, playState, appType, this.power);
|
|
907
911
|
|
|
908
912
|
//restFul
|