homebridge-melcloud-control 3.0.7-beta.17 → 3.0.7-beta.19

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.
@@ -1,56 +1,10 @@
1
- <div>
2
- <img src="homebridge-melcloud-control.png" style="text-align: center;" height="150" />
1
+ <div style="text-align: center;">
2
+ </divstyle>
3
+ <img src="homebridge-melcloud-control.png" alt="Image" height="150" />
3
4
  </div>
4
- <div id="accounts">
5
- </div>
6
- <div id="melCloudAccount" style="display: none;" class="card card-body">
7
- <form id="configForm">
8
- <div class="text-center">
9
- <label id="accountName" style="font-size: 23px">Account</label><br>
10
- <label id="info" style="text-align: center; font-size: 17px;">MELCloud</label><br><br>
11
- </div>
12
- <div class="form-group">
13
- <label for="name">Name</label>
14
- <input id="name" type="text" class="form-control"><br>
15
- <label for="user">User Name</label>
16
- <input id="user" type="text" class="form-control"><br>
17
- <label for="passwd">Password</label>
18
- <input id="passwd" type="password" class="form-control"><br>
19
- <label for="language">Language</label>
20
- <select id="language" name="language" class="form-control"><br>
21
- <option value="0">English</option>
22
- <option value="1">Български</option>
23
- <option value="2">Čeština</option>
24
- <option value="3">Dansk</option>
25
- <option value="4">Deutsch</option>
26
- <option value="5">Eesti</option>
27
- <option value="6">Español</option>
28
- <option value="7">Français</option>
29
- <option value="8">Հայերեն</option>
30
- <option value="9">Latviešu</option>
31
- <option value="10">Lietuvių</option>
32
- <option value="11">Magyar</option>
33
- <option value="12">Nederlands</option>
34
- <option value="13">Norwegian</option>
35
- <option value="14">Polski</option>
36
- <option value="15">Português</option>
37
- <option value="16">Русский</option>
38
- <option value="17">Suomi</option>
39
- <option value="18">Svenska</option>
40
- <option value="19">Svenska</option>
41
- <option value="20">Українська</option>
42
- <option value="21">Türkçe</option>
43
- <option value="22">Ελληνικά</option>
44
- <option value="23">Hrvatski</option>
45
- <option value="24">Română</option>
46
- <option value="25">Slovenščina</option>
47
- </select>
48
- </div>
49
- <div class="text-center">
50
- <button id="logIn" type="button" class="btn btn-primary">Connect to MELCloud</button>
51
- <button id="configButton" type="button" class="btn btn-primary"><i class="fas fa-gear"></i></button>
52
- </div>
53
- </form>
5
+
6
+ <div id="melCloudTabs">
7
+ <!-- Tabs will be dynamically inserted here -->
54
8
  </div>
55
9
 
56
10
  <script>
@@ -69,13 +23,161 @@
69
23
  const accountsCount = pluginConfig[0].accounts.length;
70
24
  this.deviceIndex = 0;
