Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to consult weather data after device went offline #57

Closed
neilswann80 opened this issue Oct 10, 2023 · 13 comments
Closed

Impossible to consult weather data after device went offline #57

neilswann80 opened this issue Oct 10, 2023 · 13 comments
Labels
enhancement New feature or request

Comments

@neilswann80
Copy link

neilswann80 commented Oct 10, 2023

The current date/time is still written as if the update succeeded, but obviously no weather data is shown.

Do you think it's worth storing the last successful data payload received to show (rather than a blank screen) in this scenario?

Would be useful to be able to look at the 8-day forecast again when away from the internet.

@neilswann80 neilswann80 changed the title If app launched without internet last update date/time still written If app launched without internet last update date/time (current) still written Oct 10, 2023
@orontee
Copy link
Owner

orontee commented Oct 10, 2023 via email

@neilswann80
Copy link
Author

Ah, I see.

So showing the last successful weather payload with the associated date/time would be to much of a deviation from the current code, overcomplicated etc.

@orontee
Copy link
Owner

orontee commented Oct 10, 2023

Would be useful to be able to look at the 8-day forecast again when away from the internet

Good point.

But it should be already possible with current implementation (apart from automatic refresh that happens once per hour).

@neilswann80 Are you "quitting" the application using menu or just putting it in the background using the home key?

In other words do you want the application to dump all the weather data, in order to find them after a restart?

Plan:

  • Check that data refresh is triggered by location, units or language changes or hourly timer only
  • Configuration setting to disable timer (should be the default, this timer isn't that useful)

@neilswann80
Copy link
Author

But it should be already possible with current implementation (apart from automatic refresh that happens once per hour).

@neilswann80 Are you "quitting" the application using menu or just putting it in the background using the home key?

It's fine if I leave Taranis in the background, but if I exit the app, or if the device (is set to) powers off automatically the app then needs to be launched again.

In other words do you want the application to dump all the weather data, in order to find them after a restart?

I think this could be a useful feature when travelling/commuting and temporarily away from the internet. If the date/time correlates to this "last successful" update it shouldn't cause confusion.

@orontee
Copy link
Owner

orontee commented Oct 10, 2023

I think this could be a useful feature when travelling/commuting and temporarily away from the internet. If the date/time correlates to this "last successful" update it shouldn't cause confusion.

I understand.

There's no difficulties to implement dump/restore of all model data now that we already have the infrastructure to do it for the location history.

But, at startup, when the application is initialized, there's an unconditional refresh that is triggered; See: https://github.com/orontee/taranis/blob/main/src/app.cc#L86

With the use case you mention, one want to skip this. On what basis? Configuration?

What do you think of a new three state configuration setting, say weather_data_refresh_mode, with possible values manual, startup and hourly?

When equal to manual this would allow to skip the refresh triggered at startup and only keep the automatic refresh triggered by unit or language changes...

hourly would be current behavior. startup would disable the timer.

@neilswann80
Copy link
Author

Tricky. I do like the autorefresh option.

Would it be feasible to launch the app with autorefresh disabled and only enable it after testing for internet?

@orontee
Copy link
Owner

orontee commented Oct 10, 2023

At current time, each request to refresh weather data or set new location tries to ensure that the device is connected to Internet. See https://github.com/orontee/taranis/blob/main/src/http.cc#L26

In order to cover the "disconnected" use case, we could:

  1. Introduce of a new boolean configuration, say preserve_offline, that will skip weather data refresh when equal to true and there's no Internet connection.
  2. Dump whole model to application state when exiting, and restore when starting

In your use case, preserve_offline will be set to true. If the device is connected to Internet everything works as we're used to, but if it's not then weather data refresh will be no-ops and you'll be able to consult last fetched data.

Editing the location, will still try to connect the device: It's then up to the user to accept or not.

@neilswann80 What do you think?

@neilswann80
Copy link
Author

Sounds great to me.

@orontee orontee added the enhancement New feature or request label Oct 10, 2023
@orontee orontee changed the title If app launched without internet last update date/time (current) still written Impossible to consult weather data after device went offline Oct 10, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
orontee added a commit that referenced this issue Oct 11, 2023
@orontee
Copy link
Owner

orontee commented Oct 11, 2023

Experimenting the preserve_offline configuration. Looks ok to me, lets live with this for a few days...

orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
@orontee
Copy link
Owner

orontee commented Oct 13, 2023

...But I just realized that managing a configuration parameter for this is not necessary. Devices have a "flight mode": With last commit on this branch, the application dump/restore the weather data at exit/startup and won't try to refresh weather data when device has flight mode enabled.

I am convinced it's the right "user interface".

Summary:

  • At application startup, model is restored, a refresh is requested but nothing is updated if flight mode is enabled
  • When user select "Refresh data" in menu or the refresh timer is triggered, a refresh is requested but nothing is updated if flight mode is enabled or device is not connected and user cancel wifi activation
  • When configuration or model changes (user change language, unit system or choose new location), the displayed data doesn't match the configuration or model, thus a refresh is requested and, if flight mode is enabled, the user is warned and display is cleared
  • When application exit, model is dumped

orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
@orontee orontee closed this as completed Oct 13, 2023
orontee added a commit that referenced this issue Oct 13, 2023
@orontee orontee added this to the New year version milestone Oct 13, 2023
@orontee
Copy link
Owner

orontee commented Oct 13, 2023

Available in pre-release : https://github.com/orontee/taranis/releases/tag/v1.3.0-rc0

@neilswann80
Copy link
Author

neilswann80 commented Oct 14, 2023

Tested and loving it! 👍

Noticed a slight issue though:

When flightmode is enabled, the "last updated" date/time is correct for the dump. ✔️

BUT if flightmode is disabled, WIFI disabled and you click "cancel" to the WIFI activation message the date/time eventually updates to current rather than remaining as the correct one for the dump. ❌

@orontee
Copy link
Owner

orontee commented Oct 14, 2023

Tested and loving it! 👍

Thanks for your feedback Swanny!

Noticed a slight issue though:

When flightmode is enabled, the "last updated" date/time is correct for the dump. ✔️

BUT if flightmode is disabled, WIFI disabled and you click "cancel" to the WIFI activation message the date/time eventually updates to current rather than remaining as the correct one for the dump. ❌

Good catch!

Should be fixed in https://github.com/orontee/taranis/releases/tag/v1.3.0-rc1

orontee added a commit that referenced this issue Oct 14, 2023
orontee added a commit that referenced this issue Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants