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

Unmatched time, hourly buzz issues #116

Open
ysy5700 opened this issue Apr 19, 2022 · 42 comments
Open

Unmatched time, hourly buzz issues #116

ysy5700 opened this issue Apr 19, 2022 · 42 comments

Comments

@ysy5700
Copy link

ysy5700 commented Apr 19, 2022

Hello Pierre and @mariofrei,

I've sent the support request on Slack since I couldn't get the valid dataset from the newly updated questionnaires on Fitbit.

The problem that I confronted are as follows:

  • Unmatched timezone: in Kaggle, the timezone is set as Asia/Singapore -- can we change it to my time zone (Europe/Switzerland)? GMT+2
  • API -- Do I need to set up a new API to get my data response?
  • Limited data responses: I built new 16 questions but after finishing the feedback, I can only see 3 responses from 3 questions. -- how I can fix this to get the full response?
  • Buzz time: hourly buzz setup in OS simulator doesn't seem to work - Is any other solution for this?

Thanks and I look forward to your quick support :)

Best wishes,
Seoyeon

@mariofrei
Copy link
Collaborator

mariofrei commented Apr 19, 2022

Hi Seoyeon,

Timezone
You probably want to use 'Etc/GMT+2' instead of 'Asia/Singapore'.
You can get a list of all available timezones with the following bit of python code:

import pytz
 
for tz in pytz.all_timezones:
  print(tz)

API & Limited data responses
There shouldn't be a need for a new API.
Could you provide the file with new questions?
I will then check in the database if there is something similar there.

Buzz time
I think that has never properly worked on the Versa 2.
@pierre do you have time to look into this issue?

@ysy5700
Copy link
Author

ysy5700 commented Apr 19, 2022

Thanks @mariofrei.
Indeed, the time is not matching after changing to Etc/GMT+2. It shows 6-7 am instead of 14 pm. (below image)
image

Here I attached the new question file (in the folder of resources>flows>activity-flow.js)
Please have a look and let me know why the kaggle doesn't show all responses.

activity-flow.txt

And plus, I've noticed that I cannot publish the app.fba file on the https://gam.fitbit.com/
It shows that app ID already exists. Do you think I need to change the file name? (In this case, I need to change some other lines in the cozie folder right?)

Thanks for helping me.

@mariofrei
Copy link
Collaborator

mariofrei commented Apr 19, 2022

Limited data responses
I could find all answers from your question flow file (activity-flow.txt) plus the response to a question named posture.
I think you switched experimentid and userid,
The following line works for me:

payload = {'experiment-id': 'hobel02', 'weeks': '30', 'user-id': 'hobel'}

I'd suggest to use "hobel02" as userid and "hobel" as experimentid in the future.

App ID
I think you just need to replace the id in package.json with the one generated under your Fitbit account.
PJ shows how to do it here: https://youtu.be/5JaCrZBZbt0?t=91

Timezone
Maybe 'Europe/Zurich' works better for you.

@ysy5700
Copy link
Author

ysy5700 commented Apr 19, 2022

Thanks Mario, Limited data responses/Timezone issues are solved now.

However, I can actually see that package.json file shows the right App ID: 1ef995a9-ca67-4e76-b2c4-5d650a644c97
image

But I cannot publish it in the https://gam.fitbit.com it says "app id already in use".
This publishing is that I have 3 extra fitbit watches which I would like to use the same clockface (that I created).
image

Do you have any other solutions?
I've logged into gam.fitbit.com with the userID/PW same as on the paired fitbit.

@ysy5700
Copy link
Author

ysy5700 commented Apr 19, 2022

Hello @mariofrei I think I found the issues
When I find my App UUID in the fitbit gallery I can see this is already used by Federico.
https://gallery.fitbit.com/details/1ef995a9-ca67-4e76-b2c4-5d650a644c97

How I can publish my own app UUID?

@ThePebblesFr
Copy link
Collaborator

Hi Seoyeon,

Buzz Time
I believe that this feature has not been working on any version of the code, I am working on it.

@mariofrei
Copy link
Collaborator

