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

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,10 +1,58 @@
1
- <div style="text-align: center;">
2
- </divstyle>
1
+ <div style="text-align: center;"></divstyle>
3
2
  <img src="homebridge-melcloud-control.png" alt="Image" height="150" />
4
3
  </div>
5
4
 
6
- <div id="melCloudTabs">
7
- <!-- Tabs will be dynamically inserted here -->
5
+ <div id="accounts">
6
+ </div>
7
+
8
+ <div id="melCloudAccount" style="display: none;" class="card card-body">
9
+ <form id="configForm">
10
+ <div class="text-center">
11
+ <label id="accountName" style="font-size: 23px">Account</label><br>
12
+ <label id="info" style="text-align: center; font-size: 17px;">MELCloud</label><br><br>
13
+ </div>
14
+ <div class="form-group">
15
+ <label for="name">Name</label>
16
+ <input id="name" type="text" class="form-control"><br>
17
+ <label for="user">User Name</label>
18
+ <input id="user" type="text" class="form-control"><br>
19
+ <label for="passwd">Password</label>
20
+ <input id="passwd" type="password" class="form-control"><br>
21
+ <label for="language">Language</label>
22
+ <select id="language" name="language" class="form-control"><br>
23
+ <option value="0">English</option>
24
+ <option value="1">Български</option>
25
+ <option value="2">Čeština</option>
26
+ <option value="3">Dansk</option>
27
+ <option value="4">Deutsch</option>
28
+ <option value="5">Eesti</option>
29
+ <option value="6">Español</option>
30
+ <option value="7">Français</option>
31
+ <option value="8">Հայերեն</option>
32
+ <option value="9">Latviešu</option>
33
+ <option value="10">Lietuvių</option>
34
+ <option value="11">Magyar</option>
35
+ <option value="12">Nederlands</option>
36
+ <option value="13">Norwegian</option>
37
+ <option value="14">Polski</option>
38
+ <option value="15">Português</option>
39
+ <option value="16">Русский</option>
40
+ <option value="17">Suomi</option>
41
+ <option value="18">Svenska</option>
42
+ <option value="19">Svenska</option>
43
+ <option value="20">Українська</option>
44
+ <option value="21">Türkçe</option>
45
+ <option value="22">Ελληνικά</option>
46
+ <option value="23">Hrvatski</option>
47
+ <option value="24">Română</option>
48
+ <option value="25">Slovenščina</option>
49
+ </select><br>
50
+ </div>
51
+ <div class="text-center">
52
+ <button id="logIn" type="button" class="btn btn-primary">Connect to MELCloud</button>
53
+ <button id="configButton" type="button" class="btn btn-primary"><i class="fas fa-gear"></i></button>
54
+ </div>
55
+ </form>
8
56
  </div>
9
57
 
10
58
  <script>
@@ -23,161 +71,13 @@
23
71
  const accountsCount = pluginConfig[0].accounts.length;
24
72
  this.deviceIndex = 0;
25
73
  for (let i = 0; i < accountsCount; i++) {
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
- }
74
+ //create buttons
75
+ const button = document.createElement("button");
76
+ button.setAttribute("type", "button");
77
+ button.setAttribute("id", `button${i}`);
78
+ button.setAttribute("class", "btn btn-primary");
79
+ button.innerText = pluginConfig[0].accounts[i].name;
80
+ document.getElementById("accounts").appendChild(button);
181
81
 
182
82
  //get actuall value on account select
183
83
  document.getElementById(`button${i}`).addEventListener('click', async () => {
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.19",
4
+ "version": "3.0.7-beta.20",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",