diff --git a/_includes/config_battery_reporting.html b/_includes/config_battery_reporting.html new file mode 100644 index 0000000..8c124f3 --- /dev/null +++ b/_includes/config_battery_reporting.html @@ -0,0 +1,17 @@ +
+
+ +
+ + +
+ +
+ +
+ +
+
+
diff --git a/config_aplite.html b/config_aplite.html index 1e98f93..ce44d50 100644 --- a/config_aplite.html +++ b/config_aplite.html @@ -13,6 +13,7 @@ {% include config_theme_bw.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_basalt.html b/config_basalt.html index 7be891a..ca4ef68 100644 --- a/config_basalt.html +++ b/config_basalt.html @@ -15,6 +15,7 @@ {% include config_theme_color.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_bw.html b/config_bw.html index 0303ef3..02ab1fd 100644 --- a/config_bw.html +++ b/config_bw.html @@ -18,6 +18,7 @@ {% include config_theme_bw.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_chalk.html b/config_chalk.html index f63a398..a6e4240 100644 --- a/config_chalk.html +++ b/config_chalk.html @@ -15,6 +15,7 @@ {% include config_theme_color.html %} {% include config_sidebar_layout_round.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_color.html b/config_color.html index 64389d4..7caf5aa 100644 --- a/config_color.html +++ b/config_color.html @@ -20,6 +20,7 @@ {% include config_theme_color.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_color_round.html b/config_color_round.html index 56e92ab..a153e40 100644 --- a/config_color_round.html +++ b/config_color_round.html @@ -20,6 +20,7 @@ {% include config_theme_color.html %} {% include config_sidebar_layout_round.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_diorite.html b/config_diorite.html index 593a5a0..ae6b86a 100644 --- a/config_diorite.html +++ b/config_diorite.html @@ -16,6 +16,7 @@ {% include config_theme_bw.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/config_emery.html b/config_emery.html index e18b3a9..d3c804e 100644 --- a/config_emery.html +++ b/config_emery.html @@ -16,6 +16,7 @@ {% include config_theme_color.html %} {% include config_sidebar_layout_rect.html %} {% include config_common_options.html %} + {% include config_battery_reporting.html %} diff --git a/js/config.js b/js/config.js index 1935a9e..c31c227 100755 --- a/js/config.js +++ b/js/config.js @@ -79,6 +79,10 @@ function loadPreviousSettings() { health_use_restful_sleep: 'no', decimal_separator: '.', + // battery reporting settings + remote_endpoint_url: '', + remote_endpoint_token: '', + // version key used for migrations settings_version: CURRENT_SETTINGS_VERSION }; @@ -147,6 +151,14 @@ function loadPreviousSettings() { $('#altclock_offset_hour option[data-setting="' + savedSettings.altclock_offset + '"]').prop('selected', true); $('#altclock_offset_hour option[data-setting="' + savedSettings.altclock_offset + '"]').prop('selected', true); + // load battery reporting settings + if(savedSettings.remote_endpoint_url) { + $('#remote_endpoint_url').val(savedSettings.remote_endpoint_url); + } + if(savedSettings.remote_endpoint_token) { + $('#remote_endpoint_token').val(savedSettings.remote_endpoint_token); + } + // update the widget settings sections to only show ones that are relevant showOnlySelectedWidgetSettings(); } @@ -182,6 +194,8 @@ $('select').on('change', setFormHasChanges); $('#weather_loc').on('input', setFormHasChanges); $('#weather_api_key').on('input', setFormHasChanges); $('#altclock_name').on('input', setFormHasChanges); +$('#remote_endpoint_url').on('input', setFormHasChanges); +$('#remote_endpoint_token').on('input', setFormHasChanges); $('#use_large_sidebar_font_setting').on('change', updateSidebarPreview); $('#battery_meter_setting').on('change', updateSidebarPreview); @@ -579,6 +593,10 @@ function sendSettingsToWatch() { config.altclock_name = $('#altclock_name').val(); config.altclock_offset = $('#altclock_offset_hour option:selected').data('setting'); + // battery reporting settings + config.remote_endpoint_url = $('#remote_endpoint_url').val(); + config.remote_endpoint_token = $('#remote_endpoint_token').val(); + // add the version, in case we need to do more migrations config.settings_version = CURRENT_SETTINGS_VERSION;