nightscout / AndroidAPS

Opensource automated insulin delivery system (closed loop)
https://wiki.aaps.app
GNU Affero General Public License v3.0
725 stars 1.76k forks source link

Enhancement Add Motion Detection to Automation #1272

Open bobhome007 opened 2 years ago

bobhome007 commented 2 years ago

Enhancement Add an automation event type called "motion detect"

The setting should use the Android API for the accelerometer on the phone or watch to detect, walking, standing, running and driving with another setting for level of intensity from 1 to 100.

Based on the triggered event the usual Automation actions should be available.

Eg. Event: Motion Detection = eRunning Intensity = 40%

Action: set a profile % of 70% for 35minutes

bobhome007 commented 2 years ago

Enhancement

reijoahola-nightscout commented 2 years ago

I have tested xDrip+ Motion detection feature with my Galaxy phones. Galaxy S9 could use it but Galaxy S21 G5 did not like it and xDrip+ always turns Motion Detection off after about 15 min. There is something incompatibility and differences between phone models even from the same manufacturer. https://github.com/NightscoutFoundation/xDrip/issues/1813

bobhome007 commented 2 years ago

If AAPS has the feature, it will be able to automate profile changes which xDrip cannot do.

Also if the feature is added to AAPS it can be enabled only for certain tested for phones. This means if the phone does not pass a pre validation teat "what hardware are you" then AAPS will not enable the feature.

Andries-Smit commented 2 years ago

An interesting feature for automation The Activity detection API https://developers.google.com/location-context/activity-recognition give some possibility, before this API it was just too energy-consuming. But still, we should keep our battery consumption as low as possible; "No battery = no pump adjustments"

bobhome007 commented 2 years ago

Hi yes this is the part of the Api I was referring. I was aware of it which better supports movement intensity and takes advantage of the advancement in cpu cores and low power consumption.

I think it would be a nice feature.

MilosKozak commented 2 years ago

If I remember well, accessing health data was limited to play store applications. @AdrianLxM ?

bobhome007 commented 2 years ago

https://developer.android.com/guide/topics/location/transitions

Or

https://dev.theneura.com/#/manage

JazzZ1 commented 2 years ago

Would this be possible with heart rate monitor like with Samsung Health by Galaxy Watch too? That would be great, having profile changed by like HR 140 in combination with movement for longer than 10 minutes.