mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-05-01 13:12:50 +00:00
Amended "no activity" condition
Back to using elapsed time.
This commit is contained in:
@ -106,14 +106,14 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
|
|||||||
var activity = Activity.getProfileInfo().sport;
|
var activity = Activity.getProfileInfo().sport;
|
||||||
var sub_activity = Activity.getProfileInfo().subSport;
|
var sub_activity = Activity.getProfileInfo().subSport;
|
||||||
// We need to check if we are actually tracking any activity as the enumerated type does not include "No Sport".
|
// We need to check if we are actually tracking any activity as the enumerated type does not include "No Sport".
|
||||||
System.println("activityTrackingOn = " + System.getDeviceSettings().activityTrackingOn);
|
if ((Activity.getActivityInfo() != null) and
|
||||||
if (!System.getDeviceSettings().activityTrackingOn) {
|
((Activity.getActivityInfo().elapsedTime == null) or
|
||||||
|
(Activity.getActivityInfo().elapsedTime == 0))) {
|
||||||
// Indicate no activity with -1, not part of Garmin's activity codes.
|
// Indicate no activity with -1, not part of Garmin's activity codes.
|
||||||
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
||||||
activity = -1;
|
activity = -1;
|
||||||
sub_activity = -1;
|
sub_activity = -1;
|
||||||
}
|
}
|
||||||
System.println("activity = " + activity);
|
|
||||||
data.add({
|
data.add({
|
||||||
"state" => activity,
|
"state" => activity,
|
||||||
"type" => "sensor",
|
"type" => "sensor",
|
||||||
|
@ -186,7 +186,9 @@ class WebhookManager {
|
|||||||
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
||||||
if (Activity has :getProfileInfo) {
|
if (Activity has :getProfileInfo) {
|
||||||
var activity = Activity.getProfileInfo().sport;
|
var activity = Activity.getProfileInfo().sport;
|
||||||
if (!System.getDeviceSettings().activityTrackingOn) {
|
if ((Activity.getActivityInfo() != null) and
|
||||||
|
((Activity.getActivityInfo().elapsedTime == null) or
|
||||||
|
(Activity.getActivityInfo().elapsedTime == 0))) {
|
||||||
// Indicate no activity with -1, not part of Garmin's activity codes.
|
// Indicate no activity with -1, not part of Garmin's activity codes.
|
||||||
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
||||||
activity = -1;
|
activity = -1;
|
||||||
@ -204,7 +206,9 @@ class WebhookManager {
|
|||||||
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
||||||
if (Activity has :getProfileInfo) {
|
if (Activity has :getProfileInfo) {
|
||||||
var sub_activity = Activity.getProfileInfo().subSport;
|
var sub_activity = Activity.getProfileInfo().subSport;
|
||||||
if (!System.getDeviceSettings().activityTrackingOn) {
|
if ((Activity.getActivityInfo() != null) and
|
||||||
|
((Activity.getActivityInfo().elapsedTime == null) or
|
||||||
|
(Activity.getActivityInfo().elapsedTime == 0))) {
|
||||||
// Indicate no activity with -1, not part of Garmin's activity codes.
|
// Indicate no activity with -1, not part of Garmin's activity codes.
|
||||||
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
// https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module
|
||||||
sub_activity = -1;
|
sub_activity = -1;
|
||||||
|
Reference in New Issue
Block a user