Skip to content

Commit

Permalink
v2024.4.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenterheerdt committed Apr 4, 2024
1 parent a9bea3d commit fb1d49e
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 63 deletions.
4 changes: 2 additions & 2 deletions custom_components/daily/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ 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
self.entities = {}
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
Expand Down
9 changes: 3 additions & 6 deletions custom_components/daily/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
}
),
Expand Down
4 changes: 2 additions & 2 deletions custom_components/daily/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -44,7 +44,7 @@
]

# Defaults
DEFAULT_INTERVAL = 30 # minutes
DEFAULT_INTERVAL = 1800.0 # seconds
DEFAULT_AUTO_RESET = True
# Services
SERVICE_RESET = "reset"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/daily/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"homekit": {},
"dependencies": [],
"codeowners": ["@jeroenterheerdt"],
"version": "2024.4.1"
"version": "2024.4.2"
}
7 changes: 3 additions & 4 deletions custom_components/daily/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
47 changes: 23 additions & 24 deletions custom_components/daily/translations/fr.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}
7 changes: 3 additions & 4 deletions custom_components/daily/translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}
}
}

0 comments on commit fb1d49e

Please sign in to comment.