InfiniTimeOrg / InfiniTimeOrg/InfiniTime

Incorrect temperature displayed when updating weather using GadgetBridge

Open
#1,786 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
3.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Verification
  • I searched for similar bug reports and found none was relevant.
What happened?

When the phone was displaying 25 degrees, the watch shows 20 degrees.

What should happen instead?

The watch should show the same temperature as the phone

Reproduction steps

Install InfiniTime 1.13, select PineTimeStyle, enable weather.
Install GadgetBridge, install TWFG, enable weather integration.
Refresh Weather.
Check temperature displayed on your phone
Check temperature displayed on your watch
Be disappointed they don't match.

More details?

I'm opening this issue because I'm not sure what the right solution is and it's entirely possible I've misunderstood something.

Currently, on each weather refresh, GB delivers 2 temperature values to the watch, the first is the current temperature with an expiry time of 6h, the 2nd is called 24h forecast, has an expiry of 24h, and is generated by adding the daily high and low temperatures together then dividing by 2, to give an average(ish) temperature for the day. Details here

The issue is that the watch has no way to know which of these 2 temperature values to pick, so it does so at random, more often than not it displays the wrong value.

My first instinct is to simply remove the 24h forecast from the data GB delivers to the watch, via a PR against GB to remove lines 779-804 of the above file. This means we will only have 1 temperature value in the timeline per timestamp which should mean that the watch shows the same current temperature as the phone. Hopefully we can then work towards handling longer forecast data by creating multiple events with separate timestamps and expiries so the temperature updates even without new data being supplied, but in the short term the temperature should display something somewhat valid for 6h, and if new data is received that will be displayed instead.

We could modify the getCurrentTemperature function to pick the entry which has a shorter expiry time, but that feels like working around the issue rather than fixing it. Whatever the solution we probably need to also modify this function to handle overlapping entries (if GB sends a 6h forecast every hour for example)

Version

1.13

Companion app

Gadgetbridge

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Gadgetbridge's PineTimeJFSupport.java lines 753-804 and the watch's getCurrentTemperature function, which are the entry points named in the report. Trace how current and 24-hour forecast values overlap, then verify with the listed InfiniTime 1.13 and Gadgetbridge weather-refresh steps that the watch displays the phone's current temperature.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.