homebridge-intratone 0.4.0 → 0.4.1

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 CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to `homebridge-intratone`. Versions follow [semver](https://semver.org/).
4
4
 
5
+ ## [0.4.1] - 2026-11-12
6
+
7
+ ### Fixed
8
+
9
+ - The custom settings page showed only the Connection and door panels but not the normal form, so
10
+ the phone number could not be entered. The form is now rendered on the UI host's `ready` event
11
+ (with a timeout fallback) instead of synchronously, which dropped the message.
12
+
5
13
  ## [0.4.0] - 2026-11-11
6
14
 
7
15
  ### Added
@@ -128,6 +136,7 @@ two-way audio are out of scope.
128
136
  masked.
129
137
  - MIT license.
130
138
 
139
+ [0.4.1]: https://github.com/jtoucas-DIMO/Homebridge-Intratone/releases/tag/v0.4.1
131
140
  [0.4.0]: https://github.com/jtoucas-DIMO/Homebridge-Intratone/releases/tag/v0.4.0
132
141
  [0.3.0]: https://github.com/jtoucas-DIMO/Homebridge-Intratone/releases/tag/v0.3.0
133
142
  [0.2.2]: https://github.com/jtoucas-DIMO/Homebridge-Intratone/releases/tag/v0.2.2
@@ -1,12 +1,20 @@
1
1
  <!-- Custom settings page for homebridge-config-ui-x.
2
2
  Shows the live connection values and the detected doors (with inline rename) above the form.
3
- The standard form is always rendered first, so the page is never blank if a request fails. -->
3
+ The standard form (phone number, etc.) is shown via showSchemaForm() AFTER the UI host signals
4
+ 'ready' — posting it earlier drops the message and the form never appears. -->
4
5
  <div id="intratone-info" class="mb-3"></div>
5
6
  <div id="intratone-doors" class="mb-3"></div>
6
7
 
7
8
  <script>
8
- (async () => {
9
- // Base form first — if anything below throws, the normal settings still render.
9
+ let started = false;
10
+
11
+ async function init() {
12
+ if (started) {
13
+ return;
14
+ }
15
+ started = true;
16
+
17
+ // Render the standard schema form (country code, phone number, service, Advanced, …).
10
18
  try {
11
19
  homebridge.showSchemaForm();
12
20
  } catch (error) {
@@ -21,47 +29,60 @@
21
29
  const configs = await homebridge.getPluginConfig();
22
30
  block = configs[0] || { platform: 'Intratone', name: 'Intratone' };
23
31
  } catch (error) {
24
- return; // No config access: just leave the standard form.
32
+ return; // Leave the standard form; nothing else to add.
25
33
  }
26
34
 
27
- homebridge.showSpinner();
28
- const [status, accesses] = await Promise.allSettled([
29
- homebridge.request('/status', { config: block }),
30
- homebridge.request('/accesses', { config: block }),
31
- ]);
32
- homebridge.hideSpinner();
35
+ let status;
36
+ let accesses;
37
+ try {
38
+ homebridge.showSpinner();
39
+ [status, accesses] = await Promise.allSettled([
40
+ homebridge.request('/status', { config: block }),
41
+ homebridge.request('/accesses', { config: block }),
42
+ ]);
43
+ } finally {
44
+ homebridge.hideSpinner();
45
+ }
33
46
 
34
47
  renderInfo(info, status);
35
48
  renderDoors(doors, block, accesses);
36
- })();
49
+ }
50
+
51
+ // The form must be shown after the host is ready; a timeout covers the case where 'ready'
52
+ // already fired before this listener was attached.
53
+ homebridge.addEventListener('ready', init);
54
+ setTimeout(init, 1500);
37
55
 
38
56
  function note(parent, text) {
39
- parent.innerHTML = '<p class="help-block text-muted">' + text + '</p>';
57
+ const p = document.createElement('p');
58
+ p.className = 'help-block text-muted';
59
+ p.textContent = text;
60
+ parent.appendChild(p);
40
61
  }
41
62
 
42
63
  function renderInfo(container, settled) {
64
+ container.innerHTML = '';
43
65
  const title = document.createElement('h5');
44
66
  title.textContent = 'Connection';
45
67
  container.appendChild(title);
46
68
 
47
- if (settled.status !== 'fulfilled') {
48
- const reason = settled.reason && settled.reason.message ? settled.reason.message : 'not connected yet';
49
- const p = document.createElement('p');
50
- p.className = 'help-block text-muted';
51
- p.textContent = 'Not connected (' + reason + '). Fill in the phone number and save, then reopen.';
52
- container.appendChild(p);
69
+ if (!settled || settled.status !== 'fulfilled') {
70
+ const reason = settled && settled.reason && settled.reason.message ? settled.reason.message : 'not connected yet';
71
+ note(container, 'Not connected (' + reason + '). Set the phone number below, press Save, then reopen this screen.');
53
72
  return;
54
73
  }
55
74
  const s = settled.value;
75
+ const session = s.session || {};
76
+ const flags = s.flags || {};
56
77
  const rows = [
57
78
  ['Device ID', s.deviceId + (s.generatedDeviceId ? ' (generated)' : '')],
58
79
  ['App ID', s.appId],
59
80
  ['App version', s.appVersion],
60
81
  ['Client', s.identity],
61
- ['Session valid until', s.session && s.session.validUntil],
62
- ['Smartphone ID', s.session && s.session.smartphoneId],
63
- ['Mobipass key held here', s.flags ? (s.flags.mobipass ? 'yes' : 'no') : '?'],
64
- ['Mobipass account', s.flags ? (s.flags.mobipassCompatible ? 'yes' : 'no') : '?'],
82
+ ['Session valid until', session.validUntil],
83
+ ['Smartphone ID', session.smartphoneId],
84
+ ['Mobipass key held here', s.flags ? (flags.mobipass ? 'yes' : 'no') : '?'],
85
+ ['Mobipass account', s.flags ? (flags.mobipassCompatible ? 'yes' : 'no') : '?'],
65
86
  ['State file', s.stateFile],
66
87
  ];
67
88
  const dl = document.createElement('dl');
@@ -102,28 +123,23 @@
102
123
  }
103
124
 
104
125
  function renderDoors(container, block, settled) {
126
+ container.innerHTML = '';
105
127
  const title = document.createElement('h5');
106
128
  title.textContent = 'Your doors';
107
129
  container.appendChild(title);
108
130
 
109
- if (settled.status !== 'fulfilled') {
110
- const reason = settled.reason && settled.reason.message ? settled.reason.message : 'unavailable';
111
- const p = document.createElement('p');
112
- p.className = 'help-block text-muted';
113
- p.textContent = 'Could not list your doors (' + reason + '). You can still rename them by editing config.json (access_names); unnamed doors keep their detected names in the Home app.';
114
- container.appendChild(p);
131
+ if (!settled || settled.status !== 'fulfilled') {
132
+ const reason = settled && settled.reason && settled.reason.message ? settled.reason.message : 'unavailable';
133
+ note(container, 'Could not list your doors (' + reason + '). Set the phone number below and Save first. You can also rename doors in config.json (access_names); unnamed doors keep their detected names in the Home app.');
115
134
  return;
116
135
  }
117
136
 
118
137
  const list = (settled.value && settled.value.openable) || [];
119
138
  const map = overridesFromConfig(block);
120
139
 
121
- const hint = document.createElement('p');
122
- hint.className = 'help-block text-muted';
123
- hint.textContent = list.length
140
+ note(container, list.length
124
141
  ? 'Type a name to show it in the Home app. Leave blank to keep the detected name. Press Save below to apply.'
125
- : 'No openable doors detected yet. Once they appear, you can rename them here.';
126
- container.appendChild(hint);
142
+ : 'No openable doors detected yet. Once they appear, you can rename them here.');
127
143
 
128
144
  for (const door of list) {
129
145
  const group = document.createElement('div');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-intratone",
3
3
  "displayName": "Intratone",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "description": "Unofficial Homebridge plugin to open Intratone / Cogelec doors and gates from HomeKit and Matter (remote open, no doorbell).",
6
6
  "license": "MIT",
7
7
  "author": "jtoucas-DIMO",