emhass 0.12.6__py3-none-any.whl → 0.12.8__py3-none-any.whl

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.
@@ -36,7 +36,7 @@
36
36
  4,
37
37
  0
38
38
  ],
39
- "weather_forecast_method": "scrapper",
39
+ "weather_forecast_method": "open-meteo",
40
40
  "load_forecast_method": "naive",
41
41
  "delta_forecast_daily": 1,
42
42
  "load_cost_forecast_method": "hp_hc_periods",
@@ -19,11 +19,11 @@
19
19
  //on page reload
20
20
  window.onload = async function () {
21
21
  ///fetch configuration parameters from definitions json file
22
- param_definitions = await getParamDefinitions();
22
+ let param_definitions = await getParamDefinitions();
23
23
  //obtain configuration from emhass (pull)
24
- config = await obtainConfig();
24
+ let config = await obtainConfig();
25
25
  //obtain configuration_list.html html as a template to dynamically to render parameters in a list view (parameters as input items)
26
- list_html = await getListHTML();
26
+ let list_html = await getListHTML();
27
27
  //load list parameter page (default)
28
28
  loadConfigurationListView(param_definitions, config, list_html);
29
29
 
@@ -70,14 +70,14 @@ async function obtainConfig() {
70
70
  const response = await fetch(`get-config`, {
71
71
  method: "GET",
72
72
  });
73
- response_status = await response.status; //return status
73
+ let response_status = response.status; //return status
74
74
  //if request failed
75
75
  if (response_status !== 200 && response_status !== 201) {
76
76
  showChangeStatus(response_status, await response.json());
77
77
  return {};
78
78
  }
79
79
  //else extract json rom data
80
- blob = await response.blob(); //get data blob
80
+ let blob = await response.blob(); //get data blob
81
81
  config = await new Response(blob).json(); //obtain json from blob
82
82
  showChangeStatus(response_status, {});
83
83
  return config;
@@ -90,13 +90,13 @@ async function ObtainDefaultConfig() {
90
90
  method: "GET",
91
91
  });
92
92
  //if request failed
93
- response_status = await response.status; //return status
93
+ let response_status = response.status; //return status
94
94
  if (response_status !== 200 && response_status !== 201) {
95
95
  showChangeStatus(response_status, await response.json());
96
96
  return {};
97
97
  }
98
98
  //else extract json rom data
99
- blob = await response.blob(); //get data blob
99
+ let blob = await response.blob(); //get data blob
100
100
  config = await new Response(blob).json(); //obtain json from blob
101
101
  showChangeStatus(response_status, {});
102
102
  return config;
@@ -109,9 +109,9 @@ async function getListHTML() {
109
109
  errorAlert("Unable to obtain configuration_list.html file");
110
110
  return {};
111
111
  }
112
- blob = await response.blob(); //get data blob
113
- htmlTemplateData = await new Response(blob).text(); //obtain html from blob
114
- return await htmlTemplateData;
112
+ let blob = await response.blob(); //get data blob
113
+ let htmlTemplateData = await new Response(blob).text(); //obtain html from blob
114
+ return htmlTemplateData;
115
115
  }
116
116
 
117
117
  //load list configuration view
@@ -121,13 +121,13 @@ function loadConfigurationListView(param_definitions, config, list_html) {
121
121
  }
122
122
 
123
123
  //list parameters used in the section headers
124
- header_input_list = ["set_use_battery", "set_use_pv", "number_of_deferrable_loads"];
124
+ let header_input_list = ["set_use_battery", "set_use_pv", "number_of_deferrable_loads"];
125
125
 
126
126
  //get the main container and append list template html
127
127
  document.getElementById("configuration-container").innerHTML = list_html;
128
128
 
129
129
  //loop though configuration sections ('Local','System','Tariff','Solar System (PV)') in definitions file
130
- for (var section in param_definitions) {
130
+ for (let section in param_definitions) {
131
131
  // build each section by adding parameters with their corresponding input elements
132
132
  buildParamContainers(
133
133
  section,
@@ -138,12 +138,12 @@ function loadConfigurationListView(param_definitions, config, list_html) {
138
138
 
139
139
  //after sections have been built, add event listeners for section header inputs
140
140
  //loop though headers
141
- for (header_input_param of header_input_list) {
141
+ for (let header_input_param of header_input_list) {
142
142
  if (param_definitions[section].hasOwnProperty(header_input_param)) {
143
143
  //grab default from definitions file
144
- value = param_definitions[section][header_input_param]["default_value"];
144
+ let value = param_definitions[section][header_input_param]["default_value"];
145
145
  //find input element (using the parameter name as the input element ID)
146
- header_input_element = document.getElementById(header_input_param);
146
+ let header_input_element = document.getElementById(header_input_param);
147
147
  if (header_input_element !== null) {
148
148
  //add event listener to element (trigger on input change)
149
149
  header_input_element.addEventListener("input", (e) =>
@@ -174,9 +174,9 @@ function buildParamContainers(
174
174
  header_input_list
175
175
  ) {
176
176
  //get the section container element
177
- SectionContainer = document.getElementById(section);
177
+ let SectionContainer = document.getElementById(section);
178
178
  //get the body container inside the section (where the parameters will be appended)
179
- SectionParamElement = SectionContainer.getElementsByClassName("section-body");
179
+ let SectionParamElement = SectionContainer.getElementsByClassName("section-body");
180
180
  if (SectionContainer == null || SectionParamElement.length == 0) {
181
181
  console.error("Unable to find Section container or Section Body");
182
182
  return 0;
@@ -217,7 +217,7 @@ function buildParamContainers(
217
217
  }
218
218
 
219
219
  //if parameter type == array.* and not in "Deferrable Loads" section, append plus and minus buttons in param div
220
- array_buttons = "";
220
+ let array_buttons = "";
221
221
  if (
222
222
  parameter_definition_object["input"].search("array.") > -1 &&
223
223
  section != "Deferrable Loads"
@@ -305,7 +305,7 @@ function buildParamContainers(
305
305
  }
306
306
 
307
307
  //obtain required param inputs, add event listeners
308
- requirement_inputs =
308
+ let requirement_inputs =
309
309
  requirement_element.getElementsByClassName("param_input");
310
310
  //grab required value
311
311
  const requirement_value = Object.values(
@@ -334,10 +334,11 @@ function buildParamElement(
334
334
  parameter_definition_name,
335
335
  config
336
336
  ) {
337
- var type = "";
338
- var inputs = "";
339
- var type_specific_html = "";
340
- var type_specific_html_end = "";
337
+ let type = "";
338
+ let inputs = "";
339
+ let type_specific_html = "";
340
+ let type_specific_html_end = "";
341
+ let placeholder = ""
341
342
 
342
343
  //switch statement to adjust generated html according to the parameter data type (definitions in definitions file)
343
344
  switch (parameter_definition_object["input"]) {
@@ -384,9 +385,8 @@ function buildParamElement(
384
385
 
385
386
  //check default values saved in param definitions
386
387
  //definitions default value is used if none is found in the configs, or an array element has been added in the ui (deferrable load number increase or plus button pressed)
387
- value = parameter_definition_object["default_value"];
388
388
  //check if a param value is saved in the config file (if so overwrite definition default)
389
- value = checkConfigParam(value, config, parameter_definition_name);
389
+ let value = checkConfigParam(placeholder, config, parameter_definition_name);
390
390
 
391
391
  //generate and return param input html,
392
392
  //check if param value is not an object, if so assume its a single value.
@@ -395,7 +395,7 @@ function buildParamElement(
395
395
  if (parameter_definition_object["input"] == "select") {
396
396
  let inputs = `<select class="param_input">`;
397
397
  for (const options of parameter_definition_object["select_options"]) {
398
- selected = ""
398
+ let selected = ""
399
399
  //if item in select is the same as the config value, then append "selected" tag
400
400
  if (options==value) {selected = `selected="selected"`}
401
401
  inputs += `<option ${selected}>${options}</option>`;
@@ -416,8 +416,8 @@ function buildParamElement(
416
416
  else {
417
417
  //for items such as load_peak_hour_periods (object of objects with arrays)
418
418
  if (typeof Object.values(value)[0] === "object") {
419
- for (param of Object.values(value)) {
420
- for (items of Object.values(param)) {
419
+ for (let param of Object.values(value)) {
420
+ for (let items of Object.values(param)) {
421
421
  inputs += `<input class="param_input" type="${type}" placeholder=${Object.values(items)[0]} value=${
422
422
  Object.values(items)[0]
423
423
  }>`;
@@ -429,7 +429,7 @@ function buildParamElement(
429
429
  // array of values
430
430
  else {
431
431
  let inputs = "";
432
- for (param of value) {
432
+ for (let param of value) {
433
433
  inputs += `
434
434
  ${type_specific_html}
435
435
  <input class="param_input" type="${type}" placeholder=${parameter_definition_object["default_value"]} value=${param}>
@@ -448,14 +448,14 @@ function plusElements(
448
448
  section,
449
449
  config
450
450
  ) {
451
- param_element = document.getElementById(parameter_definition_name);
451
+ let param_element = document.getElementById(parameter_definition_name);
452
452
  if (param_element == null) {
453
453
  console.log(
454
454
  "Unable to find " + parameter_definition_name + " param div container"
455
455
  );
456
456
  return 1;
457
457
  }
458
- param_input_container =
458
+ let param_input_container =
459
459
  param_element.getElementsByClassName("param-input")[0];
460
460
  // Add a copy of the param element
461
461
  param_input_container.innerHTML += buildParamElement(
@@ -467,14 +467,15 @@ function plusElements(
467
467
 
468
468
  //Remove param inputs in param div container (minimum 1)
469
469
  function minusElements(param) {
470
- param_element = document.getElementById(param);
470
+ let param_element = document.getElementById(param);
471
+ let param_input
471
472
  if (param_element == null) {
472
473
  console.log(
473
474
  "Unable to find " + parameter_definition_name + " param div container"
474
475
  );
475
476
  return 1;
476
477
  }
477
- param_input_list = param_element.getElementsByTagName("input");
478
+ let param_input_list = param_element.getElementsByTagName("input");
478
479
  if (param_input_list.length == 0) {
479
480
  console.log(
480
481
  "Unable to find " + parameter_definition_name + " param input/s"
@@ -493,7 +494,7 @@ function minusElements(param) {
493
494
  //if param is "load_peak_hour_periods", remove both start and end param inputs as well as the line brake tag separating the inputs
494
495
  if (param == "load_peak_hour_periods") {
495
496
  if (param_input_list.length > 2) {
496
- brs = document.getElementById(param).getElementsByTagName("br");
497
+ let brs = document.getElementById(param).getElementsByTagName("br");
497
498
  param_input_list[param_input_list.length - 1].remove();
498
499
  param_input_list[param_input_list.length - 1].remove();
499
500
  brs[brs.length - 1].remove();
@@ -511,6 +512,7 @@ function checkRequirements(
511
512
  param_element,
512
513
  requirement_value
513
514
  ) {
515
+ let requirement_element_value
514
516
  //get current value of required element
515
517
  if (requirement_element.type == "checkbox") {
516
518
  requirement_element_value = requirement_element.checked;
@@ -522,22 +524,22 @@ function checkRequirements(
522
524
  if (!param_element.classList.contains("requirement-disable")) {
523
525
  param_element.classList.add("requirement-disable");
524
526
  }
525
- } else {
526
- if (param_element.classList.contains("requirement-disable")) {
527
+ } else if (param_element.classList.contains("requirement-disable")) {
527
528
  param_element.classList.remove("requirement-disable");
528
- }
529
529
  }
530
530
  }
531
531
 
532
532
  //on header input change, execute accordingly
533
533
  function headerElement(element, param_definitions, config) {
534
534
  //obtain section body element
535
- section_card = element.closest(".section-card");
535
+ let section_card = element.closest(".section-card");
536
+ let param_list
537
+ let difference
536
538
  if (section_card == null) {
537
539
  console.log("Unable to obtain section-card");
538
540
  return 1;
539
541
  }
540
- param_container = section_card.getElementsByClassName("section-body");
542
+ let param_container = section_card.getElementsByClassName("section-body");
541
543
  if (param_container.length > 0) {
542
544
  param_container = section_card.getElementsByClassName("section-body")[0];
543
545
  } else {
@@ -621,12 +623,14 @@ function checkConfigParam(value, config, parameter_definition_name) {
621
623
  //send all parameter input values to EMHASS, to save to config.json and param.pkl
622
624
  async function saveConfiguration(param_definitions) {
623
625
  //start wth none
624
- config = {};
626
+ let config = {};
627
+ let param_inputs
628
+ let param_element
625
629
 
626
630
  //if section-cards (config sections/list) exists
627
- config_card = document.getElementsByClassName("section-card");
631
+ let config_card = document.getElementsByClassName("section-card");
628
632
  //check if page is in list or box view
629
- config_box_element = document.getElementById("config-box");
633
+ let config_box_element = document.getElementById("config-box");
630
634
 
631
635
  //if true, in list view
632
636
  if (Boolean(config_card.length)) {
@@ -636,7 +640,7 @@ async function saveConfiguration(param_definitions) {
636
640
  param_definitions
637
641
  )) {
638
642
  //loop through parameters
639
- for (var [
643
+ for (let [
640
644
  parameter_definition_name,
641
645
  parameter_definition_object,
642
646
  ] of Object.entries(section_object)) {
@@ -650,7 +654,6 @@ async function saveConfiguration(param_definitions) {
650
654
  parameter_definition_name +
651
655
  " param div container element, skipping this param"
652
656
  );
653
- continue;
654
657
  }
655
658
  //extract input/s and their value/s from param container div
656
659
  else {
@@ -662,7 +665,7 @@ async function saveConfiguration(param_definitions) {
662
665
  }
663
666
 
664
667
  // loop though param_inputs, extract the element/s values
665
- for (var input of param_inputs) {
668
+ for (let input of param_inputs) {
666
669
  switch (input.type) {
667
670
  case "number":
668
671
  param_values.push(parseFloat(input.value));
@@ -750,20 +753,20 @@ async function ToggleView(param_definitions, list_html, default_reset) {
750
753
  config = {};
751
754
 
752
755
  //find out if list or box view is active
753
- configuration_container = document.getElementById("configuration-container");
756
+ let configuration_container = document.getElementById("configuration-container");
754
757
  if (configuration_container == null) {
755
758
  errorAlert("Unable to find Configuration Container element");
756
759
  }
757
760
  //get yaml button
758
- yaml_button = document.getElementById("yaml");
761
+ let yaml_button = document.getElementById("yaml");
759
762
  if (yaml_button == null) {
760
763
  console.log("Unable to obtain yaml button");
761
764
  }
762
765
 
763
766
  // if section-cards (config sections/list) exists
764
- config_card = configuration_container.getElementsByClassName("section-card");
767
+ let config_card = configuration_container.getElementsByClassName("section-card");
765
768
  //selected view (0 = box)
766
- selected_view = Boolean(config_card.length);
769
+ let selected_view = Boolean(config_card.length);
767
770
 
768
771
  //if default_reset is passed do not switch views, instead reinitialize view with default config as values
769
772
  if (default_reset) {
@@ -801,7 +804,7 @@ async function ToggleView(param_definitions, list_html, default_reset) {
801
804
  //load box (json textarea) view
802
805
  async function loadConfigurationBoxPage(config) {
803
806
  //get configuration container element
804
- configuration_container = document.getElementById("configuration-container");
807
+ let configuration_container = document.getElementById("configuration-container");
805
808
  if (configuration_container == null) {
806
809
  errorAlert("Unable to find Configuration Container element");
807
810
  }
@@ -819,7 +822,7 @@ async function loadConfigurationBoxPage(config) {
819
822
 
820
823
  //function in control of status icons and alert box from a fetch request
821
824
  async function showChangeStatus(status, logJson) {
822
- var loading = document.getElementById("loader"); //element showing statuses
825
+ let loading = document.getElementById("loader"); //element showing statuses
823
826
  if (loading === null) {
824
827
  console.log("unable to find loader element");
825
828
  return 1;
@@ -860,7 +863,7 @@ async function errorAlert(text) {
860
863
  //convert yaml box into json box
861
864
  async function yamlToJson() {
862
865
  //get box element
863
- config_box_element = document.getElementById("config-box");
866
+ let config_box_element = document.getElementById("config-box");
864
867
  if (config_box_element == null) {
865
868
  errorAlert("Unable to obtain config box");
866
869
  } else {
@@ -871,10 +874,10 @@ async function yamlToJson() {
871
874
  },
872
875
  body: config_box_element.value,
873
876
  });
874
- response_status = await response.status; //return status
877
+ let response_status = response.status; //return status
875
878
  if (response_status == 201) {
876
879
  showChangeStatus(response_status, {});
877
- blob = await response.blob(); //get data blob
880
+ let blob = await response.blob(); //get data blob
878
881
  config = await new Response(blob).json(); //obtain json from blob
879
882
  config_box_element.value = JSON.stringify(config, null, 2);
880
883
  } else {
@@ -134,15 +134,15 @@
134
134
  },
135
135
  "weather_forecast_method": {
136
136
  "friendly_name": "Weather forecast method",
137
- "Description": "This will define the weather forecast method that will be used. options are 'scrapper' (ClearOutside), 'Solcast', 'solar.forecast' (forecast.solar) and 'csv' to load a CSV file. When loading a CSV file this will be directly considered as the PV power forecast in Watts.",
137
+ "Description": "This will define the weather forecast method that will be used. options are 'open-meteo', 'Solcast', 'solar.forecast' (forecast.solar) and 'csv' to load a CSV file. When loading a CSV file this will be directly considered as the PV power forecast in Watts.",
138
138
  "input": "select",
139
139
  "select_options": [
140
- "scrapper",
140
+ "open-meteo",
141
141
  "solcast",
142
142
  "solar.forecast",
143
143
  "csv"
144
144
  ],
145
- "default_value": "scrapper"
145
+ "default_value": "open-meteo"
146
146
  },
147
147
  "maximum_power_from_grid": {
148
148
  "friendly_name": "Max power from grid",
emhass/static/script.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  //on page reload get saved data
9
9
  window.onload = async function () {
10
- pageSelected = await loadBasicOrAdvanced();
10
+ await loadBasicOrAdvanced();
11
11
 
12
12
  //add listener for basic and advanced html switch
13
13
  document
@@ -58,7 +58,8 @@ function loadButtons(page) {
58
58
  async function loadBasicOrAdvanced(RequestedPage) {
59
59
  let basicFile = "basic.html";
60
60
  let advencedFile = "advanced.html";
61
- var formContainer = document.getElementById("TabSelection"); //container element to house basic or advanced data
61
+ let formContainer = document.getElementById("TabSelection"); //container element to house basic or advanced data
62
+ let htmlData
62
63
  //first check any function arg
63
64
  if (arguments.length == 1) {
64
65
  switch (RequestedPage) {
@@ -94,7 +95,7 @@ async function loadBasicOrAdvanced(RequestedPage) {
94
95
  localStorage.getItem("TabSelection") === "advanced"
95
96
  ) {
96
97
  //if advance
97
- htmlData = await getHTMLData(advencedFile);
98
+ let htmlData = await getHTMLData(advencedFile);
98
99
  formContainer.innerHTML = htmlData;
99
100
  loadButtons("advanced");
100
101
  getSavedData();
@@ -117,7 +118,7 @@ async function loadBasicOrAdvanced(RequestedPage) {
117
118
 
118
119
  //on button press, check current displayed page data and switch
119
120
  function SwitchBasicOrAdvanced() {
120
- var formContainerChildID =
121
+ let formContainerChildID =
121
122
  document.getElementById("TabSelection").firstElementChild.id;
122
123
  if (formContainerChildID === "basic") {
123
124
  loadBasicOrAdvanced("advanced");
@@ -129,18 +130,19 @@ function SwitchBasicOrAdvanced() {
129
130
  //get html data from basic.html or advanced.html
130
131
  async function getHTMLData(htmlFile) {
131
132
  const response = await fetch(`static/` + htmlFile);
132
- blob = await response.blob(); //get data blob
133
- htmlTemplateData = await new Response(blob).text(); //obtain html from blob
134
- return await htmlTemplateData;
133
+ let blob = await response.blob(); //get data blob
134
+ let htmlTemplateData = await new Response(blob).text(); //obtain html from blob
135
+ return htmlTemplateData;
135
136
  }
136
137
 
137
138
  //function pushing data via post, triggered by button action
138
139
  async function formAction(action, page) {
140
+ let data = {}
139
141
  if (page !== "basic") {
140
142
  //dont try to get input data in basic mode
141
- var data = inputToJson(page);
143
+ data = inputToJson();
142
144
  } else {
143
- var data = {};
145
+ data = {};
144
146
  } //send no data
145
147
 
146
148
  if (data !== 0) {
@@ -151,6 +153,7 @@ async function formAction(action, page) {
151
153
  method: "POST",
152
154
  headers: {
153
155
  "Content-Type": "application/json",
156
+ 'Transfer-Encoding': 'chunked'
154
157
  },
155
158
  body: JSON.stringify(data), //note that post can only send data via strings
156
159
  });
@@ -173,7 +176,7 @@ async function formAction(action, page) {
173
176
 
174
177
  //function in control of status icons of post above
175
178
  async function showChangeStatus(status, logJson) {
176
- var loading = document.getElementById("loader"); //element showing statuses
179
+ let loading = document.getElementById("loader"); //element showing statuses
177
180
  if (status === "remove") {
178
181
  //remove all
179
182
  loading.innerHTML = "";
@@ -204,16 +207,16 @@ async function showChangeStatus(status, logJson) {
204
207
  async function getTemplate() {
205
208
  //fetch data from webserver.py
206
209
  let htmlTemplateData = "";
207
- response = await fetch(`template`, {
210
+ let response = await fetch(`template`, {
208
211
  method: "GET",
209
212
  });
210
- blob = await response.blob(); //get data blob
213
+ let blob = await response.blob(); //get data blob
211
214
  htmlTemplateData = await new Response(blob).text(); //obtain html from blob
212
- templateDiv = document.getElementById("template"); //get template container element to override
215
+ let templateDiv = document.getElementById("template"); //get template container element to override
213
216
  templateDiv.innerHTML = htmlTemplateData; //override container inner html with new data
214
- var scripts = Array.from(templateDiv.getElementsByTagName("script")); //replace script tags manually
217
+ let scripts = Array.from(templateDiv.getElementsByTagName("script")); //replace script tags manually
215
218
  for (const script of scripts) {
216
- var TempScript = document.createElement("script");
219
+ let TempScript = document.createElement("script");
217
220
  TempScript.innerHTML = script.innerHTML;
218
221
  script.parentElement.appendChild(TempScript);
219
222
  }
@@ -228,7 +231,6 @@ function testStorage() {
228
231
  } catch (error) {
229
232
  return false;
230
233
  }
231
- return false;
232
234
  }
233
235
 
234
236
  //function gets saved data (if any)
@@ -237,7 +239,7 @@ function getSavedData() {
237
239
  if (testStorage()) {
238
240
  //if local storage exists and works
239
241
  let selectElement = document.getElementById("input-select"); // select button element
240
- var input_container = document.getElementById("input-container"); // container div containing all dynamic input elements (Box/List)
242
+ let input_container = document.getElementById("input-container"); // container div containing all dynamic input elements (Box/List)
241
243
  if (
242
244
  localStorage.getItem("input_container_content") &&
243
245
  localStorage.getItem("input_container_content") !== "{}"
@@ -251,12 +253,11 @@ function getSavedData() {
251
253
  }
252
254
  if (selectElement.value == "List") {
253
255
  //if List is selected, show saved json data into box
254
- storedJson = JSON.parse(
256
+ let storedJson = JSON.parse(
255
257
  localStorage.getItem("input_container_content")
256
258
  );
257
259
  if (Object.keys(storedJson).length > 0) {
258
260
  input_container.innerHTML = "";
259
- i = 1;
260
261
  for (const ikey in storedJson) {
261
262
  input_container.appendChild(
262
263
  createInputListDiv(ikey, JSON.stringify(storedJson[ikey]))
@@ -270,7 +271,7 @@ function getSavedData() {
270
271
 
271
272
  //using localStorage, store json data from input-list(List)/text-area(from input-box) elements for saved state save on page refresh (will save state on successful post)
272
273
  function saveStorage() {
273
- var data = JSON.stringify(inputToJson());
274
+ let data = JSON.stringify(inputToJson());
274
275
  if (testStorage() && data != "{}") {
275
276
  //don't bother saving if empty and/or storage don't exist
276
277
  localStorage.setItem("input_container_content", data);
@@ -279,12 +280,12 @@ function saveStorage() {
279
280
 
280
281
  //function gets values from input-list/text-area(from input-box) elements and return json dict object
281
282
  function inputToJson() {
282
- var input_container = document.getElementById("input-container"); //container
283
+ let input_container = document.getElementById("input-container"); //container
283
284
  let inputListArr = document.getElementsByClassName("input-list"); //list
284
285
  let inputTextArea = document.getElementById("text-area"); //box
285
286
  let input_container_child = null;
286
287
  input_container_child = input_container.firstElementChild; //work out which element is first inside container div
287
- var jsonReturnData = {};
288
+ let jsonReturnData = {};
288
289
 
289
290
  if (input_container_child == null) {
290
291
  //if no elements in container then return empty
@@ -300,7 +301,7 @@ function inputToJson() {
300
301
  let jsonTempData = "{";
301
302
  for (let i = 0; i < inputListArr.length; i++) {
302
303
  let key = inputListArr[i].getElementsByClassName("input-key")[0].value;
303
- var value =
304
+ let value =
304
305
  inputListArr[i].getElementsByClassName("input-value")[0].value;
305
306
  //curate a string with list elements to parse into json later
306
307
  if (key !== "") {
@@ -365,7 +366,7 @@ function createInputListDiv(ikey, ivalue) {
365
366
 
366
367
  //function assigned to control (add and remove) input (Box and List) elements
367
368
  function dictInputs(action) {
368
- var input_container = document.getElementById("input-container"); // container div containing all dynamic input elements
369
+ let input_container = document.getElementById("input-container"); // container div containing all dynamic input elements
369
370
  let selectElement = document.getElementById("input-select"); // select button
370
371
  let input_container_child = null;
371
372
  let input_container_child_name = null;
@@ -424,7 +425,7 @@ async function ClearInputData(id) {
424
425
  //clear input elements
425
426
  async function ClearInputElements() {
426
427
  let selectElement = document.getElementById("input-select");
427
- var input_container = document.getElementById("input-container");
428
+ let input_container = document.getElementById("input-container");
428
429
  if (selectElement.value == "Box") {
429
430
  document.getElementById("text-area").value = "{}";
430
431
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emhass
3
- Version: 0.12.6
3
+ Version: 0.12.8
4
4
  Summary: An Energy Management System for Home Assistant
5
5
  Project-URL: Homepage, https://github.com/davidusb-geek/emhass
6
6
  Author-email: David HERNANDEZ <davidusb@gmail.com>
@@ -11,7 +11,7 @@ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
14
- Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Topic :: Software Development :: Build Tools
16
16
  Requires-Python: <3.13,>=3.10
17
17
  Requires-Dist: beautifulsoup4>=4.12.3
@@ -78,16 +78,16 @@ Description-Content-Type: text/markdown
78
78
  <a hstyle="text-decoration:none" ref="https://github.com/davidusb-geek/emhass/actions/workflows/codeql.yml" >
79
79
  <img src="https://github.com/davidusb-geek/emhass/actions/workflows/codeql.yml/badge.svg?branch=master&event=schedule"/>
80
80
  </a>
81
- <a style="text-decoration:none" href=https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
81
+ <a style="text-decoration:none" href="https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
82
82
  <img alt="SonarQube security rating" src="https://sonarcloud.io/api/project_badges/measure?project=davidusb-geek_emhass&metric=security_rating">
83
83
  </a>
84
- <a style="text-decoration:none" href=https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
84
+ <a style="text-decoration:none" href="https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
85
85
  <img alt="SonarQube security Vulnerabilities" src="https://sonarcloud.io/api/project_badges/measure?project=davidusb-geek_emhass&metric=vulnerabilities">
86
86
  </a>
87
- <a style="text-decoration:none" href=https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
87
+ <a style="text-decoration:none" href="https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
88
88
  <img alt="SonarQube reliability" src="https://sonarcloud.io/api/project_badges/measure?project=davidusb-geek_emhass&metric=reliability_rating">
89
89
  </a>
90
- <a style="text-decoration:none" href=https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
90
+ <a style="text-decoration:none" href="https://sonarcloud.io/summary/new_code?id=davidusb-geek_emhass">
91
91
  <img alt="SonarQube bugs" src="https://sonarcloud.io/api/project_badges/measure?project=davidusb-geek_emhass&metric=bugs">
92
92
  </a>
93
93
 
@@ -182,7 +182,7 @@ For Home Assistant OS and HA Supervised users, A [EMHASS an add-on repository](h
182
182
 
183
183
  You can find the add-on with the installation instructions here: [https://github.com/davidusb-geek/emhass-add-on](https://github.com/davidusb-geek/emhass-add-on)
184
184
 
185
- These architectures are supported: `amd64`, `armv7`, `armhf` and `aarch64`.
185
+ These architectures are supported: `amd64` and `aarch64` (currently `armv7` and `armhf` are not supported).
186
186
 
187
187
  _Note: Both EMHASS via Docker and EMHASS-Add-on contain the same Docker image. The EMHASS-Add-on repository however, stores Home Assistant addon specific configuration information and maintains EMHASS image version control._
188
188
 
@@ -207,7 +207,7 @@ cd emhass
207
207
  # may need to set architecture tag (docker build --build-arg TARGETARCH=amd64 -t emhass-local .)
208
208
  docker build -t emhass-local .
209
209
  # run built Docker image, mounting config.json and secrets_emhass.yaml from host
210
- docker run --rm -it --restart always -p 5000:5000 --name emhass-container -v ./config.json:/share/config.json -v ./secrets_emhass.yaml:/app/secrets_emhass.yaml emhass-local
210
+ docker run --rm -it -p 5000:5000 --name emhass-container -v ./config.json:/share/config.json -v ./secrets_emhass.yaml:/app/secrets_emhass.yaml emhass-local
211
211
  ```
212
212
 
213
213
  Before running the docker container, make sure you have a designated folder for emhass on your host device and a `secrets_emhass.yaml` file. You can get a example of the secrets file from [`secrets_emhass(example).yaml`](https://github.com/davidusb-geek/emhass/blob/master/secrets_emhass(example).yaml) file on this repository.
@@ -234,7 +234,7 @@ docker run --rm -it --restart always -p 5000:5000 --name emhass-container -v ./
234
234
  ```bash
235
235
  #create data folder
236
236
  mkdir -p ~/emhass/data
237
- docker run -it --restart always -p 5000:5000 -e LOCAL_COSTFUN="profit" -v ~/emhass/config.json:/app/config.json -v ~/emhass/data:/app/data -v ~/emhass/secrets_emhass.yaml:/app/secrets_emhass.yaml --name DockerEMHASS <REPOSITORY:TAG>
237
+ docker run -it --restart always -p 5000:5000 -e LOCAL_COSTFUN="profit" -v ~/emhass/config.json:/app/config.json -v ~/emhass/data:/data -v ~/emhass/secrets_emhass.yaml:/app/secrets_emhass.yaml --name DockerEMHASS <REPOSITORY:TAG>
238
238
  ```
239
239
 
240
240
  - If you wish to set the web_server's homepage optimization diagrams to a timezone other than UTC, set `TZ` environment variable on docker run:
@@ -1,22 +1,22 @@
1
1
  emhass/data/associations.csv,sha256=IpEZIIWYdFjkRoC5xa1pRHjwnVs_VH8G8ogbGFxLfGI,3679
2
2
  emhass/data/cec_inverters.pbz2,sha256=P1JkVuAF1VKD8HmA9Y-Pvb45dv7E-bIwAVkGXDftZLQ,189425
3
3
  emhass/data/cec_modules.pbz2,sha256=h14aS6aC1x1NKsCeTctsVZdFgAl5WiBZFAdnFZR_vE4,1885712
4
- emhass/data/config_defaults.json,sha256=-mQHahDv6Z5wYgClOs4VVr5KVCP51olb3f2mEj3Beic,2777
4
+ emhass/data/config_defaults.json,sha256=8e0_UOQ1d0LBMT10V3xn90fENCImQFTCrVpKolvOt0s,2779
5
5
  emhass/static/advanced.html,sha256=gAhsd14elDwh1Ts4lf9wn_ZkczzzObq5qOimi_la3Ic,2067
6
6
  emhass/static/basic.html,sha256=ro2WwWgJyoUhqx_nJFzKCEG8FA8863vSHLmrjGYcEgs,677
7
7
  emhass/static/configuration_list.html,sha256=i4v83RVduWjdjkjPhA74e-j8NSUpFzqMGU3ixOaJLfI,1740
8
- emhass/static/configuration_script.js,sha256=CU6CuvnFrAWhnCns8K_AyX8fAdOJMrtR7wX7pXzpnK4,31525
9
- emhass/static/script.js,sha256=q3qTqc_pTLTK-0NPKurxFXcJ2vZLz4TctPfUgz09ygo,16291
8
+ emhass/static/configuration_script.js,sha256=Ek0Ry1Ae6ZGMl28mYxno6bPTwY4rK7AHcL58C6T6qUo,31727
9
+ emhass/static/script.js,sha256=-JYS8fHjchrMi1hYYKMd9p7vZvPcnYiY8NNuRC99fJM,16323
10
10
  emhass/static/style.css,sha256=a_8YlGubn1zoF5RTLJ_Qkrb8tAjUY9p7oAKxhCvJY2s,19288
11
- emhass/static/data/param_definitions.json,sha256=W-vq1Hj5_-YDpfl00cYF7kuLAQpfpsamjKGh7eU20LY,19485
11
+ emhass/static/data/param_definitions.json,sha256=EEsqSaBMJrDVsGtTPG4hBZwsCcbeqec1OdsnbhpAh5E,19476
12
12
  emhass/static/img/emhass_icon.png,sha256=Kyx6hXQ1huJLHAq2CaBfjYXR25H9j99PSWHI0lShkaQ,19030
13
13
  emhass/static/img/emhass_logo_short.svg,sha256=yzMcqtBRCV8rH84-MwnigZh45_f9Eoqwho9P8nCodJA,66736
14
14
  emhass/static/img/feather-sprite.svg,sha256=VHjMJQg88wXa9CaeYrKGhNtyK0xdd47zCqwSIa-hxo8,60319
15
15
  emhass/templates/configuration.html,sha256=M-_L__juYzcdGDaryGrz6LG2mguW2f1Sx6k01YfG7Dc,2885
16
16
  emhass/templates/index.html,sha256=1V44c0yyliu_z8inl0K-zmmmkhQumH3Bqk8Jj1YJPzY,3076
17
17
  emhass/templates/template.html,sha256=TkGgMecQEbFUZA4ymPwMUzNjKHsENvCgroUWbPt7G4Y,158
18
- emhass-0.12.6.dist-info/METADATA,sha256=7qiEFJVaebmeWqt7NtcxbkK2WJbwpsLzwgA1GunczKI,50991
19
- emhass-0.12.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- emhass-0.12.6.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
21
- emhass-0.12.6.dist-info/licenses/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
22
- emhass-0.12.6.dist-info/RECORD,,
18
+ emhass-0.12.8.dist-info/METADATA,sha256=p2Te7nMl1iydkEPI6EQp3-Bxb3tJrYvVOJqPJ2d9umM,51005
19
+ emhass-0.12.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ emhass-0.12.8.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
21
+ emhass-0.12.8.dist-info/licenses/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
22
+ emhass-0.12.8.dist-info/RECORD,,