From fb1d49e2630ac9704d1ff0c6b5d43690ced21c31 Mon Sep 17 00:00:00 2001 From: Jeroen ter Heerdt Date: Thu, 4 Apr 2024 19:11:27 +0000 Subject: [PATCH] v2024.4.2 fixes --- custom_components/daily/__init__.py | 4 +- custom_components/daily/config_flow.py | 9 ++-- custom_components/daily/const.py | 4 +- custom_components/daily/manifest.json | 2 +- custom_components/daily/strings.json | 7 ++- custom_components/daily/translations/el.json | 7 ++- custom_components/daily/translations/en.json | 7 ++- custom_components/daily/translations/es.json | 7 ++- custom_components/daily/translations/fr.json | 47 ++++++++++---------- custom_components/daily/translations/nb.json | 7 ++- custom_components/daily/translations/nl.json | 7 ++- custom_components/daily/translations/sk.json | 7 ++- 12 files changed, 52 insertions(+), 63 deletions(-) diff --git a/custom_components/daily/__init__.py b/custom_components/daily/__init__.py index b18dc15..103c6af 100644 --- a/custom_components/daily/__init__.py +++ b/custom_components/daily/__init__.py @@ -132,7 +132,7 @@ def __init__( self.name = name self.input_sensor = input_sensor self.operation = operation - self.interval = float(interval) + self.interval = int(interval) self.unit_of_measurement = unit_of_measurement self.auto_reset = auto_reset self.hass = hass @@ -140,7 +140,7 @@ def __init__( self.platforms = [] self.entry_setup_completed = False - SCAN_INTERVAL = timedelta(minutes=self.interval) + SCAN_INTERVAL = timedelta(seconds=self.interval) super().__init__(hass, _LOGGER, name=name, update_interval=SCAN_INTERVAL) # reset happens at midnight diff --git a/custom_components/daily/config_flow.py b/custom_components/daily/config_flow.py index 3b9b456..3f0523d 100644 --- a/custom_components/daily/config_flow.py +++ b/custom_components/daily/config_flow.py @@ -54,11 +54,8 @@ async def async_step_user(self, user_input=None): raise OperationNotFound # check the interval if ( - not ( - isinstance(user_input[CONF_INTERVAL], int) - or isinstance(user_input[CONF_INTERVAL], float) - ) - or float(user_input[CONF_INTERVAL]) <= 0.0 + not (isinstance(user_input[CONF_INTERVAL], int)) + or user_input[CONF_INTERVAL] <= 0 ): raise IntervalNotValid self._name = user_input[CONF_NAME] @@ -102,7 +99,7 @@ async def _show_config_form(self, user_input): vol.Required(CONF_INPUT_SENSOR): str, vol.Required(CONF_OPERATION): vol.In(VALID_OPERATIONS), vol.Required(CONF_UNIT_OF_MEASUREMENT): str, - vol.Required(CONF_INTERVAL, default=DEFAULT_INTERVAL): float, + vol.Required(CONF_INTERVAL, default=DEFAULT_INTERVAL): int, vol.Required(CONF_AUTO_RESET, default=DEFAULT_AUTO_RESET): bool, } ), diff --git a/custom_components/daily/const.py b/custom_components/daily/const.py index d95d588..108cdec 100644 --- a/custom_components/daily/const.py +++ b/custom_components/daily/const.py @@ -3,7 +3,7 @@ DOMAIN = "daily" NAME = "Daily Sensor" DOMAIN_DATA = f"{DOMAIN}_data" -VERSION = "2024.4.1" +VERSION = "2024.4.2" ISSUE_URL = "https://github.com/jeroenterheerdt/HADailySensor/issues" @@ -44,7 +44,7 @@ ] # Defaults -DEFAULT_INTERVAL = 30 # minutes +DEFAULT_INTERVAL = 1800.0 # seconds DEFAULT_AUTO_RESET = True # Services SERVICE_RESET = "reset" diff --git a/custom_components/daily/manifest.json b/custom_components/daily/manifest.json index 97f0944..df89e4f 100644 --- a/custom_components/daily/manifest.json +++ b/custom_components/daily/manifest.json @@ -10,5 +10,5 @@ "homekit": {}, "dependencies": [], "codeowners": ["@jeroenterheerdt"], - "version": "2024.4.1" + "version": "2024.4.2" } diff --git a/custom_components/daily/strings.json b/custom_components/daily/strings.json index 7aa9bdf..4787739 100644 --- a/custom_components/daily/strings.json +++ b/custom_components/daily/strings.json @@ -10,19 +10,18 @@ "sensor": "The entity that will provide input to the daily sensor", "operation": "The operation to be applied to the sensor", "unit_of_measurement": "The unit of measurement", - "interval": "Refresh interval in minutes", + "interval": "Refresh interval in seconds", "auto_reset": "Automatically reset at 00:00 ?" } } }, "error": { - "intervalnotvalid": "Specified interval is not valid. Needs to be >0 minutes.", + "intervalnotvalid": "Specified interval is not valid. Needs to be >0 seconds.", "name": "Specify an unique name for this instance.", "operationnotfound": "Specify a supported operation", "sensornotfound": "One or more of the sensors specified do not exist", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/el.json b/custom_components/daily/translations/el.json index 2a8e08b..7632064 100644 --- a/custom_components/daily/translations/el.json +++ b/custom_components/daily/translations/el.json @@ -10,19 +10,18 @@ "sensor": "Η οντότητα που θα παρέχει είσοδο στον ημερήσιο αισθητήρα", "operation": "Η λειτουργία που θα εφαρμοστεί στον αισθητήρα", "unit_of_measurement": "Η μονάδα μέτρησης", - "interval": "Διάστημα ανανέωσης σε λεπτά", + "interval": "Διάστημα ανανέωσης σε δευτερόλεπτα", "auto_reset": "Αυτόματη επαναφορά στις 00:00" } } }, "error": { - "intervalnotvalid": "Το καθορισμένο διάστημα δεν είναι έγκυρο. Πρέπει να είναι >0 λεπτά.", + "intervalnotvalid": "Το καθορισμένο διάστημα δεν είναι έγκυρο. Πρέπει να είναι >0 δευτερόλεπτα.", "name": "Καθορίστε ένα μοναδικό όνομα για αυτήν την υπόσταση.", "operationnotfound": "Καθορίστε μια υποστηριζόμενη λειτουργία", "sensornotfound": "Ενας ή περισσότεροι από τους καθορισμένους αισθητήρες δεν υπάρχουν", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/en.json b/custom_components/daily/translations/en.json index ea7e2d0..e1e2770 100644 --- a/custom_components/daily/translations/en.json +++ b/custom_components/daily/translations/en.json @@ -10,19 +10,18 @@ "sensor": "The entity that will provide input to the daily sensor", "operation": "The operation to be applied to the sensor", "unit_of_measurement": "The unit of measurement", - "interval": "Refresh interval in minutes", + "interval": "Refresh interval in seconds", "auto_reset": "Automatically reset at 00:00" } } }, "error": { - "intervalnotvalid": "Specified interval is not valid. Needs to be >0 minutes.", + "intervalnotvalid": "Specified interval is not valid. Needs to be >0 seconds.", "name": "Specify an unique name for this instance.", "operationnotfound": "Specify a supported operation", "sensornotfound": "One or more of the sensors specified do not exist", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/es.json b/custom_components/daily/translations/es.json index 027f6b1..8a34672 100644 --- a/custom_components/daily/translations/es.json +++ b/custom_components/daily/translations/es.json @@ -10,19 +10,18 @@ "sensor": "Entidad que provee la entrada para el sensor diario", "operation": "Operación a aplicar al sensor", "unit_of_measurement": "Unidad de medida", - "interval": "Intervalo de refresco en minutos", + "interval": "Intervalo de refresco en segundos", "auto_reset": "Resetear automáticamente a las 00:00" } } }, "error": { - "intervalnotvalid": "El intervalo especificado no es válido. Necesita ser >0 minutos.", + "intervalnotvalid": "El intervalo especificado no es válido. Necesita ser >0 segundos.", "name": "Especifica un nombre único para esta instancia.", "operationnotfound": "Especifica una operación soportada.", "sensornotfound": "Uno o más de los sensores especificados no existe.", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/fr.json b/custom_components/daily/translations/fr.json index 6691d79..17d6203 100755 --- a/custom_components/daily/translations/fr.json +++ b/custom_components/daily/translations/fr.json @@ -1,28 +1,27 @@ { - "title": "Capteur journalier", - "config": { - "step": { - "user": { - "title": "Capteur journalier", - "description": "Si vous avez besoin d'aide pour la configuration, référez-vous ici: https://github.com/jeroenterheerdt/HADailySensor", - "data": { - "name": "Nom unique de l'instance", - "sensor": "L'entité qui fournira les données d'entrée au capteur journalier", - "operation": "L'opération à appliquer au capteur", - "unit_of_measurement": "L'unité de mesure", - "interval": "L'intervalle de mise à jour en minutes", - "auto_reset": "Reset automatique à minuit ?" - } + "title": "Capteur journalier", + "config": { + "step": { + "user": { + "title": "Capteur journalier", + "description": "Si vous avez besoin d'aide pour la configuration, référez-vous ici: https://github.com/jeroenterheerdt/HADailySensor", + "data": { + "name": "Nom unique de l'instance", + "sensor": "L'entité qui fournira les données d'entrée au capteur journalier", + "operation": "L'opération à appliquer au capteur", + "unit_of_measurement": "L'unité de mesure", + "interval": "L'intervalle de mise à jour en secondes", + "auto_reset": "Reset automatique à minuit ?" } - }, - "error": { - "intervalnotvalid": "L'intervalle spécifié n'est pas valide: il faut un nombre >0 de minutes.", - "name": "Spécifier un nom unique pour cette instance.", - "operationnotfound": "Spécifier une opération supportée", - "sensornotfound": "Au moins un des capteurs spécifiés n'existe pas", - "unknown": "[%key:common::config_flow::error::unknown%]" - }, - "abort": { } - } + }, + "error": { + "intervalnotvalid": "L'intervalle spécifié n'est pas valide: il faut un nombre >0 de secondes.", + "name": "Spécifier un nom unique pour cette instance.", + "operationnotfound": "Spécifier une opération supportée", + "sensornotfound": "Au moins un des capteurs spécifiés n'existe pas", + "unknown": "[%key:common::config_flow::error::unknown%]" + }, + "abort": {} } +} diff --git a/custom_components/daily/translations/nb.json b/custom_components/daily/translations/nb.json index a600bda..4543f1f 100644 --- a/custom_components/daily/translations/nb.json +++ b/custom_components/daily/translations/nb.json @@ -10,19 +10,18 @@ "sensor": "Enheten som vil gi innspill til den daglige sensoren", "operation": "Operasjonen som skal brukes på sensoren", "unit_of_measurement": "Måleenheten", - "interval": "Oppdater intervall i minutter", + "interval": "Oppdater intervall i sekunder", "auto_reset": "Återställs automatiskt vid midnatt?" } } }, "error": { - "intervalnotvalid": "Spesifisert intervall er ikke gyldig. Må være >0 minutter.", + "intervalnotvalid": "Spesifisert intervall er ikke gyldig. Må være >0 sekunder.", "name": "Angi et unikt navn for denne forekomsten.", "operationnotfound": "Spesifiser en støttet operasjon", "sensornotfound": "En eller flere av sensorene som er spesifisert, eksisterer ikke", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/nl.json b/custom_components/daily/translations/nl.json index 08b13b7..e81c474 100644 --- a/custom_components/daily/translations/nl.json +++ b/custom_components/daily/translations/nl.json @@ -10,19 +10,18 @@ "sensor": "De entiteit die de input voor de dagelijkse sensor levert", "operation": "De operatie die op de dagelijkse sensor wordt gedaan", "unit_of_measurement": "De eenheid van de sensor", - "interval": "Ververs interval in minuten", + "interval": "Ververs interval in seconden", "auto_reset": "Automatische reset om 00:00" } } }, "error": { - "intervalnotvalid": "Het gegeven interval is niet correct. Het moet >0 minuten zijn.", + "intervalnotvalid": "Het gegeven interval is niet correct. Het moet >0 seconden zijn.", "name": "Geef een unieke naam voor deze instantie.", "operationnotfound": "Kies een operatie die wordt ondersteund.", "sensornotfound": "Een of meer van de gegeven sensors bestaan niet.", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } } diff --git a/custom_components/daily/translations/sk.json b/custom_components/daily/translations/sk.json index ae0550a..48f8f4e 100644 --- a/custom_components/daily/translations/sk.json +++ b/custom_components/daily/translations/sk.json @@ -10,19 +10,18 @@ "sensor": "Entita, ktorá bude poskytovať vstup pre denný senzor", "operation": "Operácia, ktorá sa má použiť na snímač", "unit_of_measurement": "Jednotka merania", - "interval": "Interval obnovovania v minútach", + "interval": "Interval obnovovania v sekund", "auto_reset": "Automaticky resetovať o 00:00" } } }, "error": { - "intervalnotvalid": "Zadaný interval nie je platný. Musí byť > 0 minút.", + "intervalnotvalid": "Zadaný interval nie je platný. Musí byť > 0 sekund.", "name": "Zadajte jedinečný názov pre túto inštanciu.", "operationnotfound": "Zadajte podporovanú operáciu", "sensornotfound": "Jeden alebo viacero špecifikovaných snímačov neexistuje", "unknown": "[%key:common::config_flow::error::unknown%]" }, - "abort": { - } + "abort": {} } }