Skip to content

Commit

Permalink
Merge pull request #248 from sander1988/develop
Browse files Browse the repository at this point in the history
develop > master for v5.7.5 release
  • Loading branch information
sander1988 authored Aug 16, 2024
2 parents f12b96d + 3a7532f commit 9d23c96
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
50 changes: 23 additions & 27 deletions custom_components/indego/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def FUNC_ICON_MOWER_ALERT(state):
CONF_DEVICE_CLASS: None,
CONF_UNIT_OF_MEASUREMENT: None,
CONF_ATTR: ["last_updated"],
CONF_TRANSLATION_KEY: "mower_state",
},
ENTITY_MOWER_STATE_DETAIL: {
CONF_TYPE: SENSOR_TYPE,
Expand All @@ -120,6 +121,7 @@ def FUNC_ICON_MOWER_ALERT(state):
"state_number",
"state_description",
],
CONF_TRANSLATION_KEY: "mower_state_detail",
},
ENTITY_BATTERY: {
CONF_TYPE: SENSOR_TYPE,
Expand Down Expand Up @@ -196,6 +198,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, {})
Expand Down Expand Up @@ -640,9 +652,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,
Expand Down Expand Up @@ -685,27 +695,21 @@ 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,
}
)

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,
Expand Down Expand Up @@ -749,7 +753,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
)
Expand All @@ -760,7 +764,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

Expand Down Expand Up @@ -791,19 +795,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)
}
)

