Config UI: add heating support (#22177)

This commit is contained in:
Michael Geers 2025-07-07 21:36:32 +02:00 • committed by GitHub
parent b6ff1cad92
commit f3b60644e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 1399 additions and 486 deletions

View file

@ -86,7 +86,7 @@ export default defineComponent({
},
});
export function customTemplateOption(name: string) {
return { template: "custom", name };
export function customTemplateOption(name: string, template = "custom") {
return { name, template };
}
</script>

View file

@ -57,6 +57,10 @@ export const timeout = 15000;
export enum ConfigType {
Template = "template",
Custom = "custom",
Heatpump = "heatpump",
SwitchSocket = "switchsocket",
SgReady = "sgready",
SgReadyBoost = "sgready-boost",
}
export function applyDefaultsFromTemplate(template: Template | null, values: DeviceValues) {
@ -68,6 +72,18 @@ export function applyDefaultsFromTemplate(template: Template | null, values: Dev
});
}
export function customChargerName(type: ConfigType, isHeating: boolean) {
if (!type) {
return "config.general.customOption";
}
const prefix = "config.charger.type.";
const suffix = isHeating ? ".heating" : ".charging";
if (type === ConfigType.Custom) {
return `${prefix}custom${suffix}`;
}
return `${prefix}${type}`;
}
export function createDeviceUtils(deviceType: DeviceType) {
function test(id: number | undefined, data: any) {
let url = `config/test/${deviceType}`;