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

No Nutrition data #17

Open
AFumi39 opened this issue Jan 26, 2023 · 6 comments
Open

No Nutrition data #17

AFumi39 opened this issue Jan 26, 2023 · 6 comments

Comments

@AFumi39
Copy link

AFumi39 commented Jan 26, 2023

Hello, I integrated this component and all works well (all the data that I have on Google Fit app are correctly showed in HA) except Nutrition data.
I've integrated MyNetDiary with Google Fit and it sends data correctly. For examples I can see that today at 00:09 local time, I've 3 foods with all their information. But in HA the Nutrition entity is empty

@AFumi39
Copy link
Author

AFumi39 commented Jan 30, 2023

Nobody can help me? It's been few days that I use this integration, and it's frustrating that I can't have nutrition data in my HA instance.
Anyone have some suggestion to try to resolve the problem?

Thank you

@AFumi39
Copy link
Author

AFumi39 commented Jan 30, 2023

I just tried https://developers.google.com/oauthplayground to view if my data are present, querying derived:com.google.nutrition:com.google.android.gms:merged it correctly returns data. For example:

{
      "startTimeMillis": "1674732767000", 
      "endTimeMillis": "1674819167000", 
      "dataset": [
        {
          "dataSourceId": "derived:com.google.nutrition.summary:com.google.android.gms:aggregated", 
          "point": [
            {
              "startTimeNanos": "1674761760001000000", 
              "originDataSourceId": "raw:com.google.nutrition:com.fourtechnologies.mynetdiary.ad:", 
              "endTimeNanos": "1674761760002000000", 
              "value": [
                {
                  "mapVal": [
                    {
                      "value": {
                        "fpVal": 7.900000095367432
                      }, 
                      "key": "fat.total"
                    }, 
                    {
                      "value": {
                        "fpVal": 1256
                      }, 
                      "key": "sodium"
                    }, 
                    {
                      "value": {
                        "fpVal": 4.050000071525574
                      }, 
                      "key": "fat.saturated"
                    }, 
                    {
                      "value": {
                        "fpVal": 34.80000019073486
                      }, 
                      "key": "protein"
                    }, 
                    {
                      "value": {
                        "fpVal": 1.2999999523162842
                      }, 
                      "key": "carbs.total"
                    }, 
                    {
                      "value": {
                        "fpVal": 218.5
                      }, 
                      "key": "calories"
                    }, 
                    {
                      "value": {
                        "fpVal": 1.2999999523162842
                      }, 
                      "key": "sugar"
                    }, 
                    {
                      "value": {
                        "fpVal": 0.8999999761581421
                      }, 
                      "key": "dietary_fiber"
                    }
                  ]
                }, 
                {
                  "mapVal": [], 
                  "intVal": 3
                }
              ], 
              "dataTypeName": "com.google.nutrition.summary"
            }
          ]
        }
      ]
    }, 

@En3myNightmare
Copy link

Have you been able to solve the problem?
Except for the Nutriotion sensor, all my values are correct. Nutrition still 0.

@AFumi39
Copy link
Author

AFumi39 commented Feb 13, 2023

Have you been able to solve the problem? Except for the Nutriotion sensor, all my values are correct. Nutrition still 0.

I found out that the code for this custom component is wrong, not only for nutrition, but also for other parameters. I solved cloning it in my github repository and fixing all the bugs I found out.
Since we haven't received any reply/feedback, I think it's not a bad thing if I share my "version" of the component.
I you replace the content of "/config/custom_components/google_fit/sensor.py" with this one and reboot, you should see all the data: https://github.com/AFumi39/googlefit-homeassistant/blob/master/custom_components/google_fit/sensor.py

@En3myNightmare
Copy link

When I added your code to sensor.py, it returned the error:

ModuleNotFoundError: No module named 'homeassistant.component'

Line 14 is missing an "s": component -> components

Now i works like a charm! Thank you very much!

@AFumi39
Copy link
Author

AFumi39 commented Feb 13, 2023

Yeah, you're right... I fixed it on my HA but I forgot to push the fix into the repository

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