Hi Seoyeon,
When you create a new clockface on gam.fitbit.com a new ID should be assigned. That's your ID. You need to take that ID and copy it into your package.json file. The ID that is currently in the package.json file is there because Federico did the same before for his clockface.

@ThePebblesFr
Copy link
Collaborator

I fixed the issue with the Buzz Time and pushed it to the cozie-researcher branch.

Seoyeon, if you need help to get the version without buzzer issue, let me know.

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

@ThePebblesFr Thanks Pierre, could you help me to apply the buzz time from cozie-researcher to HOBEL branch? Which file that I need to patch? Could you give the step-by-step instruction on that? I don't want to erase essential files on my branch.

My branch is named as "HOBEL", you're welcomed to have a look. Thanks,

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

@mariofrei
Do you think the developer ID is the new ID that I'm assigned? Actually I don't have the same webpage like PJ had on the youtube. (https://youtu.be/5JaCrZBZbt0?t=91)
image

If this developer ID is the one that I need to copy/paste into the package.json file, I do it after your checking. Thanks!

@mariofrei
Copy link
Collaborator

I think the developer ID is the new ID assigned to the clockface.
At least according to this: https://community.fitbit.com/t5/SDK-Development/Invalid-UUID/td-p/4319171

@ThePebblesFr
Copy link
Collaborator

ThePebblesFr commented Apr 20, 2022

Would you be able to give me the link of your branch? Because, tell me if I am wrong, but there is no branch named "HOBEL" in this repo.

By the way, to fix the buzzer issues, I think that the only part of the code you have to change is in the index.js file, in the BUZZER SELECTOR part of the code. The setInterval function must be like this:

`
const currentDate = new Date(); // get today's date
const currentDay = currentDate.getDay(); // get today's day
const currentHour = currentDate.getHours();

console.log("starting to evaluate whether the watch need to vibrate or not");

try {
    const buzzSelection = parseInt(fs.readFileSync("buzzSelection.txt", "json").buzzSelection); // read user selection
    vibrationTimeArray = buzzOptions[buzzSelection];
} catch (e) {
    console.log("Could not open the file buzzSelection.txt");
    console.log(e);
    if (!isProduction) {
        bodyErrorLabel.text = bodyErrorLabel.text + "Vibration : " + e;
    }
}

if (currentDay !== startDay) { // if it is a new day check user
    startDay = currentDay;
    completedVibrationCycleDay = false;
}

if (vibrationTimeArray.length != 0) {
    const maxHour = vibrationTimeArray.reduce(function(a, b) {
        return Math.max(a, b);
    });
} else {
    const maxHour = 0
}


if (!completedVibrationCycleDay) {
    // Ensure that the next vibration isn't passed
    let i = 0;
    while (vibrationTimeArray[i] <= currentHour)
    {
        const firstElement = vibrationTimeArray.shift();
        vibrationTimeArray.push(firstElement);
        i++;
    }
    if (i != vibrationTimeArray.length)
    {
        console.log("Next hour of vibration : " + vibrationTimeArray[0]);
        if (vibrationTimeArray[0] === currentHour && bodyPresence.present && getView() === 0) { // REMOVED : && today.adjusted.steps > 300 -- vibrate only if the time is right and the user has walked at least 300 steps and the watch is worn
            // this ensures that the watch does not vibrate if the user is still sleeping
            console.log("The watch should vibrate");
            vibrate();
            const firstElement = vibrationTimeArray.shift();
            vibrationTimeArray.push(firstElement);
            if (currentHour === maxHour) {
                completedVibrationCycleDay = true;
            }
        } else if (vibrationTimeArray[0] < currentHour) { // the vector is shifted by one since the that hour is already passed
            const firstElement = vibrationTimeArray.shift();
            vibrationTimeArray.push(firstElement);
        }
    }
}`

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

@mariofrei I fixed it! you were right. :)
Here if you would like to see my app branch : https://gallery.fitbit.com/details/a914a8ca-4529-42b4-9a6d-ee054ce6653b

@ThePebblesFr I will work on this today afternoon. And ping you again

@ThePebblesFr
Copy link
Collaborator

ThePebblesFr commented Apr 20, 2022

@ysy5700, i updated the activity-flow.js file that you send before so that it fits the latest version of the code -->
activity-flow.txt

Apparently, if you follow the steps below, you might be able to run your question flow without any bug, and you might also be able to add 4-answers questions and buzzer:

  • create an empty folder
  • clone the branch cozie-researcher: git clone -b cozie-researcher https://github.com/cozie-app/cozie.git
  • add your flow to the flows folder (in ressources, and make sure the extension of this file is .js)
  • add your icons
  • in index.js, change the 45th line by this : import totalFlow from "../resources/flows/activity-flow";
    Then, in the Node.js bash:
  • npm install
  • npx fitbit
  • build and install

(If you are using another API, you might also need to change the key in the index.js (companion) code, line 135)

If something doesn't work, please let me know.

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

@ThePebblesFr Hello Pierre, I git clone the cozie-researcher in one empty-folder (seoyeone) but I cannot see the "flow" folder. So I couldn't proceed the further steps.
image

Here is my github https://github.com/ysy5700/cozie
Could you fix the buzz issues directly? How I can share with you my github for editing?
Thanks!

@ThePebblesFr
Copy link
Collaborator

You forgot the “-b cozie-researcher” to clone the right branch:

git clone -b cozie-researcher https://github.com/cozie-app/cozie.git

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

Hello @ThePebblesFr I didn't understand this part

Then, in the Node.js bash:

What do you mean?
I simply go to the folder that I recently clone and command this right?
npm install
npx fitbit
build and install

@ThePebblesFr
Copy link
Collaborator

Yes, that’s it!

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

@ThePebblesFr
What does it mean by API can be different? How I can check and where I can change? which file?

@ThePebblesFr
Copy link
Collaborator

Don't mind this, I read again your discussion with Mario about this and you shouldn't get any error related to this.

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

Yes, now I have some problem connect phone and device (fitbit watch). I will reset everything and start from the scratch

@ThePebblesFr
Copy link
Collaborator

ThePebblesFr commented Apr 20, 2022

Yes, sometimes it fails. You should disconnect/reconnect your fitbit account. On my computer, it has always been solving the issues.

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

I disconnect/reconnect the fitbit account but it is weird that I'm stuck connecting device. It shows..

Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\Users\ysy57\Documents\seoyeon\cozie>npm install

up to date, audited 573 packages in 9s

27 packages are looking for funding
run npm fund for details

15 vulnerabilities (4 moderate, 10 high, 1 critical)

To address issues that do not require attention, run:
npm audit fix

To address all issues, run:
npm audit fix --force

Run npm audit for details.

C:\Users\ysy57\Documents\seoyeon\cozie>npx fitbit
Logged in as SeY [email protected]
fitbit$ build

build
fitbit-build

[16:06:59][info][app] Building app for Fitbit Ionic
[16:07:00][info][app] Building app for Fitbit Versa
[16:07:00][info][app] Building app for Fitbit Versa Lite
[16:07:00][info][app] Building app for Fitbit Versa 2
[16:07:01][info][companion] Building companion
[16:07:01][info][settings] Building settings
[16:07:01][info][build] App UUID: a914a8ca-4529-42b4-9a6d-ee054ce6653b, BuildID: 0x05577eebdcec3676
fitbit$ install
No app package specified. Using default ./build/app.fba.
Loaded appID:a914a8ca-4529-42b4-9a6d-ee054ce6653b buildID:0x05577eebdcec3676
App requires a device, connecting...
No devices are connected and available
fitbit$

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

Do you think the device(watch) should have strong wifi to be connected?

@ThePebblesFr
Copy link
Collaborator

Did you disconnect/reconnect your fitbit os simulator?

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

yeap both of them

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

Now I did again to log-out and log-in in OS simulator it got stuck like this.
image

@ThePebblesFr
Copy link
Collaborator

Do you have TeamViewer? I could try to fix it. I don't really know what is wrong..

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

yeap thanks here is my ID/PW
ID: 366 354 330
PW: y5ngtd1d

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

