From 2fcb22b1eba65da1310a05665d379202d3f421d7 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Sun, 26 Jan 2025 22:32:45 +0000 Subject: [PATCH] ConfigFlow (translation to change) --- .../versatile_thermostat/config_schema.py | 13 ++++++++--- .../versatile_thermostat/const.py | 3 +++ .../versatile_thermostat/strings.json | 16 +++++++++---- .../versatile_thermostat/translations/en.json | 20 +++++++++++----- .../versatile_thermostat/translations/fr.json | 23 ++++++++++++++----- 5 files changed, 56 insertions(+), 19 deletions(-) diff --git a/custom_components/versatile_thermostat/config_schema.py b/custom_components/versatile_thermostat/config_schema.py index 1c35830..0c6681d 100644 --- a/custom_components/versatile_thermostat/config_schema.py +++ b/custom_components/versatile_thermostat/config_schema.py @@ -1,6 +1,7 @@ """ All the schemas for ConfigFlow validation""" import voluptuous as vol +from voluptuous import All import homeassistant.helpers.config_validation as cv from homeassistant.helpers import selector @@ -16,6 +17,10 @@ from homeassistant.components.input_number import ( DOMAIN as INPUT_NUMBER_DOMAIN, ) +from homeassistant.components.select import ( + DOMAIN as SELECT_DOMAIN, +) + from homeassistant.components.input_datetime import ( DOMAIN as INPUT_DATETIME_DOMAIN, ) @@ -120,9 +125,7 @@ STEP_CENTRAL_BOILER_SCHEMA = vol.Schema( STEP_THERMOSTAT_SWITCH = vol.Schema( # pylint: disable=invalid-name { vol.Required(CONF_UNDERLYING_LIST): selector.EntitySelector( - selector.EntitySelectorConfig( - domain=[SWITCH_DOMAIN, INPUT_BOOLEAN_DOMAIN], multiple=True - ), + selector.EntitySelectorConfig(domain=[SWITCH_DOMAIN, INPUT_BOOLEAN_DOMAIN, SELECT_DOMAIN, CLIMATE_DOMAIN], multiple=True), ), vol.Optional(CONF_HEATER_KEEP_ALIVE): cv.positive_int, vol.Required(CONF_PROP_FUNCTION, default=PROPORTIONAL_FUNCTION_TPI): vol.In( @@ -132,6 +135,10 @@ STEP_THERMOSTAT_SWITCH = vol.Schema( # pylint: disable=invalid-name ), vol.Optional(CONF_AC_MODE, default=False): cv.boolean, vol.Optional(CONF_INVERSE_SWITCH, default=False): cv.boolean, + vol.Optional("on_command_text", default=False): vol.In([]), + vol.Optional(CONF_VSWITCH_ON_COMMAND): selector.TextSelector(selector.TextSelectorConfig(type=selector.TextSelectorType.TEXT, multiple=True)), + vol.Optional("off_command_text", default=False): vol.In([]), + vol.Optional(CONF_VSWITCH_OFF_COMMAND): selector.TextSelector(selector.TextSelectorConfig(type=selector.TextSelectorType.TEXT, multiple=True)), } ) diff --git a/custom_components/versatile_thermostat/const.py b/custom_components/versatile_thermostat/const.py index 745af24..d27035b 100644 --- a/custom_components/versatile_thermostat/const.py +++ b/custom_components/versatile_thermostat/const.py @@ -127,6 +127,9 @@ CONF_OPENING_DEGREE_LIST = "opening_degree_entity_ids" CONF_CLOSING_DEGREE_LIST = "closing_degree_entity_ids" CONF_MIN_OPENING_DEGREES = "min_opening_degrees" +CONF_VSWITCH_ON_COMMAND = "vswitch_on_command" +CONF_VSWITCH_OFF_COMMAND = "vswitch_off_command" + # Deprecated CONF_HEATER = "heater_entity_id" CONF_HEATER_2 = "heater_entity2_id" diff --git a/custom_components/versatile_thermostat/strings.json b/custom_components/versatile_thermostat/strings.json index dda80a1..96077bf 100644 --- a/custom_components/versatile_thermostat/strings.json +++ b/custom_components/versatile_thermostat/strings.json @@ -82,7 +82,9 @@ "auto_regulation_periode_min": "Regulation minimum period", "auto_regulation_use_device_temp": "Use internal temperature of the underlying", "inverse_switch_command": "Inverse switch command", - "auto_fan_mode": "Auto fan mode" + "auto_fan_mode": "Auto fan mode", + "vswitch_on_command": "Optional turn on commands", + "vswitch_off_command": "Optional turn off commands" }, "data_description": { "underlying_entity_ids": "The device(s) to be controlled - 1 is required", @@ -94,7 +96,9 @@ "auto_regulation_periode_min": "Duration in minutes between two regulation update", "auto_regulation_use_device_temp": "Use the eventual internal temperature sensor of the underlying to speedup the self-regulation", "inverse_switch_command": "For switch with pilot wire and diode you may need to inverse the command", - "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary" + "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary", + "vswitch_on_command": "A list of turn on command in the form: action:parameter. Example: select_option:comfort. See README for more examples", + "vswitch_off_command": "A list of turn on command in the form: action:parameter. Example: select_option:frost. See README for more examples" } }, "tpi": { @@ -330,7 +334,9 @@ "auto_regulation_periode_min": "Regulation minimum period", "auto_regulation_use_device_temp": "Use internal temperature of the underlying", "inverse_switch_command": "Inverse switch command", - "auto_fan_mode": "Auto fan mode" + "auto_fan_mode": "Auto fan mode", + "vswitch_on_command": "Optional turn on commands", + "vswitch_off_command": "Optional turn off commands" }, "data_description": { "underlying_entity_ids": "The device(s) to be controlled - 1 is required", @@ -342,7 +348,9 @@ "auto_regulation_periode_min": "Duration in minutes between two regulation update", "auto_regulation_use_device_temp": "Use the eventual internal temperature sensor of the underlying to speedup the self-regulation", "inverse_switch_command": "For switch with pilot wire and diode you may need to invert the command", - "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary" + "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary", + "vswitch_on_command": "A list of turn on command in the form: action:parameter. Example: select_option:comfort. See README for more examples", + "vswitch_off_command": "A list of turn on command in the form: action:parameter. Example: select_option:frost. See README for more examples" } }, "tpi": { diff --git a/custom_components/versatile_thermostat/translations/en.json b/custom_components/versatile_thermostat/translations/en.json index bc69bb8..96077bf 100644 --- a/custom_components/versatile_thermostat/translations/en.json +++ b/custom_components/versatile_thermostat/translations/en.json @@ -82,7 +82,9 @@ "auto_regulation_periode_min": "Regulation minimum period", "auto_regulation_use_device_temp": "Use internal temperature of the underlying", "inverse_switch_command": "Inverse switch command", - "auto_fan_mode": "Auto fan mode" + "auto_fan_mode": "Auto fan mode", + "vswitch_on_command": "Optional turn on commands", + "vswitch_off_command": "Optional turn off commands" }, "data_description": { "underlying_entity_ids": "The device(s) to be controlled - 1 is required", @@ -94,7 +96,9 @@ "auto_regulation_periode_min": "Duration in minutes between two regulation update", "auto_regulation_use_device_temp": "Use the eventual internal temperature sensor of the underlying to speedup the self-regulation", "inverse_switch_command": "For switch with pilot wire and diode you may need to inverse the command", - "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary" + "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary", + "vswitch_on_command": "A list of turn on command in the form: action:parameter. Example: select_option:comfort. See README for more examples", + "vswitch_off_command": "A list of turn on command in the form: action:parameter. Example: select_option:frost. See README for more examples" } }, "tpi": { @@ -234,7 +238,7 @@ "opening_degree_entity_ids": "The list of the 'opening degree' entities. There should be one per underlying climate entities", "closing_degree_entity_ids": "The list of the 'closing degree' entities. Set it if your TRV has the entity for better regulation. There should be one per underlying climate entities", "proportional_function": "Algorithm to use (TPI is the only one for now)", - "min_opening_degrees": "A comma seperated list of minimal opening degrees. Default to 0. Example: 20, 25, 30" + "min_opening_degrees": "Opening degree minimum value for each underlying device, comma separated. Default to 0. Example: 20, 25, 30" } } }, @@ -330,7 +334,9 @@ "auto_regulation_periode_min": "Regulation minimum period", "auto_regulation_use_device_temp": "Use internal temperature of the underlying", "inverse_switch_command": "Inverse switch command", - "auto_fan_mode": "Auto fan mode" + "auto_fan_mode": "Auto fan mode", + "vswitch_on_command": "Optional turn on commands", + "vswitch_off_command": "Optional turn off commands" }, "data_description": { "underlying_entity_ids": "The device(s) to be controlled - 1 is required", @@ -342,7 +348,9 @@ "auto_regulation_periode_min": "Duration in minutes between two regulation update", "auto_regulation_use_device_temp": "Use the eventual internal temperature sensor of the underlying to speedup the self-regulation", "inverse_switch_command": "For switch with pilot wire and diode you may need to invert the command", - "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary" + "auto_fan_mode": "Automatically activate fan when huge heating/cooling is necessary", + "vswitch_on_command": "A list of turn on command in the form: action:parameter. Example: select_option:comfort. See README for more examples", + "vswitch_off_command": "A list of turn on command in the form: action:parameter. Example: select_option:frost. See README for more examples" } }, "tpi": { @@ -481,7 +489,7 @@ "opening_degree_entity_ids": "The list of the 'opening degree' entities. There should be one per underlying climate entities", "closing_degree_entity_ids": "The list of the 'closing degree' entities. Set it if your TRV has the entity for better regulation. There should be one per underlying climate entities", "proportional_function": "Algorithm to use (TPI is the only one for now)", - "min_opening_degrees": "A comma seperated list of minimal opening degrees. Default to 0. Example: 20, 25, 30" + "min_opening_degrees": "Opening degree minimum value for each underlying device, comma separated. Default to 0. Example: 20, 25, 30" } } }, diff --git a/custom_components/versatile_thermostat/translations/fr.json b/custom_components/versatile_thermostat/translations/fr.json index 09f8df1..467d78a 100644 --- a/custom_components/versatile_thermostat/translations/fr.json +++ b/custom_components/versatile_thermostat/translations/fr.json @@ -71,7 +71,7 @@ }, "type": { "title": "Entité(s) liée(s)", - "description": "Attributs de(s) l'entité(s) liée(s)", + "description": "Attributs de(s) l'entité(s) liée(s) [![?](https://img.icons8.com/color/18/help.png)](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/fr/over-switch.md#configuration)", "data": { "underlying_entity_ids": "Les équipements à controller", "heater_keep_alive": "keep-alive (sec)", @@ -82,7 +82,11 @@ "auto_regulation_periode_min": "Période minimale de régulation", "auto_regulation_use_device_temp": "Compenser la température interne du sous-jacent", "inverse_switch_command": "Inverser la commande", - "auto_fan_mode": " Auto ventilation mode" + "auto_fan_mode": " Auto ventilation mode", + "on_command_text": "Personnalisation des commandes d'allumage", + "vswitch_on_command": "Commande d'allumage (optionnel)", + "off_command_text": "Personnalisation des commandes d'extinction", + "vswitch_off_command": "Commande d'extinction (optionnel)" }, "data_description": { "underlying_entity_ids": "La liste des équipements qui seront controlés par ce VTherm", @@ -94,7 +98,8 @@ "auto_regulation_periode_min": "La durée en minutes entre deux mise à jour faites par la régulation", "auto_regulation_use_device_temp": "Compenser la temperature interne du sous-jacent pour accélérer l'auto-régulation", "inverse_switch_command": "Inverse la commande du switch pour une installation avec fil pilote et diode", - "auto_fan_mode": "Active la ventilation automatiquement en cas d'écart important" + "auto_fan_mode": "Active la ventilation automatiquement en cas d'écart important", + "on_command_text": "Pour les sous-jacents de type `select` ou `climate` vous devez personnaliser les commandes." } }, "tpi": { @@ -319,7 +324,7 @@ }, "type": { "title": "Entité(s) liée(s) - {name}", - "description": "Attributs de(s) l'entité(s) liée(s)", + "description": "Attributs de(s) l'entité(s) liée(s) [![?](https://img.icons8.com/color/18/help.png)](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/fr/over-switch.md#configuration)", "data": { "underlying_entity_ids": "Les équipements à controller", "heater_keep_alive": "keep-alive (sec)", @@ -330,7 +335,10 @@ "auto_regulation_periode_min": "Période minimale de régulation", "auto_regulation_use_device_temp": "Compenser la température interne du sous-jacent", "inverse_switch_command": "Inverser la commande", - "auto_fan_mode": " Auto ventilation mode" + "auto_fan_mode": " Auto ventilation mode", + "on_command_text": "Personnalisation des commandes", + "vswitch_on_command": "Commande d'allumage (optionnel)", + "vswitch_off_command": "Commande d'extinction (optionnel)" }, "data_description": { "underlying_entity_ids": "La liste des équipements qui seront controlés par ce VTherm", @@ -342,7 +350,10 @@ "auto_regulation_periode_min": "La durée en minutes entre deux mise à jour faites par la régulation", "auto_regulation_use_device_temp": "Compenser la temperature interne du sous-jacent pour accélérer l'auto-régulation", "inverse_switch_command": "Inverse la commande du switch pour une installation avec fil pilote et diode", - "auto_fan_mode": "Active la ventilation automatiquement en cas d'écart important" + "auto_fan_mode": "Active la ventilation automatiquement en cas d'écart important", + "on_command_text": "Pour les sous-jacents de type `select` ou `climate`", + "vswitch_on_command": "Une liste de commande d'allumage au format: action:parameter. Exemple: select_option:comfort. Cf. README pour plus d'exmples", + "vswitch_off_command": "Une liste de commande d'extinction au format: action:parameter. Exemple: select_option:frost. Cf. README pour plus d'exmples" } }, "tpi": {