diff --git a/README.md b/README.md index 7d40711..e16acc3 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ If you experience any readings from your mower that the sensor does not read out ## Known issues * A special [Chrome plugin](#installing-the-chrome-extension) is required to complete the account linking in HomeAssistant. -* The Bosch Cloud (running on Azure) might block this integration from time to time. You might see HTTP 4XX errors like 'The connection to the Bosch Indego API failed!'. This might happen during component setup or during state updates. In that case you might be able to workaround the issue by changing the user agent (in Settings > Devices & services > Bosch Indego Mower > Configure). +* The Bosch Cloud (running on Azure) might block this integration from time to time. You might see HTTP 4XX errors like 'The connection to the Bosch Indego API failed!'. This might happen during component setup or during state updates. In that case you might be able to workaround the issue by changing the user agent (during initial component setup or for existing components under Settings > Devices & services > Bosch Indego Mower > Configure). * You might see HTTP 5XX errors from time to time (most of time once a day). In that case there is a problem on the Bosch Cloud side which is temporary unavailable. * HTTP 5XX errors can also occur right after you have sent an impossible command to the mower. Like docking the mower while it's already docked. diff --git a/custom_components/indego/__init__.py b/custom_components/indego/__init__.py index 2bb435d..2cf7005 100644 --- a/custom_components/indego/__init__.py +++ b/custom_components/indego/__init__.py @@ -196,6 +196,16 @@ def FUNC_ICON_MOWER_ALERT(state): } +def format_indego_date(date: datetime) -> str: + return date.astimezone().strftime("%Y-%m-%d %H:%M:%S") + + +def last_updated_now() -> str: + return homeassistant.util.dt.as_local(utcnow()).strftime( + "%Y-%m-%d %H:%M:%S" + ) + + async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Load a config entry.""" hass.data.setdefault(DOMAIN, {}) @@ -640,9 +650,7 @@ async def _update_operating_data(self): self.entities[ENTITY_BATTERY].add_attributes( { - "last_updated": homeassistant.util.dt.as_local(utcnow()).strftime( - "%Y-%m-%d %H:%M" - ), + "last_updated": last_updated_now(), "voltage_V": self._indego_client.operating_data.battery.voltage, "discharge_Ah": self._indego_client.operating_data.battery.discharge, "cycles": self._indego_client.operating_data.battery.cycles, @@ -685,17 +693,13 @@ async def _update_state(self, longpoll: bool = True): self.entities[ENTITY_MOWER_STATE].add_attributes( { - "last_updated": homeassistant.util.dt.as_local(utcnow()).strftime( - "%Y-%m-%d %H:%M" - ) + "last_updated": last_updated_now() } ) self.entities[ENTITY_MOWER_STATE_DETAIL].add_attributes( { - "last_updated": homeassistant.util.dt.as_local(utcnow()).strftime( - "%Y-%m-%d %H:%M" - ), + "last_updated": last_updated_now(), "state_number": self._indego_client.state.state, "state_description": self._indego_client.state_description_detail, } @@ -703,9 +707,7 @@ async def _update_state(self, longpoll: bool = True): self.entities[ENTITY_LAWN_MOWED].add_attributes( { - "last_updated": homeassistant.util.dt.as_local(utcnow()).strftime( - "%Y-%m-%d %H:%M" - ), + "last_updated": last_updated_now(), "last_session_operation_min": self._indego_client.state.runtime.session.operate, "last_session_cut_min": self._indego_client.state.runtime.session.cut, "last_session_charge_min": self._indego_client.state.runtime.session.charge, @@ -749,7 +751,7 @@ async def _update_alerts(self): "alerts_count": self._indego_client.alerts_count, "last_alert_error_code": self._indego_client.alerts[0].error_code, "last_alert_message": self._indego_client.alerts[0].message, - "last_alert_date": self._indego_client.alerts[0].date.strftime("%Y-%m-%d %H:%M:%S"), + "last_alert_date": format_indego_date(self._indego_client.alerts[0].date), "last_alert_read": self._indego_client.alerts[0].read_status, }, False ) @@ -760,7 +762,7 @@ async def _update_alerts(self): alert_index = 0 for index, alert in enumerate(self._indego_client.alerts): self.entities[ENTITY_ALERT].add_attributes({ - ("alert_%i" % index): "%s: %s" % (alert.date.strftime("%Y-%m-%d %H:%M:%S"), alert.message) + ("alert_%i" % index): "%s: %s" % (format_indego_date(alert.date), alert.message) }, False) alert_index = index @@ -791,19 +793,9 @@ async def _update_last_completed_mow(self): ENTITY_LAST_COMPLETED ].state = self._indego_client.last_completed_mow.isoformat() - self.entities[ENTITY_LAST_COMPLETED].add_attributes( - { - "last_completed_mow": self._indego_client.last_completed_mow.strftime( - "%Y-%m-%d %H:%M" - ) - } - ) - self.entities[ENTITY_LAWN_MOWED].add_attributes( { - "last_completed_mow": self._indego_client.last_completed_mow.strftime( - "%Y-%m-%d %H:%M" - ) + "last_completed_mow": format_indego_date(self._indego_client.last_completed_mow) } ) @@ -813,12 +805,14 @@ async def _update_next_mow(self): if self._indego_client.next_mow: self.entities[ENTITY_NEXT_MOW].state = self._indego_client.next_mow.isoformat() + next_mow = format_indego_date(self._indego_client.next_mow) + self.entities[ENTITY_NEXT_MOW].add_attributes( - {"next_mow": self._indego_client.next_mow.strftime("%Y-%m-%d %H:%M")} + {"next_mow": next_mow} ) self.entities[ENTITY_LAWN_MOWED].add_attributes( - {"next_mow": self._indego_client.next_mow.strftime("%Y-%m-%d %H:%M")} + {"next_mow": next_mow} ) @property diff --git a/custom_components/indego/manifest.json b/custom_components/indego/manifest.json index 55cffbc..06b09a6 100644 --- a/custom_components/indego/manifest.json +++ b/custom_components/indego/manifest.json @@ -7,6 +7,6 @@ "codeowners": ["@jm-73", "@eavanvalkenburg", "@sander1988"], "requirements": ["pyIndego==3.2.2"], "iot_class": "cloud_push", - "version": "5.7.3", + "version": "5.7.4", "loggers": ["custom_components.indego", "pyIndego"] } diff --git a/custom_components/indego/translations/de.json b/custom_components/indego/translations/de.json index 39cea18..3078691 100644 --- a/custom_components/indego/translations/de.json +++ b/custom_components/indego/translations/de.json @@ -2,7 +2,7 @@ "config": { "abort": { "already_configured": "Dieser Bosch Indego Mähroboter wurde bereits konfiguriert!", - "connection_error": "Die Verbindung zur Bosch Indego API ist fehlgeschlagen!", + "connection_error": "Die Verbindung zur Bosch Indego API ist fehlgeschlagen! Please use the known issues page (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) for possible solutions.", "no_mowers_found": "In diesem Bosch Indego Account wurden keine Mähroboter gefunden!" }, "step": { @@ -12,7 +12,7 @@ "expose_mower": "Indego Mähroboter als Mower Entität in HomeAssistant anlegen", "expose_vacuum": "Indego Mähroboter als Vacuum Entität in HomeAssistant anlegen" }, - "description": "Erweiterte Einstellung des Bosch Indego Component. Kann für die meisten Benutzer unverändert gelassen werden." + "description": "Erweiterte Einstellung des Bosch Indego Component." }, "mower": { "data": { diff --git a/custom_components/indego/translations/en.json b/custom_components/indego/translations/en.json index 3d2092d..5af69b5 100644 --- a/custom_components/indego/translations/en.json +++ b/custom_components/indego/translations/en.json @@ -2,7 +2,7 @@ "config": { "abort": { "already_configured": "This Bosch Indego mower has already been configured!", - "connection_error": "The connection to the Bosch Indego API failed!", + "connection_error": "The connection to the Bosch Indego API failed! Please use the known issues page (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) for possible solutions.", "no_mowers_found": "No mowers found in this Bosch Indego account!" }, "step": { @@ -12,7 +12,7 @@ "expose_mower": "Expose Indego mower as mower entity in HomeAssistant", "expose_vacuum": "Expose Indego mower as vacuum entity in HomeAssistant" }, - "description": "Advanced settings of the Bosch Indego component. Can be left unchanged for most users." + "description": "Advanced settings of the Bosch Indego component." }, "mower": { "data": { diff --git a/custom_components/indego/translations/fr.json b/custom_components/indego/translations/fr.json index cbae814..bee7ad3 100644 --- a/custom_components/indego/translations/fr.json +++ b/custom_components/indego/translations/fr.json @@ -2,7 +2,7 @@ "config": { "abort": { "already_configured": "Cette tondeuse Bosch Indego a déjà été configurée !", - "connection_error": "La connexion à l'API Bosch Indego a échoué !", + "connection_error": "La connexion à l'API Bosch Indego a échoué ! Please use the known issues page (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) for possible solutions.", "no_mowers_found": "Aucune tondeuse n'a été trouvée sur ce compte Bosch Indego !" }, "step": { @@ -12,7 +12,7 @@ "expose_mower": "Exposer la tondeuse Indego comme une entité tondeuse dans HomeAssistant", "expose_vacuum": "Exposer la tondeuse Indego comme une entité aspirateur dans HomeAssistant" }, - "description": "Réglages avancés du composant Bosch Indego. Peuvent être laissés inchangés pour la plupart des utilisateurs." + "description": "Réglages avancés du composant Bosch Indego." }, "mower": { "data": { diff --git a/custom_components/indego/translations/nl.json b/custom_components/indego/translations/nl.json index f38e837..fe622b5 100644 --- a/custom_components/indego/translations/nl.json +++ b/custom_components/indego/translations/nl.json @@ -2,7 +2,7 @@ "config": { "abort": { "already_configured": "Deze Bosch Indego robotmaaier is al geconfigureerd!", - "connection_error": "De verbinding met de Bosch Indego API is mislukt!", + "connection_error": "De verbinding met de Bosch Indego API is mislukt! Gebruik de bekende problemen pagina (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) voor mogelijke oplossingen.", "no_mowers_found": "Geen robotmaaiers gevonden in deze Bosch Indego account!" }, "step": { @@ -12,7 +12,7 @@ "expose_mower": "Voeg de Indego robotmaaier toe als grasmaaier entiteit aan HomeAssistant", "expose_vacuum": "Voeg de Indego robotmaaier toe als stofzuiger entiteit aan HomeAssistant" }, - "description": "Advanced settings of the Bosch Indego component. Can be left unchanged for most users." + "description": "Geavanceerde instellingen van het Bosch Indego component." }, "mower": { "data": { diff --git a/custom_components/indego/translations/pl.json b/custom_components/indego/translations/pl.json index 52c4e8e..0003164 100644 --- a/custom_components/indego/translations/pl.json +++ b/custom_components/indego/translations/pl.json @@ -2,7 +2,7 @@ "config": { "abort": { "already_configured": "Ta kosiarka Bosch Indego została już wcześniej skonfigurowana!", - "connection_error": "Błąd połączenia z Bosch Indego API!", + "connection_error": "Błąd połączenia z Bosch Indego API! Please use the known issues page (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) for possible solutions.", "no_mowers_found": "Na tym koncie Bosch Indego nie znaleziono żadnej kosiarki!" }, "step": { @@ -12,7 +12,7 @@ "expose_mower": "Wyświetl kosiarkę Indego jako encję kosiarki w HomeAssistant", "expose_vacuum": "Wyświetl kosiarkę Indego jako encję odkurzacza w HomeAssistant" }, - "description": "Ustawienia zaawansowane komponentu Bosch Indego. Większość użytkowników może pozostawić je bez zmian." + "description": "Ustawienia zaawansowane komponentu Bosch Indego." }, "mower": { "data": {