homebridge-samsung-local 1.0.0 → 1.0.2
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 +42 -0
- package/README.ar.md +2 -2
- package/README.md +2 -2
- package/config.schema.json +3 -3
- package/docs/MIGRATION.md +12 -12
- package/homebridge-ui/public/index.html +25 -9
- package/package.json +1 -1
- package/python/bridge.py +4 -2
- package/src/deviceLink.js +1 -0
- package/src/homekit/acAccessory.js +8 -3
- package/src/platform.js +16 -1
- package/src/settings.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Versions follow [Semantic Versioning](https://semver.org/). Releases are published under the npm tag `latest`; pre-releases under `beta`.
|
|
4
4
|
|
|
5
|
+
## 1.0.2 — 2026-11-22
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Accessories are named exactly as typed in the settings. The automatic "Local" suffix is gone. Existing accessories take the new name on the next restart; a name you gave a tile in the Home app is not touched.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- A **Configuration** button on every configured appliance in the settings page. It opens the name and the "Shown in HomeKit" options directly, without running discovery again.
|
|
12
|
+
|
|
13
|
+
### بالعربية
|
|
14
|
+
- زر **الإعدادات** على كل جهاز في قائمة الأجهزة المضافة، يفتح الاسم وخيارات «ما يظهر في HomeKit» مباشرة دون إعادة الاكتشاف.
|
|
15
|
+
- يظهر اسم الجهاز كما تكتبه في الإعدادات تمامًا، وأُلغيت اللاحقة Local التلقائية. الأجهزة الحالية تأخذ الاسم الجديد عند إعادة التشغيل، ويبقى أي اسم غيّرته من تطبيق Home كما هو.
|
|
16
|
+
|
|
17
|
+
## 1.0.1 — 2026-11-22
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- The polling interval can be set as low as 2 seconds (was 5), for appliances that send no push updates. On the `ARTIK051_PRAC_20K` tested, changes made with the remote showed up only at the polling interval.
|
|
21
|
+
- The log says, two minutes after connecting, whether push updates are arriving from the appliance.
|
|
22
|
+
|
|
23
|
+
### بالعربية
|
|
24
|
+
- فترة القراءة الدورية تقبل حتى ثانيتين (كانت 5)، للأجهزة التي لا ترسل تحديثات فورية. على المكيف المجرَّب ظهرت تغييرات الريموت بعد فترة القراءة الدورية.
|
|
25
|
+
- يذكر السجل بعد دقيقتين من الاتصال هل تصل التحديثات الفورية من الجهاز.
|
|
26
|
+
|
|
5
27
|
## 1.0.0 — 2026-11-22
|
|
6
28
|
|
|
7
29
|
First regular release. Includes the first fixes from a real installation (Homebridge in Docker on a Raspberry Pi). Discovery, live readings and control now run on a real `ARTIK051_PRAC_20K` air conditioner.
|
|
@@ -16,6 +38,20 @@ First regular release. Includes the first fixes from a real installation (Homebr
|
|
|
16
38
|
- Fan slider: 0 % now selects Auto (and shows Auto as 0 %), matching homebridge-smartthings-oauth. It still never powers the unit off.
|
|
17
39
|
- Discovery may take up to three minutes before giving up (was 90 seconds).
|
|
18
40
|
|
|
41
|
+
### بالعربية
|
|
42
|
+
- أول إصدار فعلي. يعمل الاكتشاف والقراءة والتحكم على مكيف `ARTIK051_PRAC_20K` حقيقي.
|
|
43
|
+
- سحب شريط المروحة إلى 0% يختار الوضع التلقائي، ويبقى المكيف يعمل.
|
|
44
|
+
- زر SAVE يعمل من أول تثبيت، فيظهر خيار الجسر الفرعي.
|
|
45
|
+
- عند فشل الاكتشاف تظهر تفاصيل تقنية: المنافذ التي جُرّبت ورد الجهاز.
|
|
46
|
+
- مهلة الاكتشاف صارت حتى ثلاث دقائق.
|
|
47
|
+
|
|
48
|
+
## 0.1.0-beta.3 — 2026-11-22
|
|
49
|
+
|
|
50
|
+
Pre-release of the changes that became 1.0.0: fan slider zero selects Auto, SAVE works on a fresh install, technical details on a failed discovery.
|
|
51
|
+
|
|
52
|
+
### بالعربية
|
|
53
|
+
- نسخة تمهيدية للتغييرات التي صارت 1.0.0: شريط المروحة عند 0% يختار التلقائي، وإصلاح زر SAVE، وتفاصيل تقنية عند فشل الاكتشاف.
|
|
54
|
+
|
|
19
55
|
## 0.1.0-beta.2 — 2026-11-22
|
|
20
56
|
|
|
21
57
|
No functional change. Still not run against real hardware.
|
|
@@ -25,6 +61,9 @@ No functional change. Still not run against real hardware.
|
|
|
25
61
|
- Supported Node.js stated as 22.12+ and 24 (the versions tested in CI).
|
|
26
62
|
- Install instructions corrected.
|
|
27
63
|
|
|
64
|
+
### بالعربية
|
|
65
|
+
- أول نسخة تُنشر على npm لتظهر في بحث Plugins داخل Homebridge. دون تغيير في الوظائف.
|
|
66
|
+
|
|
28
67
|
## 0.1.0-beta.1 — 2026-11-22
|
|
29
68
|
|
|
30
69
|
First trial release. Not yet run against real hardware.
|
|
@@ -42,3 +81,6 @@ First trial release. Not yet run against real hardware.
|
|
|
42
81
|
- Samsung TVs, TCP 8888 appliances and appliances that refuse the automatic certificate are not supported.
|
|
43
82
|
- No brightness for the display light. No voltage, current or occupancy readings.
|
|
44
83
|
- 32-bit systems are not supported.
|
|
84
|
+
|
|
85
|
+
### بالعربية
|
|
86
|
+
- أول نسخة تجريبية: اتصال محلي بأجهزة Samsung، صفحة إعدادات بالعربية والإنجليزية، ودعم المكيفات في HomeKit.
|
package/README.ar.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[English](README.md)
|
|
13
13
|
|
|
14
|
-
> **الحالة: 1.0.
|
|
14
|
+
> **الحالة: 1.0.2.** تعمل على مكيف حقيقي واحد (`ARTIK051_PRAC_20K`، و Homebridge داخل Docker على Raspberry Pi). بقية الموديلات وأنواع الأجهزة لم تتأكد بعد. راجع [ما تم اختباره](#ما-تم-اختباره).
|
|
15
15
|
> مشروع غير رسمي، وليس تابعًا لشركة Samsung أو معتمدًا منها. ليس إضافة Homebridge Verified.
|
|
16
16
|
|
|
17
17
|
## ما الذي يقدمه
|
|
@@ -85,7 +85,7 @@ npm install --save homebridge-samsung-local
|
|
|
85
85
|
4. اضغط **أضف إلى الإعدادات**.
|
|
86
86
|
5. من بطاقة الإضافة افتح **⋮ ← إعدادات الجسر** وفعّل **الجسر الفرعي**. أعد التشغيل، ثم امسح رمز QR الخاص بالجسر الفرعي من تطبيق Home.
|
|
87
87
|
|
|
88
|
-
تشغيل الإضافة كجسر فرعي يمنحها اقترانًا مستقلًا برمز QR خاص وملفات كاش خاصة. تُسمّى الأجهزة
|
|
88
|
+
تشغيل الإضافة كجسر فرعي يمنحها اقترانًا مستقلًا برمز QR خاص وملفات كاش خاصة. تُسمّى الأجهزة كما تكتبها تمامًا، فاختر أسماء تختلف عن أسماء أجهزة الإضافة الحالية. ظهور الجهاز نفسه مرتين (مرة من كل جسر) أثناء التجربة أمر متوقع.
|
|
89
89
|
|
|
90
90
|
يُفضَّل تثبيت عنوان كل جهاز من الراوتر. إذا تغيّر العنوان فأدخل الجديد واضغط **اختبار واكتشاف**: يُحدَّث الإدخال الموجود نفسه.
|
|
91
91
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ No SmartThings API subscription, no Home Assistant, no HACS, no MQTT.
|
|
|
9
9
|
|
|
10
10
|
[العربية](README.ar.md)
|
|
11
11
|
|
|
12
|
-
> **Status: 1.0.
|
|
12
|
+
> **Status: 1.0.2.** Running on one real air conditioner (`ARTIK051_PRAC_20K`, Homebridge in Docker on a Raspberry Pi). Other models and appliance types are unconfirmed. See [What has been tested](#what-has-been-tested).
|
|
13
13
|
> Unofficial project. Not affiliated with, endorsed by or supported by Samsung. Not a Homebridge Verified plugin.
|
|
14
14
|
|
|
15
15
|
## What it does
|
|
@@ -79,7 +79,7 @@ Then restart Homebridge.
|
|
|
79
79
|
4. Press **Add to configuration**.
|
|
80
80
|
5. On the plugin card open **⋮ → Bridge Settings** and enable the **child bridge**. Restart, then scan the child bridge's own QR code in the Home app.
|
|
81
81
|
|
|
82
|
-
Running as a child bridge gives this plugin its own HomeKit pairing, its own QR code and its own cache files. Accessories are named
|
|
82
|
+
Running as a child bridge gives this plugin its own HomeKit pairing, its own QR code and its own cache files. Accessories are named exactly as you type them, so pick names that differ from the ones your existing plugin uses. Seeing the same appliance twice (once per bridge) during a trial is expected.
|
|
83
83
|
|
|
84
84
|
A static DHCP lease for each appliance is recommended. If an address changes, enter the new one and press **Test & discover**: the existing entry is updated.
|
|
85
85
|
|
package/config.schema.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"name": {
|
|
31
31
|
"title": "Name (optional)",
|
|
32
32
|
"type": "string",
|
|
33
|
-
"description": "
|
|
33
|
+
"description": "Shown in HomeKit exactly as typed."
|
|
34
34
|
},
|
|
35
35
|
"id": {
|
|
36
36
|
"title": "Device ID (filled by discovery)",
|
|
@@ -165,9 +165,9 @@
|
|
|
165
165
|
"title": "Polling interval (seconds)",
|
|
166
166
|
"type": "integer",
|
|
167
167
|
"default": 15,
|
|
168
|
-
"minimum":
|
|
168
|
+
"minimum": 2,
|
|
169
169
|
"maximum": 300,
|
|
170
|
-
"description": "
|
|
170
|
+
"description": "How often the appliance is read when it sends no push update. Changes made with the remote show up within this time. Minimum 2; lower values load the appliance more."
|
|
171
171
|
},
|
|
172
172
|
"pushUpdates": {
|
|
173
173
|
"title": "Use push updates when the appliance supports them",
|
package/docs/MIGRATION.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Moving from homebridge-smartthings-oauth
|
|
2
2
|
|
|
3
|
-
Do this only after
|
|
3
|
+
Do this only after this plugin's accessories have worked reliably for you.
|
|
4
4
|
|
|
5
|
-
Apple Home treats
|
|
5
|
+
Apple Home treats this plugin's accessories as new devices. **Automations, scenes, rooms and favourites of the old accessories do not move automatically**, and no tool in this plugin claims to move them.
|
|
6
6
|
|
|
7
7
|
| Step | What to do |
|
|
8
8
|
|---|---|
|
|
9
|
-
| 1 | Keep both plugins running. Confirm each
|
|
10
|
-
| 2 | In the Home app, put each
|
|
11
|
-
| 3 | Edit every automation and scene: add the
|
|
12
|
-
| 4 |
|
|
9
|
+
| 1 | Keep both plugins running. Confirm each new accessory does everything you use |
|
|
10
|
+
| 2 | In the Home app, put each new accessory in the same room as the old one |
|
|
11
|
+
| 3 | Edit every automation and scene: add the new accessory, remove the old one. The Home app has no bulk replace |
|
|
12
|
+
| 4 | Give the accessory its final name in the plugin settings or in the Home app |
|
|
13
13
|
| 5 | In the old plugin, add the migrated appliance to its ignore list (or remove the plugin if nothing else uses it) |
|
|
14
14
|
| 6 | Keep TVs, washers and anything this plugin does not expose on the old plugin |
|
|
15
15
|
|
|
@@ -19,16 +19,16 @@ This plugin never changes or deletes the old plugin's configuration, tokens, cac
|
|
|
19
19
|
|
|
20
20
|
# الانتقال من homebridge-smartthings-oauth
|
|
21
21
|
|
|
22
|
-
نفّذ هذه الخطوات بعد أن تعمل
|
|
22
|
+
نفّذ هذه الخطوات بعد أن تعمل الأجهزة الجديدة عندك بثبات.
|
|
23
23
|
|
|
24
|
-
يعامل تطبيق Home
|
|
24
|
+
يعامل تطبيق Home الأجهزة الجديدة كأجهزة جديدة. **تبقى الأتمتة والمشاهد والغرف والمفضلة مرتبطة بالأجهزة القديمة، ويلزم نقلها يدويًا**؛ هذه الإضافة لا تنقلها تلقائيًا.
|
|
25
25
|
|
|
26
26
|
| الخطوة | المطلوب |
|
|
27
27
|
|---|---|
|
|
28
|
-
| 1 | أبقِ الإضافتين تعملان معًا، وتأكد أن كل
|
|
29
|
-
| 2 | ضع كل
|
|
30
|
-
| 3 | عدّل كل أتمتة ومشهد: أضف
|
|
31
|
-
| 4 |
|
|
28
|
+
| 1 | أبقِ الإضافتين تعملان معًا، وتأكد أن كل الجهاز الجديد يؤدي كل ما تستخدمه |
|
|
29
|
+
| 2 | ضع كل الجهاز الجديد في غرفة الجهاز القديم نفسها داخل تطبيق Home |
|
|
30
|
+
| 3 | عدّل كل أتمتة ومشهد: أضف الجهاز الجديد ثم احذف القديم. تطبيق Home لا يوفر استبدالًا جماعيًا |
|
|
31
|
+
| 4 | اكتب الاسم النهائي للجهاز في إعدادات الإضافة أو في تطبيق Home |
|
|
32
32
|
| 5 | في الإضافة القديمة أضف الجهاز المنقول إلى قائمة التجاهل، أو احذف الإضافة إذا لم يبق لها استخدام |
|
|
33
33
|
| 6 | أبقِ التلفزيونات والغسالة وكل ما لم تدعمه هذه الإضافة على الإضافة القديمة |
|
|
34
34
|
|
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
<h6 data-t="generalTitle"></h6>
|
|
46
46
|
<div class="sl-row">
|
|
47
47
|
<label class="mb-0" data-t="pollInterval"></label>
|
|
48
|
-
<input type="number" class="form-control" id="sl-poll" min="
|
|
48
|
+
<input type="number" class="form-control" id="sl-poll" min="2" max="300" style="max-width:110px" dir="ltr">
|
|
49
49
|
<label class="mb-0"><input type="checkbox" id="sl-push"> <span data-t="push"></span></label>
|
|
50
50
|
</div>
|
|
51
|
+
<div class="sl-muted mt-1" data-t="pollNote"></div>
|
|
51
52
|
</div>
|
|
52
53
|
|
|
53
54
|
<div class="sl-card sl-danger">
|
|
@@ -75,12 +76,12 @@
|
|
|
75
76
|
addHint: 'Enter the appliance IP address. Success means the appliance answered an authenticated read of its identity and resources.',
|
|
76
77
|
discovering: 'Connecting to the appliance… this can take up to two minutes.', techDetails: 'Technical details (safe to share)',
|
|
77
78
|
devicesTitle: 'Configured appliances', none: 'No appliances yet.',
|
|
78
|
-
generalTitle: 'General', pollInterval: 'Polling interval (s)', push: 'Use push updates',
|
|
79
|
+
generalTitle: 'General', pollInterval: 'Polling interval (s)', push: 'Use push updates', pollNote: 'Changes made with the remote appear within this time when the appliance sends no push update. Minimum 2 seconds; 5 or more is gentler on the appliance.',
|
|
79
80
|
kind: 'Type', model: 'Model', id: 'Stable ID', support: 'Support', source: 'Source',
|
|
80
81
|
sourceProbe: 'live probe', sourceRunning: 'reading from the running plugin', sourceSnapshot: 'last stored reading',
|
|
81
|
-
name: 'Name', namePh: 'e.g. Living Room AC', nameNote: '
|
|
82
|
+
name: 'Name', namePh: 'e.g. Living Room AC', nameNote: 'Shown in HomeKit exactly as typed.',
|
|
82
83
|
showInHome: 'Shown in HomeKit', add: 'Add to configuration', update: 'Update configuration',
|
|
83
|
-
saved: 'Saved. Restart the child bridge to apply.', remove: 'Remove', diagnostics: 'Diagnostics', changeIp: 'Change IP',
|
|
84
|
+
saved: 'Saved. Restart the child bridge to apply.', remove: 'Remove', diagnostics: 'Diagnostics', changeIp: 'Change IP', configure: 'Configuration',
|
|
84
85
|
online: 'connected', offline: 'not reachable', unknownState: 'not contacted yet',
|
|
85
86
|
thFeature: 'Function / reading', thDevice: 'Appliance', thPlugin: 'Plugin', thWhere: 'Shown in', thNote: 'Value / limits',
|
|
86
87
|
yes: 'yes', no: 'no', unconfirmed: 'reports 0', readOnly: 'read-only', control: 'control',
|
|
@@ -134,12 +135,12 @@
|
|
|
134
135
|
addHint: 'أدخل عنوان IP للجهاز. يُعدّ الاتصال ناجحًا عند قراءة هوية الجهاز وموارده فعليًا بعد المصادقة.',
|
|
135
136
|
discovering: 'جارٍ الاتصال بالجهاز… قد يستغرق حتى دقيقتين.', techDetails: 'تفاصيل تقنية (آمنة للمشاركة)',
|
|
136
137
|
devicesTitle: 'الأجهزة المضافة', none: 'لا توجد أجهزة بعد.',
|
|
137
|
-
generalTitle: 'عام', pollInterval: 'فترة القراءة الدورية (ثانية)', push: 'استخدام التحديثات الفورية',
|
|
138
|
+
generalTitle: 'عام', pollInterval: 'فترة القراءة الدورية (ثانية)', push: 'استخدام التحديثات الفورية', pollNote: 'التغييرات من الريموت تظهر خلال هذه المدة إذا لم يرسل الجهاز تحديثًا فوريًا. الحد الأدنى ثانيتان؛ 5 ثوانٍ فأكثر أخف على الجهاز.',
|
|
138
139
|
kind: 'النوع', model: 'الموديل', id: 'المعرّف الثابت', support: 'الدعم', source: 'المصدر',
|
|
139
140
|
sourceProbe: 'فحص مباشر', sourceRunning: 'قراءة من الإضافة العاملة', sourceSnapshot: 'آخر قراءة محفوظة',
|
|
140
|
-
name: 'الاسم', namePh: 'مثال: مكيف الصالة', nameNote: '
|
|
141
|
+
name: 'الاسم', namePh: 'مثال: مكيف الصالة', nameNote: 'يظهر في HomeKit كما تكتبه تمامًا.',
|
|
141
142
|
showInHome: 'ما يظهر في HomeKit', add: 'أضف إلى الإعدادات', update: 'حدّث الإعدادات',
|
|
142
|
-
saved: 'تم الحفظ. أعد تشغيل الجسر الفرعي للتطبيق.', remove: 'حذف', diagnostics: 'التشخيص', changeIp: 'تغيير العنوان',
|
|
143
|
+
saved: 'تم الحفظ. أعد تشغيل الجسر الفرعي للتطبيق.', remove: 'حذف', diagnostics: 'التشخيص', changeIp: 'تغيير العنوان', configure: 'الإعدادات',
|
|
143
144
|
online: 'متصل', offline: 'غير متاح', unknownState: 'لم يُتصل به بعد',
|
|
144
145
|
thFeature: 'الوظيفة أو القياس', thDevice: 'الجهاز', thPlugin: 'الإضافة', thWhere: 'مكان الظهور', thNote: 'القيمة والقيود',
|
|
145
146
|
yes: 'نعم', no: 'لا يدعم', unconfirmed: 'يُرجع صفرًا', readOnly: 'قراءة فقط', control: 'تحكم',
|
|
@@ -288,12 +289,27 @@
|
|
|
288
289
|
return `<tr><td><strong>${esc(dev.name || snap?.described?.model || '—')}</strong><div class="sl-muted" dir="ltr">${esc(dev.host)}</div><div class="sl-muted">${energy}</div></td>
|
|
289
290
|
<td>${state}</td>
|
|
290
291
|
<td><label class="mb-0"><input type="checkbox" data-en="${i}" ${dev.enabled === false ? '' : 'checked'}></label></td>
|
|
291
|
-
<td><button class="btn btn-sm btn-
|
|
292
|
+
<td><button class="btn btn-sm btn-primary" data-cfg="${i}">${t('configure')}</button>
|
|
293
|
+
<button class="btn btn-sm btn-outline-secondary" data-ip="${i}">${t('changeIp')}</button>
|
|
292
294
|
<button class="btn btn-sm btn-outline-secondary" data-diag="${i}" ${snap?.described ? '' : 'disabled'}>${t('diagnostics')}</button>
|
|
293
295
|
<button class="btn btn-sm btn-outline-danger" data-rm="${i}">${t('remove')}</button></td></tr>`;
|
|
294
296
|
}).join('')}</tbody></table></div>`;
|
|
295
297
|
box.querySelectorAll('[data-rm]').forEach((b) => b.addEventListener('click', async () => { config.devices.splice(Number(b.dataset.rm), 1); await save(); }));
|
|
296
298
|
box.querySelectorAll('[data-en]').forEach((b) => b.addEventListener('change', async () => { config.devices[Number(b.dataset.en)].enabled = b.checked; await save(); }));
|
|
299
|
+
box.querySelectorAll('[data-cfg]').forEach((b) => b.addEventListener('click', () => {
|
|
300
|
+
const dev = config.devices[Number(b.dataset.cfg)];
|
|
301
|
+
const snap = status.devices.find((x) => x.deviceId && x.deviceId === dev.id) || status.devices.find((x) => x.host === dev.host);
|
|
302
|
+
if (snap?.described) {
|
|
303
|
+
// Known appliance: open its options straight away, without a new discovery.
|
|
304
|
+
lastProbe = { ...snap, host: dev.host, deviceId: dev.id ?? snap.deviceId, source: 'snapshot' };
|
|
305
|
+
renderResult();
|
|
306
|
+
$('sl-result').scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
307
|
+
$('sl-name')?.focus({ preventScroll: true });
|
|
308
|
+
} else {
|
|
309
|
+
$('sl-host').value = dev.host;
|
|
310
|
+
$('sl-discover').click();
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
297
313
|
box.querySelectorAll('[data-ip]').forEach((b) => b.addEventListener('click', () => { $('sl-host').value = config.devices[Number(b.dataset.ip)].host; $('sl-host').focus(); }));
|
|
298
314
|
box.querySelectorAll('[data-diag]').forEach((b) => b.addEventListener('click', async () => {
|
|
299
315
|
try {
|
|
@@ -340,7 +356,7 @@
|
|
|
340
356
|
}
|
|
341
357
|
|
|
342
358
|
$('sl-lang').addEventListener('click', () => { lang = lang === 'ar' ? 'en' : 'ar'; localStorage.setItem('sl-lang', lang); render(); });
|
|
343
|
-
$('sl-poll').addEventListener('change', async (e) => { config.pollInterval = Math.min(300, Math.max(
|
|
359
|
+
$('sl-poll').addEventListener('change', async (e) => { config.pollInterval = Math.min(300, Math.max(2, Number(e.target.value) || 15)); await save(false); });
|
|
344
360
|
$('sl-push').addEventListener('change', async (e) => { config.pushUpdates = e.target.checked; await save(false); });
|
|
345
361
|
$('sl-discover').addEventListener('click', async () => {
|
|
346
362
|
const host = $('sl-host').value.trim();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-samsung-local",
|
|
3
3
|
"displayName": "Samsung Local",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "Local, cloud-free control of Samsung SmartThings-compatible appliances (air conditioners first) over your home network. No SmartThings API subscription, no Home Assistant.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
package/python/bridge.py
CHANGED
|
@@ -458,13 +458,14 @@ class DeviceWorker(threading.Thread):
|
|
|
458
458
|
super().__init__(daemon=True, name=f"device-{key}")
|
|
459
459
|
self.key, self.host, self.port = key, host, port
|
|
460
460
|
self.cred_dir, self.expected_di = cred_dir, expected_di
|
|
461
|
-
self.poll_interval = max(
|
|
461
|
+
self.poll_interval = max(2.0, float(poll_interval))
|
|
462
462
|
self.push = push
|
|
463
463
|
self._stop = threading.Event()
|
|
464
464
|
self._wake = threading.Event()
|
|
465
465
|
self._wake_at = None
|
|
466
466
|
self._link = None
|
|
467
467
|
self._link_lock = threading.Lock()
|
|
468
|
+
self.notifications = 0
|
|
468
469
|
|
|
469
470
|
# -- called from other threads -----------------------------------------
|
|
470
471
|
def stop(self):
|
|
@@ -487,6 +488,7 @@ class DeviceWorker(threading.Thread):
|
|
|
487
488
|
# -- worker ------------------------------------------------------------
|
|
488
489
|
def _on_notification(self, href, payload):
|
|
489
490
|
# Runs on the session's reader thread: never do I/O here.
|
|
491
|
+
self.notifications += 1
|
|
490
492
|
self.request_refresh(0.3)
|
|
491
493
|
|
|
492
494
|
def _sleep(self, seconds):
|
|
@@ -555,7 +557,7 @@ class DeviceWorker(threading.Thread):
|
|
|
555
557
|
continue
|
|
556
558
|
self._wake_at = None
|
|
557
559
|
resources, _mode = link.read_resources()
|
|
558
|
-
emit({"ev": "state", "key": self.key, "resources": resources})
|
|
560
|
+
emit({"ev": "state", "key": self.key, "resources": resources, "pushes": self.notifications})
|
|
559
561
|
next_poll = time.monotonic() + self.poll_interval
|
|
560
562
|
|
|
561
563
|
|
package/src/deviceLink.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { acCommand, buildAcModel, expectedAfter } from '../capabilities/ac.js';
|
|
2
|
-
import { NAME_SUFFIX } from '../settings.js';
|
|
3
2
|
import { eveCharacteristics } from './eve.js';
|
|
4
3
|
|
|
5
4
|
/** Which optional services appear by default. Each can be changed per device. */
|
|
@@ -301,6 +300,12 @@ export class AcAccessory {
|
|
|
301
300
|
const T = Characteristic.TargetHeatingCoolingState;
|
|
302
301
|
const service = this.#service('thermostat', Service.Thermostat, this.displayName, true);
|
|
303
302
|
service.setPrimaryService(true);
|
|
303
|
+
// Follow a name change made in the plugin settings, once. A name the
|
|
304
|
+
// user later gives the tile in the Home app is left alone.
|
|
305
|
+
if (this.context.appliedName !== this.displayName) {
|
|
306
|
+
service.setCharacteristic(Characteristic.ConfiguredName, this.displayName);
|
|
307
|
+
this.context.appliedName = this.displayName;
|
|
308
|
+
}
|
|
304
309
|
|
|
305
310
|
const valid = [T.OFF];
|
|
306
311
|
if (s.modes?.heat) {
|
|
@@ -575,7 +580,7 @@ export class AcAccessory {
|
|
|
575
580
|
}
|
|
576
581
|
}
|
|
577
582
|
|
|
583
|
+
/** The accessory is named exactly as the user typed it. */
|
|
578
584
|
export function accessoryName(name) {
|
|
579
|
-
|
|
580
|
-
return new RegExp(`\\b${NAME_SUFFIX}$`, 'i').test(base) ? base : `${base} ${NAME_SUFFIX}`;
|
|
585
|
+
return String(name || '').trim() || 'Samsung AC';
|
|
581
586
|
}
|
package/src/platform.js
CHANGED
|
@@ -180,6 +180,10 @@ export class SamsungLocalPlatform {
|
|
|
180
180
|
accessory = new this.api.platformAccessory(name, uuid, this.api.hap.Categories.AIR_CONDITIONER);
|
|
181
181
|
fresh = true;
|
|
182
182
|
}
|
|
183
|
+
if (!fresh && accessory.displayName !== name) {
|
|
184
|
+
accessory.updateDisplayName?.(name);
|
|
185
|
+
accessory.displayName = name;
|
|
186
|
+
}
|
|
183
187
|
accessory.context.deviceId = deviceId;
|
|
184
188
|
accessory.context.baseName = entry.name || accessory.context.baseName || model || null;
|
|
185
189
|
accessory.context.model = model ?? accessory.context.model ?? null;
|
|
@@ -193,7 +197,7 @@ export class SamsungLocalPlatform {
|
|
|
193
197
|
host: entry.host,
|
|
194
198
|
port: entry.port ?? null,
|
|
195
199
|
expectedDi: deviceId,
|
|
196
|
-
pollInterval: Number(this.config.pollInterval) || 15,
|
|
200
|
+
pollInterval: Math.max(2, Number(this.config.pollInterval) || 15),
|
|
197
201
|
push: this.config.pushUpdates !== false,
|
|
198
202
|
log: this.log,
|
|
199
203
|
});
|
|
@@ -203,6 +207,17 @@ export class SamsungLocalPlatform {
|
|
|
203
207
|
link.on('update', (resources) => {
|
|
204
208
|
writeJson(snapshotFile(this.paths, deviceId), this.#snapshot(entry, deviceId, { identity: link.identity, resources }, true));
|
|
205
209
|
});
|
|
210
|
+
// Say once whether the appliance delivers push updates, so a slow
|
|
211
|
+
// reaction to the remote can be explained from the log.
|
|
212
|
+
const pushCheck = setTimeout(() => {
|
|
213
|
+
if (link.online && this.config.pushUpdates !== false) {
|
|
214
|
+
this.log.info(link.pushes > 0
|
|
215
|
+
? `[${name}] push updates are arriving from the appliance.`
|
|
216
|
+
: `[${name}] no push updates received so far; changes made at the appliance show up at the polling interval (${link.pollInterval}s).`);
|
|
217
|
+
}
|
|
218
|
+
}, 120_000);
|
|
219
|
+
pushCheck.unref?.();
|
|
220
|
+
this.retryTimers.add(pushCheck);
|
|
206
221
|
link.on('availability', (online) => {
|
|
207
222
|
if (!online) {
|
|
208
223
|
writeJson(snapshotFile(this.paths, deviceId),
|
package/src/settings.js
CHANGED
|
@@ -6,5 +6,4 @@ export const PLATFORM_NAME = 'SamsungLocal';
|
|
|
6
6
|
export const STORAGE_DIR_NAME = 'samsung-local';
|
|
7
7
|
/** Namespace for accessory UUIDs. Never reuse another plugin's seed. */
|
|
8
8
|
export const UUID_NAMESPACE = 'homebridge-samsung-local:device:';
|
|
9
|
-
export const NAME_SUFFIX = 'Local';
|
|
10
9
|
export const MIN_PYTHON = [3, 11];
|