Skip to content

Commit

Permalink
Version 2.7.0
Browse files Browse the repository at this point in the history
Changes since 2.6.0

feat: Update HA auto discovery
feat: Add API support for managing settings #144 (@yorickpeterse thanks!!)
feat: Allow WebAPI settings index numbers using the web interface. A JSON array can be defined with index numbers. ie.: [0,5,7] to expose settings with indexes 0,5 and 7 on the WebAPI
feat: Support for Domoticz and non-Domoticz integrations at the same time
feat: Change MQTT settings to base topic config instead multiple topics
feat: update WebAPI to support getSettings and setSettings
feat: rework WebAPI for more information rich responses (currently only for getSettings and setSettings)
feat: update wifi config and web interface to use AP+STA mode, making it easier to see if a connection to a local wifi network was successful and which IP address was assigned
feat: update itho settings page to use localStorage as cache for settings. After full successful retrieval of all settings a consecutive page load will load all settings from the browser cache (if available and if stored uuid of the device is the same as current device uuid)
feat: add download option of itho settings JSON for backup purposes

fix: virtual remotes cannot be updated due to 'undefined' variable issue
fix: update espressif32 to 6.5.0
fix: update to ArduinoJson 7.0.1
fix: update to PureCSS 3.0.0
fix: move to JQuery 3.7.1 because ZeptoJS is not updated anymore
fix: improve hex input validation
fix: move websock send calls to 1 function for easier debugging
fix: improve error logging websocket
fix: update rf command logging to reflect terminology used in API
fix: littlefs now supports PlatformIO, no need for separate build script and repo clone anymore
fix: remove unnecessary references

Warning: possible breaking change!
If you have multiple add-ons, this update probably will break some MQTT integrations because MQTT topic settings heb been simplified and are reset to "itho" as base topic.
Check the MQTT base topic config of the add-on after the update.

Firmware binary (CVE HW rev.2 and NON-CVE):
https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0.bin
  • Loading branch information
arjenhiemstra committed Jan 16, 2024
1 parent 1224733 commit 4e42f3b
Show file tree
Hide file tree
Showing 19 changed files with 790 additions and 723 deletions.
16 changes: 8 additions & 8 deletions compiled_firmware_files/firmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/hardware_rev_1/nrgitho-hw1-v2.2.4.bin"
},
"2": {
"latest_fw": "2.6.0",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.6.0.bin",
"latest_beta_fw": "2.7.0-beta1",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0-beta1.bin"
"latest_fw": "2.7.0",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0.bin",
"latest_beta_fw": "2.7.0",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0.bin"
},
"NON-CVE 1": {
"latest_fw": "2.6.0",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.6.0.bin",
"latest_beta_fw": "2.7.0-beta1",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0-beta1.bin"
"latest_fw": "2.7.0",
"link": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0.bin",
"latest_beta_fw": "2.7.0",
"link_beta": "https://github.com/arjenhiemstra/ithowifi/raw/master/compiled_firmware_files/unified_hw2_noncve/nrgitho-v2.7.0.bin"
}
}
}
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions software/NRG_itho_wifi/build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ def sync_directories(source, target):
shutil.copytree(abs_subdir_source, abs_subdir_target, ignore=shutil.ignore_patterns('.*'))

def update_releaseinfo():
if release == "beta" or release == "stable":
if release == "beta" or release == "release":
print("\n### Updating releaseinfo for the " + release + " release\n")

latest_fw_key = "latest_fw" if release == "stable" else "latest_beta_fw"
latest_link_key = "link" if release == "stable" else "link_beta"
latest_fw_key = "latest_fw" if release == "release" else "latest_beta_fw"
latest_link_key = "link" if release == "release" else "link_beta"
latest_fw_file = "nrgitho" + hwrev + "-v" + fwversion + ".bin"

releasefile = os.path.join(PROJECT_COMPILED_DIR, "firmware.json")
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/IthoSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void getSetting(const uint8_t index, const bool updateState, const bool updatewe
return;
}

