From e7623fa8cff70787a245eb6cd13d346bb59271b5 Mon Sep 17 00:00:00 2001 From: Andreas Linde <42185+DerAndereAndi@users.noreply.github.com> Date: Fri, 10 Dec 2021 11:31:22 +0100 Subject: [PATCH] More improvements and fixes for configure (#2010) - Fixes Modbus setup not working, actually the test not using the user input - Make sure Modbus input items use localized text and help - Mask sponsorship token input --- cmd/configure/helper.go | 15 +++++++++------ cmd/configure/localization/de.toml | 3 ++- cmd/configure/localization/en.toml | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/configure/helper.go b/cmd/configure/helper.go index 74eb6e30a..d931c183e 100644 --- a/cmd/configure/helper.go +++ b/cmd/configure/helper.go @@ -124,6 +124,7 @@ func (c *CmdConfigure) processDeviceRequirements(templateItem templates.Template } sponsortoken := c.askValue(question{ label: c.localizedString("Requirements_Sponsorship_Token_Input", nil), + mask: true, required: true}) c.configuration.config.SponsorToken = sponsortoken sponsor.Subject = sponsortoken @@ -346,24 +347,26 @@ func (c *CmdConfigure) processModbusConfig(param templates.Param, deviceCategory index, _ = c.askChoice(c.localizedString("Config_ModbusInterface", nil), choices) } selectedModbusKey = choiceKeys[index] + additionalConfig[templates.ParamModbus] = selectedModbusKey + switch selectedModbusKey { case templates.ModbusKeyRS485Serial: device := c.askValue(question{ - label: "Device", - help: "USB-RS485 Adapter Adresse", + label: c.localizedString("UserFriendly_Baudrate_Name", nil), + help: c.localizedString("UserFriendly_Device_Help", nil), exampleValue: templates.ModbusParamValueDevice, required: true}) additionalConfig[templates.ModbusParamNameDevice] = device baudrate := c.askValue(question{ - label: "Baudrate", + label: c.localizedString("UserFriendly_Baudrate_Name", nil), defaultValue: deviceDefaultBaudrate, valueType: templates.ParamValueTypeNumber, required: true}) additionalConfig[templates.ModbusParamNameBaudrate] = baudrate comset := c.askValue(question{ - label: "ComSet", + label: c.localizedString("UserFriendly_ComSet_Name", nil), defaultValue: deviceDefaultComset, required: true}) additionalConfig[templates.ModbusParamNameComset] = comset @@ -373,13 +376,13 @@ func (c *CmdConfigure) processModbusConfig(param templates.Param, deviceCategory additionalConfig[templates.ModbusParamNameRTU] = "true" } host := c.askValue(question{ - label: "Host", + label: c.localizedString("UserFriendly_Host_Name", nil), exampleValue: templates.ModbusParamValueHost, required: true}) additionalConfig[templates.ModbusParamNameHost] = host port := c.askValue(question{ - label: "Port", + label: c.localizedString("UserFriendly_Port_Name", nil), defaultValue: templates.ModbusParamValuePort, valueType: templates.ParamValueTypeNumber, required: true}) diff --git a/cmd/configure/localization/de.toml b/cmd/configure/localization/de.toml index 4dceba78b..9310bd6cf 100644 --- a/cmd/configure/localization/de.toml +++ b/cmd/configure/localization/de.toml @@ -2,7 +2,7 @@ Intro = "Die nächsten Schritte führen durch die Einrichtung einer Konfiguratio Flow_Type = "Was möchtest du machen?" Flow_Type_NewConfiguration = "Eine neue evcc Konfigurationsdatei erstellen" -Flow_Type_SingleDevice = "Ein einzelnes Gerät Konfigurieren" +Flow_Type_SingleDevice = "Ein einzelnes Gerät konfigurieren" Flow_NewConfiguration_Setup = "- Hausinstallation einrichten" Flow_NewConfiguration_Select = "Wähle eines der folgenden PV Komplettsysteme aus, oder '{{ .ItemNotPresent }}' falls keines dieser Geräte vorhanden ist" @@ -35,6 +35,7 @@ Choose = "Wähle" UserFriendly_Title_Name = "Titel" UserFriendly_Title_Help = "Wird in der Benutzeroberfläche angezeigt" UserFriendly_Device_Name = "Geräteadresse" +UserFriendly_Device_Help = "USB-RS485 Adapter Adresse" UserFriendly_Baudrate_Name = "Baudrate" UserFriendly_ComSet_Name = "ComSet" UserFriendly_Host_Name = "IP-Adresse oder Hostname" diff --git a/cmd/configure/localization/en.toml b/cmd/configure/localization/en.toml index 3807a5a87..d523edfd7 100644 --- a/cmd/configure/localization/en.toml +++ b/cmd/configure/localization/en.toml @@ -35,6 +35,7 @@ Choose = "Choose" UserFriendly_Title_Name = "Title" UserFriendly_Title_Help = "Will be displayed in the user interface" UserFriendly_Device_Name = "Device address" +UserFriendly_Device_Help = "USB-RS485 Adapter address" UserFriendly_Baudrate_Name = "Baudrate" UserFriendly_ComSet_Name = "ComSet" UserFriendly_Host_Name = "IP-Address or Hostname"