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

Extend Gadgetbridge Support #135

Open
datacute opened this issue Oct 23, 2020 · 6 comments
Open

Extend Gadgetbridge Support #135

datacute opened this issue Oct 23, 2020 · 6 comments
Labels

Comments

@datacute
Copy link
Collaborator

Since we're pretending to be an Espruino Bangle.js ... the message formats that we can support are documented here:
https://www.espruino.com/Gadgetbridge
There are a few that are not yet supported that could be added:

  1. "find" - we could turn on the screen, show a page that allows clicking to say you've found the watch, vibrate and make noise - depending on various existing config settings (e.g. don't make noise if sound is turned off, don't vibrate if the motor is turned off).
  2. "alarm" - we could support configuring the alarm
  3. "weather" (I haven't seen my android phone send this to my watch - does it require another phone app?) - we could supply weather details to show.
@jakub-vesely
Copy link
Contributor

Unfortunately, Bangle.js format does not fit My-TTGO-Watch functionality fully. It is possibleto set an alarm including days of week in Gadgetbridge but the information about days of week is not transferred by Bangle.js BLE messages. I also did not find a way how to send alarm clock values back to Gadgetbridge via Bangle.js BLE protocol.

From my point of view, does not make sense a lot to implement alarm setting for Gadgetbridge because it newer will work properly.

Do anyone have an idea how many effort would be to implement and add own communication protocol to Gadgetbridge to we be able to transfer what we want?

@datacute
Copy link
Collaborator Author

Here are some example find messages:
msg: {"t":"find","n":true}
msg: {"t":"find","n":false}

I see what you mean about the lack of which day(s) the alarm is for:
msg: {"t":"alarm","d":[{"h":18,"m":14}]}
msg: {"t":"alarm","d":[{"h":18,"m":14},{"h":6,"m":30}]}

Weather example, with "Weather notification" app installed:
https://f-droid.org/en/packages/ru.gelin.android.weather.notification/
msg: {"t":"weather","temp":293,"hum":28,"txt":"Sky is clear","wind":18,"wdir":68,"loc":"Christchurch"}
This needs a bit of conversion, especially determining which icon to show.
Unfortunately "Sky is clear" is not one of these texts:
https://openweathermap.org/weather-conditions

@Neuroplant
Copy link
Contributor

Neuroplant commented Nov 18, 2020

Do you think of something like this?
FindPhone.zip
(still not ready for Beta, but shows the concept)

Update: Created an App "FindPhone"
it can be found in the Fork https://github.com/Neuroplant/My-TTGO-Watch-1 or as seperate App in https://github.com/Neuroplant/My-TTGO-Watch_FindPhoneApp.

Functionality:

  • Bluetooth connection between Phone and Watch has to be established.
  • Searching for Watch; can be initiated from Gadgetbridge-App on Phone.
  • Searching for Phone: open App, poke on Eye to start Search, poke again to stopp.

Please be so kind and test it.

Neuroplant

@guyou guyou mentioned this issue Feb 14, 2021
3 tasks
@Crsarmv7l
Copy link

Crsarmv7l commented Aug 21, 2021

Here are some example find messages:
msg: {"t":"find","n":true}
msg: {"t":"find","n":false}

I see what you mean about the lack of which day(s) the alarm is for:
msg: {"t":"alarm","d":[{"h":18,"m":14}]}
msg: {"t":"alarm","d":[{"h":18,"m":14},{"h":6,"m":30}]}

Weather example, with "Weather notification" app installed:
https://f-droid.org/en/packages/ru.gelin.android.weather.notification/
msg: {"t":"weather","temp":293,"hum":28,"txt":"Sky is clear","wind":18,"wdir":68,"loc":"Christchurch"}
This needs a bit of conversion, especially determining which icon to show.
Unfortunately "Sky is clear" is not one of these texts:
https://openweathermap.org/weather-conditions

Ahh gadgetbridge weather was exactly what I was trying to do. Even just as words like this:

   `80F
Clear sky`

I cant find where in the src ble messages are parsed or I would write weather msgs to SPIFF then display them under the watch face.

@Crsarmv7l
Copy link

Crsarmv7l commented Aug 21, 2021

Not exactly what I was looking for, but src/gui/mainbar/setup_tile/bluetooth_settings/bluetooth_message.cpp
Has a check for if a message is a "notify" message. Here:
if( !strcmp( doc["t"], "notify" ) ) {

Might be able to modify that and the "body" parsing throughout for weather messages to display as a message on update. Not pretty but it could work.

Edit: My C++ is poor but I may have found a way to make it work still. Compiling and testing soon

@Crsarmv7l
Copy link

Crsarmv7l commented Jan 24, 2022

@sharandac @d03n3rfr1tz3

Not sure if you would be interested in this given you have the weather app, but I wanted to create this so I wouldn't have to use wifi. It resolves current weather and generates a weather widget based on BLE weather messages from Gadgetbridge (or in my case Amazfish). Both night and day icons work, night is (h < 7 || h > 18) based on the message timestamp.

If there is some difference in the weather descriptors sent by Gadgetbridge vice Amazfish it should be trivial to change the src_icon phrase to match.

I basically just expanded on some of the tools already in place in bluetooth_messages.cpp and slightly modified bluetooth_messages.h to account for longer weather descriptors. It doesn't interfere with normal BLE messages either (with amazfish).

20220124_214755

20220121_130848

20220121_130819

Give it a try and include it in your project if you want to. Its a straight swap with these two files.

One big issue does remain: The messages get grabbed up in the message chain, which displays the most current message first. If you delete the weather messages newest to earliest the widget will end up displaying the earliest weather. To keep it accurate you have to delete earliest to newest. I haven't come up with a way to prevent that aside from splitting it out of the message chain. It is not an issue if you delete them as they come in, which I do.

I started a pull a bit ago but I am terrible with github.

bluetooth_message.zip

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

No branches or pull requests

4 participants