Jump to research
Composed by

Anonymous Squirrel
Views
2932
Version history
Anonymous Squirrel, 711d ago
May 20, 2023
Connecting Home Assistant to Google Health Connect or Samsung Health
I researched various sources, including Google Support, Home Assistant community forums, Reddit discussions, developer documentation, and blog posts. There was some consensus on possible ways to connect Home Assistant to Google Health Connect or Samsung Health, but no direct, native integration. The sources I consulted were related to the query, but there was a degree of uncertainty regarding the best way to connect these services since native integration is lacking. This research summary presents various options and suggestions for connecting Home Assistant to Google Health Connect or Samsung Health, based on the information gathered from the sources I consulted.
Have an opinion? Send us proposed edits/additions and we may incorporate them into this article with credit.
Words
506
Time
8m 9s
Contributors
266
Words read
24.9k
Option 1: Health Sync and Fitbit Integration
Option 2: Google Fit Integration (WIP)
Option 3: Samsung Health Data Export and Node-RED Integration
Option 4: Health Connect Platform Access
Option 5: Node-RED Code Snippet for Google Health Connect or Samsung Health
Jump to top
Research
"Integrate tablet camera into Home Assistant?"
Not used in article
"Best tablet or display for HA?"
Not used in article
"Creating Your Wearable Fitness App: Tips and Best Practices"
Not used in article
"Developing an app to get data from smartband/smartwatch"
Not used in article
"How To Get All Your Fitness Tracking Data in One Place - Gizmodo"
Not used in article
"Here's how I consolidated my <b>smart</b> <b>home</b> <b>using</b> <b>Home</b> <b>Assistant</b>"
Not used in article
"Body fat tracking in Home assistant"
Not used in article
"Integrating Aprilaire HVAC Systems"
Not used in article
"Google Fit or Mi Band 5 integration?"
Not used in article
"How can I link HomeBridge to HomeAssistant?"
Not used in article
"https://support.google.com/android/answer/12201227?hl=en"
- Health Connect is a single app that allows for the management of fitness and health app connections and data.
- The Health Connect app can be downloaded from the Play Store.
- The Health Connect app can be accessed through App permissions on your device.
- To connect apps to Health Connect, users need to turn on the apps they want to sync with Health Connect, select the data permissions that they want to share, and then tap “Allow.”
- Once access is granted, connected apps can access data from the last 30 days and any new data written after that.
- Connected apps’ service will continue to retain a copy of the data it shared with Health Connect.
- The types of data supported by Health Connect include Activity, Body Measurement, Cycle Tracking, Nutrition, Sleep, and Vitals.
- Other apps can read or write these types of data to and from Health Connect but may not support them yet.
- The website provides related resources for managing connected apps in Health Connect, finding Health Connect data, managing Health Connect data, and deleting data from Health Connect.
- User data in Health Connect is stored locally on their device, and users control which apps have access to their data on Health Connect and what kind of data is shared with their connected apps.
"Health connect by Android, sync b/w Samsung health and Google Fit working now."
Not used in article
"How to set up Sync Galaxy Watch fitness data with Google Fit"
Not used in article
"Are you using Google Fit or Samsung Health on your new Galaxy Watch 4 / Classic"
Not used in article
"How to set up & use Google Assistant or Alexa with Samsung SmartThings"
Not used in article
"https://community.home-assistant.io/t/ios-feature-request-apple-healthkit-integration/24494"
- The webpage provides a node-red export code snippet that can be used to integrate with Google Health Connect or Samsung Health.
- The code snippet uses a webhook to periodically obtain data from Google Health or Samsung Health in JSON format. The webhook is created in the configuration of the Google Health or Samsung Health app.
- The webhook sends a POST request to a URL that is generated by node-red. Node-red can parse out the metric values from the JSON POST request and update Home Assistant accordingly.
- In the provided node-red code snippet, the function node is responsible for parsing out the metric values from the POST request. The code loops through the metrics and calculates the sum of all the data values for each metric. The metric names and their corresponding values are stored in an object, which is returned as the output of the function node.
- Two HA-entity nodes are used in the code snippet to update the sensor state in Home Assistant. One for updating the step count sensor in Home Assistant, and another for updating the water intake sensor in Home Assistant.
- Once the two HA-entity nodes are updated with the values obtained from the function node, they can be used to populate the sensors in Home Assistant UI.
- The provided node-red code snippet can be used as a starting point for anyone wanting to integrate Google Health or Samsung Health with Home Assistant. However, certain steps may need customization based on individual requirements, such as the choice of metrics to be displayed, the creation of sample templates using sensor data, etc.
"Integrations - Home Assistant"
Not used in article
"How do i enable the Mobile App integration?"
Not used in article
"https://developers.home-assistant.io/docs/api/native-app-integration/"
- The guide discusses how to build a native Home Assistant app.
- Native apps can offer a seamless integration with Home Assistant.
- Native apps can be built for both iOS and Android devices.
- The Home Assistant app can be connected to any instance of Home Assistant, including those running on a local network.
- The app authentication process involves generating an access token through the Home Assistant interface and transferring this token to the app, where it can be used to authenticate all subsequent requests.
- The app uses RESTful API calls to communicate with Home Assistant.
- The app may be built using the Home Assistant AppDaemon, which facilitates event-driven programming and support for a range of external integrations.
- The app may send location data and device information back to Home Assistant.
- Location data can be used to trigger automations or control devices based on user location.
- Device information can be used to provide a customized experience to users, based on their specific hardware and operating system.
- Services can be called through the RESTful API, allowing the app to control devices or trigger actions in Home Assistant.
- Events can be fired by the app, which can be used to trigger automations defined in Home Assistant.
- Templates can be rendered by the app, which can be used to display information or provide dynamic content to users.
- Custom views can be created, which allow users to control devices and perform other actions within the app.
- The app can be embedded in a webview, which allows users to view and interact with the app within a web browser.
- However, using a webview also allows the app to access the internet, which may be a security risk.
- Custom views can be created to provide direct control of devices, including the ability to toggle switches and adjust dimming levels.
- The app may use additional integrations, such as MQTT, to communicate with Home Assistant and perform more advanced automations.
- MQTT allows the app to integrate with other IoT devices and services.
- Apps built using the Home Assistant AppDaemon can respond to custom events and commands, which can be used to create more complex and sophisticated automations.
- Pre-built integrations for popular platforms, such as Alexa and Google Assistant, can be used to expand the functionality of the app.
- The app can be used to create custom dashboards and views, allowing users to monitor and control multiple devices at once.
- Users can interact with the app using voice commands through integration with Alexa or Google Assistant.
- The app can be used to monitor and control Home Assistant from anywhere, using
"Health Connect Updates - Google Fit & Samsung Health Integration!"
Not used in article
"https://developer.samsung.com/health/blog/en-us/2022/12/21/accessing-samsung-health-data-through-health-connect"
-
Health Connect Platform:
- Allows health and fitness data to be shared across Android devices with user’s consent.
- Enables developers to retrieve Samsung Health data using Health Connect APIs and use them in their applications.
- Adds new opportunities for health applications that enhance the user’s journey towards better health.
-
Samsung Health:
- Can be installed on Android smartphones and tablets and Galaxy Watches.
- Measures the user’s overall health data through the sensors on the device.
- Supports various health data types and gathers data from all connected devices.
- Synchronizes the measured data between the devices, and manages the user’s health data securely on them.
- Application version 6.22.5 and later supports synchronizing data with Health Connect.
- Sensors: Galaxy Watch has BioActive sensor; measures steps, exercises, heart rate, sleep, blood oxygen saturation, and body composition.
-
Samsung Health and Samsung Connect:
- The user must enable synchronization between Samsung Health and Health Connect.
- Health Connect must be installed and connected to Samsung Health.
- New or updated data in Samsung Health is shared to Health Connect, making it available to developers to use.
- Data synchronization between Samsung Health and Health Connect happens on the smartphone side.
-
Samsung Health synchronizes health data with Health Connect in both directions:
- When Samsung Health has new or updated data, it writes the data to Health Connect.
- When Health Connect has updated data, Samsung Health retrieves it.
-
Data synchronization occurs under certain situations:
- When the Galaxy Watch reconnects with the smartphone.
- When the user opens the Samsung Health application home screen on the smartphone.
- When the user pulls-down on the Samsung Health application home screen on the smartphone.
- Some types of health data are synchronized differently, e.g., continuous heart rate data from the Galaxy Watch is not sent to the Samsung Health application on the smartphone immediately.
-
Health Connect APIs:
- Health Connect API library dependencies must be added to the application’s “build.gradle” file.
- Health Connect application package name must be declared in the “AndroidManifest.xml” file.
- Health Connect client instance must be created using the latest Samsung Health and Health Connect versions.
- Permissions for the health data types must be declared.
-
Developers can use the APIs for the following tasks:
- Read and Write data
- Delete specific data records
- Aggregate and filter data
- Session data
- Various health data that
"https://community.home-assistant.io/t/getting-your-android-ios-fitness-data-into-ha/369895"
- Fitness data is often siloed in various apps and platforms, which becomes problematic when changing hardware or mobile platforms as the entire history could be lost unless supported by the new platform.
- HA, InfluxDB, and Grafana can be used to self-host fitness data. This ensures continuity in graphs even when changing a platform.
- There are two integrations that provide consistent fitness data in HA: Withings & Fitbit. Thus, the hardware that you use should either come from them, or have data importable in their apps (Health Mate & Fitbit, respectively).
- Fitbit is the only (native) game in town for getting a daily step count automatically imported. Withings scales provide weight, bone mass, fat mass & ratio, muscle mass & pulse wave velocity. The thermometer provides body temperature, skin temperature & ambient temperature. The blood pressure monitor provides diastolic blood pressure, heart bpm, and SpO2. The under-mattress sleep analyzer provides a whole bunch of sleep data.
- Health Sync - Apps on Google Play app (free to try for a week, 3 EUR for a lifetime license) can send data from almost any major fitness ecosystem from Google Fit, Samsung Health, etc. into Fitbit. This resolves the problem of steps & distance, as well as sleep & weight data if not using Withings hardware, but unfortunately lacks the option of importing heart rate data. Fitbit doesn’t allow either import or export of heart rate data from their app.
- Together, Withings & Fitbit can provide all the aforementioned stuff to HA, which can then be added into InfluxDB & Grafana.
- For iOS Apple Watch data, there seem to be either connect the Apple Watch data to Strava and then Strava to Fitbit (free), or use Health Auto Export - JSON+CSV on the App Store (apple.com), which apparently hooks into HA and sends the Apple Watch data (not free, still need to test it).
- The author has set up the platform for Android and will expand it as requested or as new hardware/software solutions become available.
- The article also mentions monitoring plants using HA and mentions the integration of plant sensors into HA using Home Assistant OSCPlant. It also briefly talks about using HA to track electricity usage through an InfluxDB database and visualize it using Grafana.
- The author mentions creating a media dashboard that displays a rotating album cover carousel of what’s currently playing in Spotify.
- There is a brief mention of using HA as an alarm clock
"Google Fit integration (WIP)"
- The Reddit post titled “Google Fit integration (WIP)” in the subreddit ‘homeassistant’ was made 1 year, 3 months ago and has 57 points.
- The author of the post created a Google Fit integration for Home Assistant as they found previous integrations to be either not working or only providing basic data.
- The author forked an existing integration, fixed permissions, added new sensors, and created the integration, which can be found on their Github repository.
- The issue with previous integrations was that if the user wants to get advanced data, Google authentication is complicated and cannot be automated in Home Assistant.
- A Python script was created by the author to obtain Google authentication token, which is then used in the integration.
- The author used their Galaxy Watch 3 with health sync to get all the data into Google Fit.
- Some Reddit users mentioned that they previously had Google Fit integration in their Home Assistant, but it kept breaking, possibly because Google changes things frequently.
- One user mentioned trying the old integration and failing and thanked the author for making the new integration available.
- Some users had concerns and reported issues with installing the Github repository and running the get_credentials.py script, particularly with regards to installing requirements and running the script in Windows or on a Mac.
- Users also asked questions about tracking multiple users, converting to imperial units, and the script not working anymore.
- The author and other Reddit users gave helpful suggestions and tips to troubleshoot issues related to installation, running the script, and configuring Home Assistant.
- There were requests for more detailed instructions to get the integration working and for a clear readme file.
- Users also suggested improvements and additional functionalities for the integration, such as humidity sensor, heart rate variability, and support for Samsung Health Connect.
- Some users expressed gratitude and appreciation for the author’s work and for sharing the integration.
"Samsung health in Home Assistant"
- One year and 11 months ago, a Reddit user in the r/homeassistant subreddit asked if there was a way to integrate Samsung Health or Samsung watch data into Home Assistant. The post got 11 points and several users responded with suggestions.
- One user suggested syncing the data to Google Fit and using that to get the data into Home Assistant.
- Another user was unsure if it was possible, but speculated that iOS may have better integration options.
- Multiple users suggested manually exporting the data and parsing it for use in Home Assistant. One user provided a tutorial on how to export data from the Samsung Health app.
- A user suggested using the node red package rn-samsung-health to integrate with Home Assistant.
- Another user suggested using the HACS component hass-node-red to bring the data back to Home Assistant.
- There was some discussion about the difficulties of integrating with Samsung Health and some criticisms of the app.
- Some users expressed interest in real-time or automatic syncing of data between Samsung Health and Home Assistant.
- The post has not been updated in the almost 2 years since it was originally posted.
- The linked tutorial provides a step-by-step guide to exporting Samsung Health data in a .csv format.
- The node red package rn-samsung-health is a node.js module that provides an API to access Samsung Health data.
- HACS is a custom component repository for Home Assistant.
- There was some discussion about the removal of a weight management feature from the Samsung Health app.
- One user expressed interest in integrating sleep data from the Samsung Galaxy Watch into Home Assistant.
- The node red package rn-samsung-health requires additional installation steps to be used with Home Assistant.
- There was some discussion about the use of IFTTT or other automation tools to integrate Samsung Health and Home Assistant.
- Some users were interested in visualizing Samsung Health data in Home Assistant, such as through graphs or charts.
"Samsung & Health Connect (steps sync)"
Not used in article
💭 Looking into
Step-by-step guide on how to set up Samsung Health with Home Assistant
💭 Looking into
Step-by-step guide on how to set up Google Health Connect with Home Assistant