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

Watchface: complication consumer/rendering support #11

Open
rahim opened this issue Mar 20, 2019 · 5 comments
Open

Watchface: complication consumer/rendering support #11

rahim opened this issue Mar 20, 2019 · 5 comments

Comments

@rahim
Copy link
Owner

rahim commented Mar 20, 2019

We already have a complication provider for including nightscout data in other watch faces, but we don't allow adding other complications to our watch face.

https://developer.android.com/training/wearables/watch-faces/adding-complications

@rahim rahim changed the title Complication consumer/rendering support Watchface: complication consumer/rendering support Mar 2, 2020
@Npavkov
Copy link

Npavkov commented Oct 15, 2023

Rahim, is there a way to make nightwear watchface update every minute?

@rahim
Copy link
Owner Author

rahim commented Oct 16, 2023

Rahim, is there a way to make nightwear watchface update every minute?

@Npavkov do you mean the complication or the watch face? (I can't tell whether the issue you've commented on has relevance to your question?)

Trying to answer both though: the complication is limited by constraints placed on it by Wear OS to preserve battery.

you must use a value of at least 300 (5 minutes), which is the minimum update period that the system enforces, to preserve device battery life
from https://developer.android.com/training/wearables/tiles/exposing-data-complications#meta-data

The service that pulls data from NightScout and that feeds the watch face tries quite aggressively to retrieve new data, more often than every minute if the latest reading we have is older than 5 minutes.

fun refresh(force: Boolean = false) {
Log.d(tag, "Refresh, latest reading age: " + latestReadingAge().seconds)
if (nightscoutBaseUrl == "") return
// remember: the lastReadingAge is not when we last successfully received a response
// the reading age reflects the last sensor reading we're aware of, that means:
// - it can grow if we've not made successful API requests (eg no net connection available)
// - it can grow if the sensor is not reporting or is in warm up
// - it can grow if the collector is unable to push to Share or NightScout
// - it can grow if NightScout is unable to pull from Share
if (!force && latestReadingAge() < SENSOR_REFRESH_INTERVAL) {
Log.d(tag, "Latest reading too fresh and force not set, returning without refresh")
return
}
// don't make requests more than once every 30s
if (Duration.between(lastRequestAdded, Instant.now()) < Duration.ofSeconds(30)) return

That's based on an underlying assumption that the sensor isn't providing readings more often than every 5 minutes.

@Npavkov
Copy link

Npavkov commented Oct 17, 2023 via email

@rahim
Copy link
Owner Author

rahim commented Oct 17, 2023

Rahim, my sensor does provide readings every minute.

That's interesting, I'd love to hear what sensor you're using.

Your suggestions are best opened as their own separate issues. Realistically you're unlikely to see these addressed by me anytime soon, I'm not finding time for new feature work for this project.

My intention was always that there would be alternate watch faces providing different aesthetics or servicing different needs (high up my list was a child friendly watch face). The project is structured in a way that it should be achievable for most developers to create their own custom nightscout connected watch faces, I'd hoped I might see some pull requests where these were likely to be useful to more users, but so far that's not happened.

@Npavkov
Copy link

Npavkov commented Oct 17, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants