Skip to content

Commit

Permalink
Bugfixes (#65)
Browse files Browse the repository at this point in the history
* Schedule refresh fix attempt

* en.json: Make it explicit that imperial means miles

* Disable imperial distance units toggle in options flow

---------

Co-authored-by: Sam Reed <sam@reedyboy.net>
  • Loading branch information
dan-r and reedy authored Oct 24, 2024
1 parent f4544fc commit 2ed6a70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions custom_components/nissan_connect/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ async def async_step_init(self, options):
vol.Required(
"interval_statistics", default=self._config_entry.data.get("interval_statistics", DEFAULT_INTERVAL_STATISTICS)
): int,
vol.Required(
"imperial_distance", default=self._config_entry.data.get("imperial_distance", False)): bool
# Excluded from config flow under #61
# vol.Required(
# "imperial_distance", default=self._config_entry.data.get("imperial_distance", False)): bool
}), errors=errors
)
3 changes: 3 additions & 0 deletions custom_components/nissan_connect/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def set_next_interval(self):
if interval != (self.update_interval.seconds / 60):
_LOGGER.debug(f"Changing next update interval to {interval} minutes")
self.update_interval = timedelta(minutes=interval)
self._async_unsub_refresh()
if self._listeners:
self._schedule_refresh()

async def _async_update_data(self):
"""Fetch data from API."""
Expand Down
4 changes: 2 additions & 2 deletions custom_components/nissan_connect/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"interval_statistics": "Update interval for daily/monthly statistics (minutes)",
"interval_fetch": "Update interval (minutes)",
"region": "Region (EU, US)",
"imperial_distance": "Use imperial distance units"
"imperial_distance": "Use imperial distance units (miles)"
},
"data_description": {
"interval_charging": "The car will be woken up and new data requested at every polling interval.",
Expand All @@ -37,7 +37,7 @@
"interval_charging": "Polling interval while charging (minutes)",
"interval_statistics": "Update interval for daily/monthly statistics (minutes)",
"interval_fetch": "Update interval (minutes)",
"imperial_distance": "Use imperial distance units"
"imperial_distance": "Use imperial distance units (miles)"
},
"data_description": {
"password": "If you are not changing your credentials, leave the password field empty.",
Expand Down

0 comments on commit 2ed6a70

Please sign in to comment.