71
25
  for (let i = 0; i < accountsCount; i++) {
72
- //create buttons
73
- const button = document.createElement("button");
74
- button.setAttribute("type", "button");
75
- button.setAttribute("id", `button${i}`);
76
- button.setAttribute("class", "btn btn-primary");
77
- button.innerText = pluginConfig[0].accounts[i].name;
78
- document.getElementById("accounts").appendChild(button);
26
+
27
+ // Array of languages for the dropdown
28
+ const languages = [
29
+ { value: "0", text: "English" },
30
+ { value: "1", text: "Български" },
31
+ { value: "2", text: "Čeština" },
32
+ { value: "3", text: "Dansk" },
33
+ { value: "4", text: "Deutsch" },
34
+ { value: "5", text: "Eesti" },
35
+ { value: "6", text: "Español" },
36
+ { value: "7", text: "Français" },
37
+ { value: "8", text: "Հայերեն" },
38
+ { value: "9", text: "Latviešu" },
39
+ { value: "10", text: "Lietuvių" },
40
+ { value: "11", text: "Magyar" },
41
+ { value: "12", text: "Nederlands" },
42
+ { value: "13", text: "Norwegian" },
43
+ { value: "14", text: "Polski" },
44
+ { value: "15", text: "Português" },
45
+ { value: "16", text: "Русский" },
46
+ { value: "17", text: "Suomi" },
47
+ { value: "18", text: "Svenska" },
48
+ { value: "19", text: "Svenska" },
49
+ { value: "20", text: "Українська" },
50
+ { value: "21", text: "Türkçe" },
51
+ { value: "22", text: "Ελληνικά" },
52
+ { value: "23", text: "Hrvatski" },
53
+ { value: "24", text: "Română" },
54
+ { value: "25", text: "Slovenščina" }
55
+ ];
56
+
57
+ // Get the melCloudTabs container
58
+ const melCloudTabs = document.getElementById('melCloudTabs');
59
+
60
+ // Loop through and create tabs for each account
61
+ for (let i = 0; i < accountsCount; i++) {
62
+ // Create the tab container
63
+ const melCloudAccount = document.createElement('div');
64
+ melCloudAccount.className = 'card card-body';
65
+ melCloudAccount.id = `melCloudAccount${i}`;
66
+
67
+ // Create the form
68
+ const form = document.createElement('form');
69
+ form.id = `configForm${i}`;
70
+
71
+ // Create the header section
72
+ const headerDiv = document.createElement('div');
73
+ headerDiv.className = 'text-center';
74
+
75
+ const accountName = document.createElement('label');
76
+ accountName.id = `accountName${i}`;
77
+ accountName.style.fontSize = '23px';
78
+ accountName.textContent = `Account ${i + 1}`;
79
+
80
+ const info = document.createElement('label');
81
+ info.id = `info${i}`;
82
+ info.style.fontSize = '17px';
83
+ info.textContent = 'MELCloud';
84
+
85
+ headerDiv.appendChild(accountName);
86
+ headerDiv.appendChild(info);
87
+ headerDiv.appendChild(document.createElement('br'));
88
+ headerDiv.appendChild(document.createElement('br'));
89
+
90
+ // Create the form group with inputs
91
+ const formGroup = document.createElement('div');
92
+ formGroup.className = 'form-group';
93
+
94
+ const nameLabel = document.createElement('label');
95
+ nameLabel.htmlFor = `name${i}`;
96
+ nameLabel.textContent = 'Name';
97
+
98
+ const nameInput = document.createElement('input');
99
+ nameInput.id = `name${i}`;
100
+ nameInput.type = 'text';
101
+ nameInput.className = 'form-control';
102
+
103
+ const userLabel = document.createElement('label');
104
+ userLabel.htmlFor = `user${i}`;
105
+ userLabel.textContent = 'User Name';
106
+
107
+ const userInput = document.createElement('input');
108
+ userInput.id = `user${i}`;
109
+ userInput.type = 'text';
110
+ userInput.className = 'form-control';
111
+
112
+ const passwdLabel = document.createElement('label');
113
+ passwdLabel.htmlFor = `passwd${i}`;
114
+ passwdLabel.textContent = 'Password';
115
+
116
+ const passwdInput = document.createElement('input');
117
+ passwdInput.id = `passwd${i}`;
118
+ passwdInput.type = 'password';
119
+ passwdInput.className = 'form-control';
120
+
121
+ const languageLabel = document.createElement('label');
122
+ languageLabel.htmlFor = `language${i}`;
123
+ languageLabel.textContent = 'Language';
124
+
125
+ const languageSelect = document.createElement('select');
126
+ languageSelect.id = `language${i}`;
127
+ languageSelect.name = 'language';
128
+ languageSelect.className = 'form-control';
129
+
130
+ // Populate the language dropdown
131
+ languages.forEach(lang => {
132
+ const option = document.createElement('option');
133
+ option.value = lang.value;
134
+ option.textContent = lang.text;
135
+ languageSelect.appendChild(option);
136
+ });
137
+
138
+ formGroup.appendChild(nameLabel);
139
+ formGroup.appendChild(nameInput);
140
+ formGroup.appendChild(document.createElement('br'));
141
+ formGroup.appendChild(userLabel);
142
+ formGroup.appendChild(userInput);
143
+ formGroup.appendChild(document.createElement('br'));
144
+ formGroup.appendChild(passwdLabel);
145
+ formGroup.appendChild(passwdInput);
146
+ formGroup.appendChild(document.createElement('br'));
147
+ formGroup.appendChild(languageLabel);
148
+ formGroup.appendChild(languageSelect);
149
+ formGroup.appendChild(document.createElement('br'));
150
+
151
+ // Create the buttons section
152
+ const buttonDiv = document.createElement('div');
153
+ buttonDiv.className = 'text-center';
154
+
155
+ const logInButton = document.createElement('button');
156
+ logInButton.id = `logIn${i}`;
157
+ logInButton.type = 'button';
158
+ logInButton.className = 'btn btn-primary';
159
+ logInButton.textContent = 'Connect to MELCloud';
160
+
161
+ const configButton = document.createElement('button');
162
+ configButton.id = `configButton${i}`;
163
+ configButton.type = 'button';
164
+ configButton.className = 'btn btn-primary';
165
+ configButton.innerHTML = '<i class="fas fa-gear"></i>';
166
+
167
+ buttonDiv.appendChild(logInButton);
168
+ buttonDiv.appendChild(configButton);
169
+
170
+ // Append sections to the form
171
+ form.appendChild(headerDiv);
172
+ form.appendChild(formGroup);
173
+ form.appendChild(buttonDiv);
174
+
175
+ // Append the form to the melCloudAccount div
176
+ melCloudAccount.appendChild(form);
177
+
178
+ // Append the melCloudAccount div to the main container
179
+ melCloudTabs.appendChild(melCloudAccount);
180
+ }
79
181
 
80
182
  //get actuall value on account select
81
183
  document.getElementById(`button${i}`).addEventListener('click', async () => {
@@ -190,7 +292,7 @@
190
292
  const pushTypeAta = ataDeviceIdExist ? false : ataDevices.push(deviceAta);
191
293
  const pushNewDevice = ataDeviceIdExist ? false : newDevices.ata.push(device);
192
294
  const devicesCount = newDevices.ata.length;
193
- textAta = `ATA: ${devicesCount},`
295
+ textAta = `ATA: ${devicesCount}`
194
296
  };
195
297
 
196
298
  //devices atw
@@ -220,7 +322,7 @@
220
322
  const pushTypeatw = atwDeviceIdExist ? false : atwDevices.push(deviceAtw);
221
323
  const pushNewDevice = atwDeviceIdExist ? false : newDevices.atw.push(device);
222
324
  const devicesCount = newDevices.ata.length;
223
- textAtw = `ATW: ${devicesCount},`
325
+ textAtw = `ATW: ${devicesCount}`
224
326
  };
225
327
 
226
328
  //devices erv
@@ -249,7 +351,7 @@
249
351
  });
250
352
 
251
353
  const newDevicesCount = newDevices.ata.length + newDevices.atw.length + newDevices.erv.length;
252
- document.getElementById('info').innerHTML = `Found devices: ${textAta}, ${textAtw}, ${textErv}. ${newDevicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
354
+ document.getElementById('info').innerHTML = `Found in MELCloud, ${textAta}, ${textAtw}, ${textErv}. ${newDevicesCount === 0 ? '' : 'Now You can start to configure it.'}`;
253
355
  document.getElementById('info').style.color = 'green';
254
356
 
255
357
  await homebridge.updatePluginConfig(pluginConfig);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "3.0.7-beta.17",
4
+ "version": "3.0.7-beta.19",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",