Fenix 7 doesn't support Weather.getSunrise?

This work on my Venu (simulator and real watch)

var sunrise = Weather.getSunrise(myLocation, now);

But gives

Error: Symbol Not Found Error
Details: Could not find symbol 'getSunrise'

On a simulated Fenix 7.

Anybody know why? I did restart the simulator and I do check for 'Toybox has :Weather' beforehand but the Fenix 7 with its API at 4.0 should contain it anyway and I'm using ConnectIQ 4.1.2

Thanks

  • Weater.getSunrise() and Weather.getSunset() require the device has CIQ 4.1.x or 3.3.x (System 5).  In the sim, it's only 4.0.x

  • Hmm. so why do they work on my Venu? It's at API 3.2

    This is what I get with debugging code. It shows it does work (in both simulator and real watch) on my Venu

    9:11:55 : Does support Weather

    9:11:55 : At=9 9:03:47
    9:11:55 : Sunrise=9 6:29:03
    9:11:55 : Sunset=9 19:39:37
    9:11:55 : Since sunrise -9284
    9:11:55 : Since sunset -38150

    The code:

    var weather = Weather.getCurrentConditions();
    var result;
    if (weather != null) {
        var myLocation = weather.observationLocationPosition;
        var now = weather.observationTime;
        var sunrise = Weather.getSunrise(myLocation, now);
        var sunset = Weather.getSunset(myLocation, now);
        var sinceSunrise = sunrise.compare(now);
        var sinceSunset = now.compare(sunset);

        var nowtime = Gregorian.info(now, Time.FORMAT_MEDIUM);
        var nowStr = nowtime.day + " " + nowtime.hour + ":" + nowtime.min.format("%02d") + ":" + nowtime.sec.format("%02d");
        var sunrisetime = Gregorian.info(sunrise, Time.FORMAT_MEDIUM);
        var sunsettime = Gregorian.info(sunset, Time.FORMAT_MEDIUM);
        var sunriseStr = sunrisetime.day + " " + sunrisetime.hour + ":" + sunrisetime.min.format("%02d") + ":" + sunrisetime.sec.format("%02d");
        var sunsetStr = sunsettime.day + " " + sunsettime.hour + ":" + sunsettime.min.format("%02d") + ":" + sunsettime.sec.format("%02d");
        logMessage("At=" + nowStr);
        logMessage("Sunrise=" + sunriseStr);
        logMessage("Sunset=" + sunsetStr);
        logMessage("Since sunrise " + sinceSunrise);
        logMessage("Since sunset " + sinceSunset);
    }

  • The venu in devices for the sim has 3.3 so it's available there. The sim thinks the f7 is 4.0 and not 4.1 so it doesn't work there.

    You want to do a has for weather and then a has for getSunrise

  • Still doesn't explain why it's working on my real watch though. I'll do the check for getSunrise. Thanks.

  • probably because you installed the beta which upgrade your device to 4.1.x, but it is a beta not an official released, at this time for everyone F7 is 4.0.x

  • No, I didn't install the Beta. I'm at 6.80

    This was taken directly from the LOGS/TXT file from the watch

    12:36:19 : Using Garmin Weather
    12:36:19 : At=9 12:31:08
    12:36:19 : Sunrise=9 6:29:03
    12:36:19 : Sunset=9 19:39:37
    12:36:19 : Since sunrize -21725
    12:36:19 : Since sunset -25709

  • Because the watch has FW with "System 5" and it's only a beta version.  The sim device haven't been updated yet.

    Also, understand that in the case of APAC variations, they can be a month or two behind the world wide version and without the extra has check, your app will crash on them.

  • I was giving the option to use the Garmin Weather API instead of the relying on OpenWeatherMap in the Crystal watch face for weather display but now, with all the different conditions to check for and use of other code to get sunset/sunrise, it will probably increase the background process to something over its space limit (it was already close). Since the Garmin Weather stuff doesn't need to run in the background process like the OpenWeatherMap does, I'll see if I can move that code away from the background process and leave the OpenWeatherMap code alone, except for a test to see if the OpenWeatherMap key has been set. Back to the drawing board then. Too bad, it was working great on my Venu.

    Thanks again.

  • and it will work well as soon as device will get system 5.

    for sun event, I use cutsom calculation to get it so that if you don't have internet you can have it AND you can change the angle as you which (to get for exemple Dusk/Dawn instead of sunrise/sunset which is not provided by Weather module).

  • How would you query for has :getSunrise ? I tried

    if (Toybox has :Weather && Toybox has :Weather.getSunrise)

    and it aborts at compile with getSunrise not found and

    if (Toybox has :Weather && Toybox has :getSunrise)

    Compiles but doesn't go in on my Venu (in the simulator) although the function runs.

    Sorry for all the questions.