Project MVP: If my heart rate exceeds 100bpm, I want to turn a house light red

There is no point in this particular project, it’s just a MVP for a PoC.

MVP = minimal viable product.
PoC = proof of concept.
(don’t mean to personsplain)

As the subject suggests. I want to achieve a single example of end to end automation from my Smart watch to a house device. Not “remote control”, but automation. Something detected on the watch like heartrate, or sleep state triggering an HA event.

I can do everything from when I can surface a handle on the data in MQTT.

So step one is getting the data off the watch, for “realtime” events, it can send immediately. For routine events it stores and sends hourly. Q: Can I actually access the right sensors, how much is hidden behind APIs, are they open?

Step two then is getting the data from the phone to MQTT. Again that’s going to need to be batch routine, send when able and retry emergency or “realtime” events.

From then on I’m in comfort zone. For the two steps above I’m lost. I literally JUST installed Android studio.

Consider this a “build thread”, but help would be amazing.

Cheers.

1 Like

Hi! So i’m currently using Automation to achieve something like this to monitor my Wifes Heart rate, she has SVT (Supraventricular Tachycardia) – So i needed to sent up an automation when her Google Pixel heart rate sensor goes above 135 bpm then send a notification message that yells at me to go check on her.

Like i said im using Google Pixel watch, so that involved using the Home Assistant app on the Google Pixel watch, where i enabled the Heart Rate sensor ( on the watch, in home assistant → Settings–> manage sensors → Heart rate, and make sure its on)

For safe measure i also include all the other Heart Rate sensors that report on her so if any one of them cross the threshold the automation will fire.

for notify i made the following in my Configuration.yaml:

notify:
  - platform: group
    name: all_devices
    unique_id: all_devices
    services:
      - service: mobile_app_sm_s908u
      - service: mobile_app_sm_s918u
      - service: mobile_app_sm_n975u
      - service: mobile_app_google_pixel_watch
      - service: mobile_app_google_pixel_watch_jd
      - service: ecobee
  - platform: group
    name: james_devices
    unique_id: james_devices
    services:
      - service: mobile_app_sm_s908u
      - service: mobile_app_sm_n975u
      - service: mobile_app_google_pixel_watch_jd
  - platform: group
    name: des_devices
    unique_id: des_devices
    services:
      - service: mobile_app_sm_s918u
      - service: mobile_app_google_pixel_watch

then in home assistant under under Automations and Scenes i made the following:

alias: 💖Health Check - Des💖
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.heart_rate_2
      - sensor.google_pixel_watch_heart_rate
      - sensor.resting_heart_rate_3
    above: 135
condition: []
action:
  - service: notify.james_devices
    metadata: {}
    data:
      message: TTS
      data:
        ttl: 0
        priority: high
        media_stream: alarm_stream_max
        tts_text: ❤️Health Check on Des, Heart rate over 135
mode: single

Im sure instead of TTS notify for the action you can change that to like Hue bulb turn red or whatever your lighting solution is.

Its not real time as much as id like but it does work… im posting what i have in hopes someone else can chime in on how to make this poling rate more frequent to realtime…

Update: Messaging over in this thread led me to also using Automation to send messages to devices to update sensors.

So now i have another Automation that runs every 5 mins to refresh senor data back to HA.

alias: SYS - Update Mobile Sensors (5 mins)
description: ""
trigger:
  - alias: "Template: Every 5 mins"
    platform: template
    value_template: "{{now().minute % 5 == 2 }}"
condition: []
action:
  - service: notify.des_devices
    data:
      message: command_update_sensors
  - service: notify.james_devices
    data:
      message: command_update_sensors
mode: single