const struct ihtoDeviceType *settingsPtr = ithoDeviceptr;
//const struct ihtoDeviceType *settingsPtr = ithoDeviceptr;

JsonDocument doc;
JsonObject root = doc.to<JsonObject>();
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/IthoSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ uint8_t currentItho_fwversion();
uint16_t currentIthoSettingsLength();
int16_t currentIthoStatusLabelLength();
int getSettingsLength(const uint8_t deviceGroup, const uint8_t deviceID, const uint8_t version);
const char* getSettingLabel(const uint8_t index);
const char *getSettingLabel(const uint8_t index);
void getSetting(const uint8_t i, const bool updateState, const bool updateweb, const bool loop = false);
void processSettingResult(const uint8_t index, const bool loop);
int getStatusLabelLength(const uint8_t deviceGroup, const uint8_t deviceID, const uint8_t version);
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#pragma once

#define FWVERSION "2.7.0-beta2"
#define FWVERSION "2.7.0"
1,355 changes: 684 additions & 671 deletions software/NRG_itho_wifi/main/webroot/controls_js_gz.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/webroot/edit_html_gz.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

const unsigned char edit_html_gz[] = {
0x1f, 0x8b, 0x8, 0x0, 0xb8, 0x18, 0x9f, 0x65, 0x2, 0xff, 0xe5, 0x5d, 0x6b, 0x5b, 0xdb, 0x48, 0xb2, 0xfe, 0x3e, 0xbf, 0x42, 0x28, 0xbb, 0x83, 0xb4, 0xd8, 0x92, 0x4d, 0x2, 0x21, 0x6, 0x93, 0xe5, 0x1a, 0x8, 0xd7, 0x70, 0xd, 0xc9, 0xc9, 0xd9,
0x1f, 0x8b, 0x8, 0x0, 0x7c, 0x97, 0xa6, 0x65, 0x2, 0xff, 0xe5, 0x5d, 0x6b, 0x5b, 0xdb, 0x48, 0xb2, 0xfe, 0x3e, 0xbf, 0x42, 0x28, 0xbb, 0x83, 0xb4, 0xd8, 0x92, 0x4d, 0x2, 0x21, 0x6, 0x93, 0xe5, 0x1a, 0x8, 0xd7, 0x70, 0xd, 0xc9, 0xc9, 0xd9,
0x47, 0x96, 0xda, 0xb6, 0x40, 0x96, 0x14, 0xa9, 0x8d, 0x6d, 0x76, 0x73, 0x7e, 0xfb, 0xa9, 0xea, 0x96, 0xe4, 0xd6, 0xd5, 0x98, 0xc9, 0xec, 0xce, 0x9c, 0x93, 0xcc, 0x13, 0x84, 0xfa, 0x56, 0x5d, 0x5d, 0x5d, 0xf5, 0x56, 0x75, 0xb5, 0x66,
0x63, 0x61, 0xf7, 0x6c, 0xe7, 0xea, 0xee, 0x7c, 0x4f, 0xea, 0xd3, 0x81, 0xf3, 0x8b, 0x4, 0x7f, 0xce, 0xaf, 0xb7, 0x8f, 0xf, 0x77, 0x24, 0xb9, 0xae, 0xeb, 0xb7, 0xaf, 0x77, 0x74, 0x7d, 0xf7, 0x6a, 0x57, 0xfa, 0x7c, 0x70, 0x75, 0x72,
0x2c, 0x35, 0xb5, 0x86, 0x74, 0x15, 0x18, 0x6e, 0x68, 0x53, 0xdb, 0x73, 0xd, 0x47, 0xd7, 0xf7, 0x4e, 0x65, 0x49, 0xee, 0x53, 0xea, 0xb7, 0x74, 0x7d, 0x34, 0x1a, 0x69, 0xa3, 0xd7, 0x9a, 0x17, 0xf4, 0xf4, 0xab, 0xb, 0x7d, 0x8c, 0xfd,
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/webroot/favicon_png_gz.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

const unsigned char favicon_png_gz[] = {
0x1f, 0x8b, 0x8, 0x0, 0xb8, 0x18, 0x9f, 0x65, 0x2, 0xff, 0x1, 0x66, 0x9, 0x99, 0xf6, 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x20, 0x8, 0x6,
0x1f, 0x8b, 0x8, 0x0, 0x7c, 0x97, 0xa6, 0x65, 0x2, 0xff, 0x1, 0x66, 0x9, 0x99, 0xf6, 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x20, 0x8, 0x6,
0x0, 0x0, 0x0, 0x73, 0x7a, 0x7a, 0xf4, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xe, 0xc4, 0x0, 0x0, 0xe, 0xc4, 0x1, 0x95, 0x2b, 0xe, 0x1b, 0x0, 0x0, 0x9, 0x18, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0x9d,
0x97, 0x7b, 0x8c, 0x55, 0xd7, 0x75, 0x87, 0xbf, 0xb5, 0xcf, 0xb9, 0xe7, 0xbe, 0x66, 0xc6, 0xb7, 0x74, 0x5e, 0x19, 0x3f, 0x42, 0x46, 0x13, 0xec, 0xa2, 0xf8, 0x95, 0x46, 0x36, 0x6, 0x6c, 0x6, 0x8c, 0x61, 0x18, 0x83, 0x54, 0x48, 0x9a,
0x54, 0x6e, 0xdd, 0x34, 0xa9, 0x9c, 0xda, 0xea, 0xc3, 0xb5, 0x10, 0x42, 0x96, 0x8b, 0x90, 0x85, 0xa8, 0x85, 0x28, 0xb2, 0xa2, 0xa4, 0x71, 0x49, 0x42, 0x1d, 0xc7, 0x72, 0x12, 0x3b, 0x6a, 0xe2, 0xda, 0x63, 0x66, 0x8c, 0x4d, 0x61, 0x50,
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/webroot/index_html_gz.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

const unsigned char index_html_gz[] = {
0x1f, 0x8b, 0x8, 0x0, 0xb8, 0x18, 0x9f, 0x65, 0x2, 0xff, 0xad, 0x56, 0x6d, 0x6f, 0xd3, 0x30, 0x10, 0xfe, 0xde, 0x5f, 0x61, 0x82, 0x40, 0x20, 0x91, 0xb6, 0x4c, 0x9a, 0x40, 0x6b, 0x52, 0x9, 0xd, 0x4d, 0x4c, 0x2, 0x9, 0xc6, 0x60, 0x1f, 0x91,
0x1f, 0x8b, 0x8, 0x0, 0x7c, 0x97, 0xa6, 0x65, 0x2, 0xff, 0xad, 0x56, 0x6d, 0x6f, 0xd3, 0x30, 0x10, 0xfe, 0xde, 0x5f, 0x61, 0x82, 0x40, 0x20, 0x91, 0xb6, 0x4c, 0x9a, 0x40, 0x6b, 0x52, 0x9, 0xd, 0x4d, 0x4c, 0x2, 0x9, 0xc6, 0x60, 0x1f, 0x91,
0x1b, 0x5f, 0x9b, 0x1b, 0x8e, 0x9d, 0xd9, 0x97, 0xae, 0xf9, 0xf7, 0xd8, 0x49, 0xfa, 0x9e, 0x6c, 0x40, 0x96, 0x2f, 0xb1, 0x7d, 0x8f, 0xef, 0x39, 0x3f, 0x3e, 0xdb, 0x17, 0x3d, 0x13, 0x3a, 0xa1, 0x32, 0x7, 0x96, 0x52, 0x26, 0xa7, 0x83,
0xc8, 0xff, 0x98, 0xe4, 0x6a, 0x11, 0x7, 0xa0, 0x82, 0xe9, 0xc0, 0x8d, 0x0, 0x17, 0xd3, 0x1, 0x73, 0x5f, 0x94, 0x1, 0x71, 0x96, 0xa4, 0xdc, 0x58, 0xa0, 0x38, 0x28, 0x68, 0x1e, 0xbe, 0xf, 0x76, 0x4d, 0x8a, 0x67, 0x10, 0x7, 0x4b,
0x84, 0xfb, 0x5c, 0x1b, 0xa, 0x58, 0xa2, 0x15, 0x81, 0x72, 0xd0, 0x7b, 0x14, 0x94, 0xc6, 0x2, 0x96, 0x98, 0x40, 0x58, 0x75, 0xde, 0x30, 0x54, 0x48, 0xc8, 0x65, 0x68, 0x13, 0x2e, 0x21, 0x7e, 0x3b, 0x1c, 0xb7, 0xb8, 0x12, 0x60, 0x13,
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/webroot/jquery_min_js_gz.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

const unsigned char jquery_min_js_gz[] = {
0x1f, 0x8b, 0x8, 0x0, 0xb8, 0x18, 0x9f, 0x65, 0x2, 0xff, 0xbc, 0xbd, 0x79, 0x77, 0xdb, 0x46, 0xb2, 0x7, 0xfa, 0xff, 0xfb, 0x14, 0x22, 0xc6, 0xa3, 0x1, 0xcc, 0x26, 0x45, 0x3a, 0x93, 0xdc, 0x3b, 0xa0, 0x10, 0x1e, 0x47, 0xb6, 0x13, 0xcf, 0x24,
0x1f, 0x8b, 0x8, 0x0, 0x7c, 0x97, 0xa6, 0x65, 0x2, 0xff, 0xbc, 0xbd, 0x79, 0x77, 0xdb, 0x46, 0xb2, 0x7, 0xfa, 0xff, 0xfb, 0x14, 0x22, 0xc6, 0xa3, 0x1, 0xcc, 0x26, 0x45, 0x3a, 0x93, 0xdc, 0x3b, 0xa0, 0x10, 0x1e, 0x47, 0xb6, 0x13, 0xcf, 0x24,
0x71, 0x12, 0x3b, 0xdb, 0x50, 0x8c, 0xf, 0x4c, 0x36, 0x25, 0xc4, 0x10, 0xc0, 0x0, 0xa0, 0x96, 0x88, 0x9c, 0xcf, 0xfe, 0xea, 0x57, 0xbd, 0xa0, 0x1, 0x82, 0x72, 0x32, 0xe7, 0xbe, 0x97, 0x19, 0x8b, 0x58, 0x1a, 0xbd, 0x56, 0x57, 0xd7,
0x5e, 0x27, 0x8f, 0x7b, 0x47, 0xbf, 0x7e, 0xbb, 0x91, 0xc5, 0xdd, 0xd1, 0xf5, 0x47, 0xc3, 0xff, 0x19, 0x8e, 0x8f, 0xb6, 0x47, 0xfe, 0x22, 0x38, 0x7a, 0xb5, 0x96, 0xd9, 0x3f, 0x5f, 0x1f, 0xbd, 0xc8, 0x37, 0xd9, 0x32, 0xae, 0x92, 0x3c,
0x3b, 0x8a, 0xb3, 0xe5, 0x51, 0x5e, 0x5d, 0xca, 0xe2, 0x68, 0x91, 0x67, 0x55, 0x91, 0xbc, 0xdb, 0x54, 0x79, 0x51, 0x52, 0xf1, 0x5f, 0x7f, 0xc3, 0xe7, 0xc3, 0xbc, 0xb8, 0x38, 0x49, 0x93, 0x85, 0xcc, 0x4a, 0x79, 0xf4, 0xf8, 0xe4, 0xff,
Expand Down
2 changes: 1 addition & 1 deletion software/NRG_itho_wifi/main/webroot/pure_min_css_gz.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

const unsigned char pure_min_css_gz[] = {
0x1f, 0x8b, 0x8, 0x0, 0xb8, 0x18, 0x9f, 0x65, 0x2, 0xff, 0xed, 0x5d, 0x6d, 0x8f, 0xe3, 0x46, 0x72, 0xfe, 0xbe, 0xbf, 0x82, 0xe7, 0x85, 0x71, 0x3b, 0x86, 0xa8, 0x91, 0x28, 0x51, 0xd2, 0x48, 0x88, 0x71, 0x67, 0xc7, 0x9, 0x1c, 0x5c, 0x8c, 0x3,
0x1f, 0x8b, 0x8, 0x0, 0x7c, 0x97, 0xa6, 0x65, 0x2, 0xff, 0xed, 0x5d, 0x6d, 0x8f, 0xe3, 0x46, 0x72, 0xfe, 0xbe, 0xbf, 0x82, 0xe7, 0x85, 0x71, 0x3b, 0x86, 0xa8, 0x91, 0x28, 0x51, 0xd2, 0x48, 0x88, 0x71, 0x67, 0xc7, 0x9, 0x1c, 0x5c, 0x8c, 0x3,
0x7c, 0x5f, 0x2, 0x67, 0x11, 0x50, 0x62, 0x6b, 0xc4, 0x2c, 0x25, 0xa, 0x24, 0xb5, 0x3b, 0x6b, 0x45, 0xff, 0x3d, 0xfd, 0x4a, 0x76, 0x57, 0x55, 0x37, 0x35, 0xce, 0x39, 0x8b, 0x0, 0xb9, 0xc1, 0xfa, 0xd8, 0xdd, 0xc5, 0x7e, 0xab, 0xaa,
0xe7, 0xa9, 0x6e, 0xb2, 0xa9, 0xc7, 0x6f, 0xfe, 0xf0, 0xe6, 0xaf, 0x97, 0x9a, 0x45, 0x1f, 0x67, 0xe3, 0xc9, 0x78, 0xf2, 0xe6, 0xfb, 0xea, 0xfc, 0xb9, 0x2e, 0x9e, 0xf, 0x6d, 0x94, 0x4c, 0xa6, 0xb3, 0xe8, 0xdf, 0xb2, 0x43, 0x55, 0xfd,
0xe1, 0xcd, 0x5f, 0x8a, 0x1d, 0x3b, 0x35, 0x2c, 0x8f, 0x2e, 0xa7, 0x9c, 0xd5, 0x51, 0x7b, 0x60, 0xd1, 0x77, 0x3f, 0xff, 0x63, 0xa4, 0xb3, 0xc7, 0x6f, 0xe, 0x6d, 0x7b, 0x6e, 0xd6, 0x8f, 0x8f, 0xcf, 0x45, 0x7b, 0xb8, 0x6c, 0xc7, 0xbb,
Expand Down
104 changes: 76 additions & 28 deletions software/NRG_itho_wifi/main/webroot_source/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var sensor = -1;
var uuid = 0;

localStorage.setItem("statustimer", 0);
localStorage.setItem("wifistat", 0);
var settingIndex = -1;

var websocketServerLocation = location.protocol.indexOf("https") > -1 ? 'wss://' + window.location.hostname + ':8000/ws' : 'ws://' + window.location.hostname + ':8000/ws';
Expand Down Expand Up @@ -67,7 +68,7 @@ function processMessage(message) {
} catch (error) {
f = JSON.parse(message);
}
console.log(f);
//console.log(f);
let g = document.body;
if (f.wifisettings) {
let x = f.wifisettings;
Expand Down Expand Up @@ -432,6 +433,16 @@ $(document).ready(function () {
}
//syssubmit
else if ($(this).attr('id') == 'syssumbit') {
if(!isValidJsonArray($('#api_settings_activated').val())) {
alert("error: Activated settings input value is not a valid JSON array!");
return;
}
else {
if(!areAllUnsignedIntegers(JSON.parse($('#api_settings_activated').val()))) {
alert("error: Activated settings array contains non integer values!");
return;
}
}
websock_send(JSON.stringify({
systemsettings: {
sys_username: $('#sys_username').val(),
Expand All @@ -441,6 +452,7 @@ $(document).ready(function () {
syssec_edit: $('input[name=\'option-syssec_edit\']:checked').val(),
api_normalize: $('input[name=\'option-api_normalize\']:checked').val(),
api_settings: $('input[name=\'option-api_settings\']:checked').val(),
api_settings_activated: JSON.parse($('#api_settings_activated').val()),
syssht30: $('input[name=\'option-syssht30\']:checked').val(),
itho_rf_support: $('input[name=\'option-itho_rf_support\']:checked').val(),
itho_fallback: $('#itho_fallback').val(),
Expand Down Expand Up @@ -678,6 +690,16 @@ $(document).ready(function () {
ithotimestamp: $('#itho_ce30_timestamp').val()
}));
}
else if ($(this).attr('id') == 'button4030') {
websock.send(JSON.stringify({
ithobutton: 4030,
idx: Number($('#itho_4030_index').val()),
dt: Number($('#itho_4030_datatype').val()),
val: Number($('#itho_4030_value').val()),
chk: Number($('#itho_4030_checked').val()),
dryrun: ($('#itho_4030_password').val() == 'thisisunsafe') ? false : true,
}));
}
else if ($(this).attr('id') == 'ithogetsettings') {
if (localStorage.getItem("ihto_settings_complete") == "true" && localStorage.getItem("uuid") == uuid) {
loadSettingsLocStor();
Expand Down Expand Up @@ -805,6 +827,9 @@ function removeID(id) {
function processElements(x) {
for (var key in x) {
if (x.hasOwnProperty(key)) {
if(Array.isArray(x[key])) {
x[key] = JSON.stringify(x[key]);
}
var el = $(`#${key}`);
if (el.is('input') || el.is('select')) {
$(`#${key}`).val(x[key]);
Expand Down Expand Up @@ -992,6 +1017,9 @@ function update_page(page) {
if (page != 'status') {
localStorage.setItem("statustimer", 0);
}
if (page != 'wifisetup') {
localStorage.setItem("wifistat", 0);
}
$('#main').empty();
$('#main').css('max-width', '768px')
if (page == 'index') { $('#main').append(html_index); }
Expand Down Expand Up @@ -1070,6 +1098,23 @@ function isHex(hex) {
&& !isNaN(Number('0x' + hex))
}

function isUnsignedInteger(value) {
return Number.isInteger(value) && value >= 0;
}

function areAllUnsignedIntegers(array) {
return array.every(isUnsignedInteger);
}

function isValidJsonArray(input) {
try {
const parsed = JSON.parse(input);
return Array.isArray(parsed);
} catch (e) {
return false;
}
}

function returnMqttState(state) {
state = state + 5;
var states = ["Disabled", "Connection Timeout", "Connection Lost", "Connection Failed", "Disconnected", "Connected", "MQTT version unsupported", "Client ID rejected", "Server Unavailable", "Bad Credentials", "Client Unauthorized"];
Expand Down Expand Up @@ -1799,24 +1844,6 @@ Unless specified otherwise:<br>
<td colspan="6">Comments:<br><em>Return type present on MQTT "Remotes info topic", see for more info the
comments on remotesinfo of the Web API</em></td>
</tr>
<tr>
<td>getsetting</td>
<td>string</td>
<td>0-256</td>
<td>number</td>
<td style="text-align:center">◌</td>
<td style="text-align:center">●</td>
</tr>
<tr>
<td colspan="6">
Comments:<br>
<em>
Returns a JSON object containing the result of the API call. If successful it contains a data object with the current, minimum and
maximum value of the given setting, using its index. If the
setting index is invalid, the data object contains a key failreason.
</em>
</td>
</tr>
<tr>
<td colspan="6"><b>Commands below this line work on itho devices that support the PWM2IC2 protocol. Devices
supported are at least the HRU200 and all CVE models. Devices known not to support these commands
Expand Down Expand Up @@ -1939,6 +1966,25 @@ Unless specified otherwise:<br>
remote if more than 1 RF remote is configured. The index can be found on the "RF devices"
page.</em></td>
</tr>
<tr>
<td>getsetting</td>
<td>string</td>
<td>0-255</td>
<td>number</td>
<td style="text-align:center">◌</td>
<td style="text-align:center">●</td>
</tr>
<tr>
<td colspan="6">
Comments:<br>
<em>
Returns a JSON object containing the result of the API call. If successful it contains a data object
with the current, minimum and
maximum value of the given setting, using its index. If the
setting index is invalid, the data object contains a key failreason.
</em>
</td>
</tr>
<tr>
<td colspan="6"><b style="color: red">API Commands below this line can change the settings of your Itho
Daalderop
Expand All @@ -1950,7 +1996,7 @@ Unless specified otherwise:<br>
<tr>
<td>setsetting</td>
<td>string</td>
<td>0-256</td>
<td>0-255</td>
<td>number</td>
<td style="text-align:center">◌</td>
<td style="text-align:center">●</td>
Expand All @@ -1970,7 +2016,8 @@ Unless specified otherwise:<br>
Sets the current value of a setting using its index. The
value must be specified in the "value" parameter. The new
value must be within the minimum and maximum of the setting.<br>
Returns a JSON object containing the result of the API call. If successful it contains a data object with the current, previous, minimum and
Returns a JSON object containing the result of the API call. If successful it contains a data object
with the current, previous, minimum and
maximum value of the given setting, using its index. If the
setting index or value is invalid, the data object contains a key failreason.
</em>
Expand Down Expand Up @@ -2230,9 +2277,6 @@ var html_wifisetup = `
repeat_wifistat();
});
$(document).ready(function () {
});
</script>
`;

Expand Down Expand Up @@ -2431,12 +2475,16 @@ var html_systemsettings_start = `
<input id="option-api_normalize-1" type="radio" name="option-api_normalize" value="1"> on
<input id="option-api_normalize-0" type="radio" name="option-api_normalize" value="0"> off
</div>
<p>Enable the WebAPI for managing your device's settings.</p>
<p>Enable the WebAPI for updating your device's settings.</p>
<div class="pure-control-group">
<label for="option-api_settings" class="pure-radio">Enable settings API</label>
<label for="option-api_settings" class="pure-radio">Enable update settings API</label>
<input id="option-api_settings-1" type="radio" name="option-api_settings" value="1"> on
<input id="option-api_settings-0" type="radio" name="option-api_settings" value="0"> off
</div>
<div class="pure-control-group">
<label for="api_settings_activated">Activate settings indexes</label>
<input id="api_settings_activated" title="Must be a valid JSON array ie.: [12,34]" type="text" maxlength="1024" size="20">
</div>
<p>
<b style="color: red">Warning:</b>
using this part of the API incorrectly may result in
Expand Down Expand Up @@ -2679,7 +2727,7 @@ var html_mqttsetup = `
<tr>
<td>State</td>
<td><span name="mqtt_base_topic"></span>/state</td>
<td>Contains a 0-254 value representing the PWM2I2C speed setting</td>
<td>Contains a 0-255 value representing the PWM2I2C speed setting</td>
</tr>
<tr>
<td>Itho status</td>
Expand Down Expand Up @@ -2845,7 +2893,7 @@ var html_ithosettings = `
<br><br>
<button id="ithogetsettings" class="pure-button pure-button-primary">Retrieve settings</button><br><br>
<div id="settings_cache_load" class="hidden">
<span>Settings loaded from browser cache.<br></span>
<span>Settings loaded from browser cache. Note that changes done through the settings WebAPI might not be reflected correctly here. Force refresh the (induvidual) setting(s) to update values and cache.<br></span>
<button id="ithoforcerefresh" class="pure-button pure-button-primary">Force settings refresh</button><br><br>
</div>
<div id="downloadsettingsdiv" class="hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Itho settings</h1>
<br><br>
<button id="ithogetsettings" class="pure-button pure-button-primary">Retrieve settings</button><br><br>
<div id="settings_cache_load" class="hidden">
<span>Settings loaded from browser cache.<br></span>
<span>Settings loaded from browser cache. Note that changes done through the settings WebAPI might not be reflected correctly here. Force refresh the (induvidual) setting(s) to update values and cache.<br></span>
<button id="ithoforcerefresh" class="pure-button pure-button-primary">Force settings refresh</button><br><br>
</div>
<div id="downloadsettingsdiv" class="hidden">
Expand Down
Loading

0 comments on commit 4e42f3b

Please sign in to comment.