v0.13.7
This commit is contained in:
@@ -9,52 +9,6 @@ const SETTINGS_ENDPOINTS = {
|
||||
debug: '/api/settings/debug',
|
||||
};
|
||||
|
||||
async function fetchSettingsSections() {
|
||||
const [application, gree, history, influxdb, notifications, night, homeAssistant, debug] = await Promise.all([
|
||||
api(SETTINGS_ENDPOINTS.application),
|
||||
api(SETTINGS_ENDPOINTS.gree),
|
||||
api(SETTINGS_ENDPOINTS.history),
|
||||
api(SETTINGS_ENDPOINTS.influxdb),
|
||||
api(SETTINGS_ENDPOINTS.notifications),
|
||||
api(SETTINGS_ENDPOINTS.night),
|
||||
api(SETTINGS_ENDPOINTS.homeAssistant),
|
||||
api(SETTINGS_ENDPOINTS.debug),
|
||||
]);
|
||||
return { application, gree, history, influxdb, notifications, night, homeAssistant, debug };
|
||||
}
|
||||
|
||||
function aggregateSettingsSections(sections, houseMode = app.settings?.house_mode || 'cool') {
|
||||
return {
|
||||
simulator_enabled: !!sections.application.simulator_enabled,
|
||||
controller_id: sections.gree.controller_id,
|
||||
poll_interval_seconds: Number(sections.gree.poll_interval_seconds),
|
||||
zone_interval_seconds: Number(sections.gree.zone_interval_seconds),
|
||||
discovery_timeout_ms: Number(sections.gree.discovery_timeout_ms),
|
||||
discovery_broadcast: sections.gree.discovery_broadcast,
|
||||
suppress_device_beep: !!sections.gree.suppress_device_beep,
|
||||
compressor_protection_enabled: sections.gree.compressor_protection_enabled !== false,
|
||||
compressor_protection_seconds: Number(sections.gree.compressor_protection_seconds),
|
||||
history_retention_days: Number(sections.history.retention_days),
|
||||
history_compaction_enabled: sections.history.compaction_enabled !== false,
|
||||
event_log_retention_days: Number(sections.history.event_retention_days),
|
||||
influxdb: sections.influxdb,
|
||||
notifications: sections.notifications,
|
||||
night_mode: sections.night,
|
||||
home_assistant: sections.homeAssistant,
|
||||
outdoor_assist_enabled: !!sections.homeAssistant.outdoor_assist_enabled,
|
||||
debug: sections.debug,
|
||||
house_mode: houseMode || 'cool',
|
||||
};
|
||||
}
|
||||
|
||||
async function loadSettingsSections(houseMode = app.settings?.house_mode || 'cool') {
|
||||
const sections = await fetchSettingsSections();
|
||||
app.settings = aggregateSettingsSections(sections, houseMode);
|
||||
app.sensorAliases = { ...(app.settings.home_assistant?.sensor_aliases || {}) };
|
||||
app.flowSharedInputs = JSON.parse(JSON.stringify(app.settings.home_assistant?.flow_inputs || []));
|
||||
return app.settings;
|
||||
}
|
||||
|
||||
function applySettingsSection(section, data) {
|
||||
app.settings = app.settings || {};
|
||||
if (section === 'application') app.settings.simulator_enabled = !!data.simulator_enabled;
|
||||
|
||||
Reference in New Issue
Block a user