Expand All @@ -813,12 +807,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
Expand Down
4 changes: 2 additions & 2 deletions custom_components/indego/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"documentation": "https://github.com/sander1988/Indego",
"dependencies": ["application_credentials"],
"codeowners": ["@jm-73", "@eavanvalkenburg", "@sander1988"],
"requirements": ["pyIndego==3.2.1"],
"requirements": ["pyIndego==3.2.2"],
"iot_class": "cloud_push",
"version": "5.7.3",
"version": "5.7.5",
"loggers": ["custom_components.indego", "pyIndego"]
}
53 changes: 50 additions & 3 deletions custom_components/indego/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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! Bitte die Known Issues Seite (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) für möglche Lösungen nutzen.",
"no_mowers_found": "In diesem Bosch Indego Account wurden keine Mähroboter gefunden!"
},
"step": {
Expand All @@ -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": {
Expand Down Expand Up @@ -62,6 +62,53 @@
}
}
}
},
"sensor": {
"mower_state": {
"state": {
"Mowing": "Mähen",
"Docked": "Angedockt",
"Sleeping": "Schläft",
"Paused": "Pausiert"
}
},
"mower_state_detail": {
"state": {
"Sleeping": "Schläft",
"Reading status": "Status abrufen",
"Charging": "Laden",
"Docked": "Angedockt",
"Sleeping": "Schläft",
"Docked - Software update": "Angedockt - Software Update",
"Docked - Loading map": "Angedockt - Karte laden",
"Docked - Saving map": "Angedockt - Karte speichern",
"Docked - Leaving Dock": "Angedockt - Verlässt Ladestation",
"Mowing": "Mähen",
"Mowing - Relocalising": "Mähen - Position bestimmen",
"Mowing - Learning Lawn": "Mähen - Karte lernen",
"Mowing - Learning Lawn paused": "Mähen - Karte lernen pausiert",
"SpotMow": "SpotMow",
"Mowing randomly": "Zufälliges Mähen",
"Diagnostic mode": "Diagnose Modus",
"End of life": "Lebensende",
"Software update": "Software Update",
"Energy save mode": "Energiesparmodus",
"Relocalising": "Position bestimmen",
"Loading map": "Karte laden",
"Learning lawn": "Karte lernen",
"Paused": "Pausiert",
"Border cut": "Kantenmähen",
"Idle in lawn": "Leerlauf",
"Stuck on lawn, help needed": "Festgefahren, Hilfe nötig",
"Returning to Dock": "Zurück zur Ladestation",
"Returning to Dock - Battery low": "Zurück zur Ladestation - Batteriestand niedrig",
"Returning to dock - Calendar timeslot ended": "Zurück zur Ladestation - Kalender Zeitfenser zu Ende",
"Returning to dock - Battery temp range": "Zurück zur Ladestation - Batterie Temperaturfenster",
"Returning to dock - Lawn complete": "Zurück zur Ladestation - Rasen vollständig gemäht",
"Returning to dock - Relocalising": "Zurück zur Ladestation - Position bestimmen",
"Returning to dock - requested by user/app": "Zurück zur Ladestation - Angefordert vom Benutzer"
}
}
}
},
"services": {
Expand Down Expand Up @@ -126,4 +173,4 @@
}
}
}
}
}
4 changes: 2 additions & 2 deletions custom_components/indego/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
50 changes: 48 additions & 2 deletions custom_components/indego/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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é ! Regardez la page des problèmes connus (https://github.com/sander1988/Indego?tab=readme-ov-file#known-issues) pour trouver une solution éventuelle.",
"no_mowers_found": "Aucune tondeuse n'a été trouvée sur ce compte Bosch Indego !"
},
"step": {
Expand Down Expand Up @@ -62,6 +62,52 @@
}
}
}
},
"sensor": {
"mower_state": {
"state": {
"Mowing": "Tonte en cours",
"Docked": "Dans station de charge",
"Sleeping": "En veille",
"Paused": "En pause"
}
},
"mower_state_detail": {
"state": {
"Sleeping": "En veille",
"Reading status": "Obtention du statut en cours",
"Charging": "Charge en cours",
"Docked": "Dans station de charge",
"Docked - Software update": "Dans station de charge - Mise à jour du logiciel",
"Docked - Loading map": "Dans station de charge - Chargement carte",
"Docked - Saving map": "Dans station de charge - Enregistrement carte",
"Docked - Leaving Dock": "Dans station de charge - Quitte la station",
"Mowing": "Tonte en cours",
"Mowing - Relocalising": "Tonte en cours - Cherche position",
"Mowing - Learning Lawn": "Tonte en cours - Apprentissage de la pelouse",
"Mowing - Learning Lawn paused": "Tonte en cours - Apprentissage de la pelouse en pause",
"SpotMow": "SpotMow",
"Mowing randomly": "Tonte aléatoire",
"Diagnostic mode": "Mode diagnostic",
"End of life": "Fin de vie",
"Software update": "Mise à jour du logiciel",
"Energy save mode": "Mode économie d'énergie",
"Relocalising": "Cherche position",
"Loading map": "Chargement carte",
"Learning lawn": "Apprentissage de la pelouse",
"Paused": "En pause",
"Border cut": "Tonte des bords",
"Idle in lawn": "Immobilisée sur pelouse",
"Stuck on lawn, help needed": "Bloquée sur pelouse, intervention nécessaire",
"Returning to Dock": "Retour à la station",
"Returning to Dock - Battery low": "Retour à la station - Batterie faible",
"Returning to dock - Calendar timeslot ended": "Retour à la station - Fin de créneau agenda",
"Returning to dock - Battery temp range": "Retour à la station - Température batterie hors tolérances",
"Returning to dock - Lawn complete": "Retour à la station - Pelouse terminée",
"Returning to dock - Relocalising": "Retour à la station - Cherche position",
"Returning to dock - requested by user/app": "Retour à la station - Demandé par l'utilisateur"
}
}
}
},
"services": {
Expand Down Expand Up @@ -126,4 +172,4 @@
}
}
}
}
}
52 changes: 49 additions & 3 deletions custom_components/indego/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down Expand Up @@ -62,6 +62,52 @@
}
}
}
},
"sensor": {
"mower_state": {
"state": {
"Mowing": "Maaien",
"Docked": "Geparkeerd",
"Sleeping": "Inactief",
"Paused": "Gepauzeerd"
}
},
"mower_state_detail": {
"state": {
"Sleeping": "Inactief",
"Reading status": "Status ophalen",
"Charging": "Opladen",
"Docked": "Geparkeerd",
"Docked - Software update": "Geparkeerd - Software update",
"Docked - Loading map": "Geparkeerd - Map laden",
"Docked - Saving map": "Geparkeerd - Map opslaan",
"Docked - Leaving Dock": "Station verlaten",
"Mowing": "Maaien",
"Mowing - Relocalising": "Maaien - Herlokaliseren",
"Mowing - Learning Lawn": "Maaien - Gazon leren",
"Mowing - Learning Lawn paused": "Maaien - Gazon leren gepauzeerd",
"SpotMow": "Plek maaien",
"Mowing randomly": "Willekeurig maaien",
"Diagnostic mode": "Onderhoudsmodus",
"End of life": "Geen ondersteuning (EOL)",
"Software update": "Software update",
"Energy save mode": "Energiespaarstand",
"Relocalising": "Herlokaliseren",
"Loading map": "Map laden map",
"Learning lawn": "Gazon leren",
"Paused": "Gepauzeerd",
"Border cut": "Rand maaien",
"Idle in lawn": "Inactief op gazon",
"Stuck on lawn, help needed": "Vastgelopen op gazon, hulp nodig",
"Returning to Dock": "Terugkeren naar basisstation",
"Returning to Dock - Battery low": "Terugkeren naar basisstation - Batterij bijna leeg",
"Returning to dock - Calendar timeslot ended": "Terugkeren naar basisstation - Kalender tijdslot eindigd",
"Returning to dock - Battery temp range": "Terugkeren naar basisstation - Batterij temperatuur",
"Returning to dock - Lawn complete": "Terugkeren naar basisstation - Maaien voltooid",
"Returning to dock - Relocalising": "Terugkeren naar basisstation - Herlokaliseren",
"Returning to dock - requested by user/app": "Terugkeren naar basisstation - verzocht door gebruiker"
}
}
}
},
"services": {
Expand Down Expand Up @@ -126,4 +172,4 @@
}
}
}
}
}
Loading

0 comments on commit 9d23c96

Please sign in to comment.