https://epfl.zoom.us/j/66340908872

The zoom is ready as well

@ysy5700
Copy link
Author

ysy5700 commented Apr 20, 2022

Are you still there?

@ysy5700
Copy link
Author

ysy5700 commented Apr 21, 2022

Hello @ThePebblesFr,
Today I'm wearting the fitbit watch but there's no buzz going on every hour (there was nothing at least once..)

And I found out that the touch button (left circle when there is only two option: e.g. standing / sitting) is not working after we change the code yesterday.

Could you look at the scripts again if there's a problem?
In that case, I may use the code that I've constructed before.

Thanks!

@ThePebblesFr
Copy link
Collaborator

I found out a bug with these buttons too. I fixed it and pushed it on cozie-researcher branch.

For the buzzer, we will figure it out during our zoom call.

@pedramnojedehi
Copy link

pedramnojedehi commented Jul 8, 2022

@mariofrei Do you think the developer ID is the new ID that I'm assigned? Actually I don't have the same webpage like PJ had on the youtube. (https://youtu.be/5JaCrZBZbt0?t=91) image

If this developer ID is the one that I need to copy/paste into the package.json file, I do it after your checking. Thanks!

I know you have managed to fix the issue related to "appUUID" but I'm just writing the effective solution working perfectly for me for the record:

  1. Rename your package.json to package.json.txt
  2. Delete the line with the AppUUID
  3. Rename package.json.txt to package.json
  4. Type the following on the terminal: npx fitbit-build generate-appid
  5. Then, a new app ID will be written, and you can re-build and install the app.
  6. Then by using the new fba file generated you can try publishing again.

if there is a better way of resolving this, please let me know.

@mariofrei
Copy link
Collaborator

@ThePebblesFr could you respond to the question above?

@ThePebblesFr
Copy link
Collaborator

ThePebblesFr commented Jul 8, 2022

I tried your solution @pedramnojedehi. I don't understand how it can work because the app UUID must match the Developer ID of your Fitbit account, otherwise you can't upload any .fba file in the fitbit gallery. Hence, the appUUID field in the package.json file can't be generated this way.

@ThePebblesFr
Copy link
Collaborator

Unless you found a way to change this Developer ID to the appUUID generated, I'm not sure it can work.
image
Here is the developer ID I'm talking about for one of our fitbit acount.

@pedramnojedehi
Copy link

I tried your solution @pedramnojedehi. I don't understand how it can work because the app UUID must match the Developer ID of your Fitbit account, otherwise you can't upload any .fba file in the fitbit gallery. Hence, the appUUID field in the package.json file can't be generated this way.

@ThePebblesFr: I'm seeing things differently on my end:
First version:
image
Second version:
image
As you can see appUUID could vary according to your app but your developer ID is fixed. There might better solutions but I tested this solution a few times and that worked every time.

@ThePebblesFr
Copy link
Collaborator

So, if I understood correctly, you published a version of your app with a first appUUID and then you generated a new UUID and built the app again. Then, when you publish the new version with the new appUUID, it works?

@pedramnojedehi
Copy link

Basically, you cannot publish an app whose appUUID was already published. You would face an error and are not able to publish anything. So, I could never publish my own version because you guys published "Cozie for researcher" app once earlier with that specific appUUID. So, I went through my solution, then I got a new appUUID and upload a new .fba file on Fitbit gallery.
And the explanation of the screenshots above: I went through the solution twice to show that we can create different appUUID over and over again and they can be uploaded without any problem while everything is identical in these apps.

@ThePebblesFr
Copy link
Collaborator

Ok I finally managed to do so. A few weeks ago, I tried so many times to do that and it has never worked. Now it works! Thanks a lot.
By the way, I'm not sure that you need to do the 1st and 3rd steps (rename package.json to a txt file). You can simply open the package.json file and remove the appUUID line (and the comma above) and it works.

@pedramnojedehi
Copy link

Yes, agreed! I skipped those steps later and yet that worked.
And yes, "(and the comma above)" must be erased, that's the catch :D

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

4 participants