mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-16 11:28:40 +00:00
Report -1 instead of null for no activity
This commit is contained in:
@ -103,13 +103,15 @@ class BackgroundServiceDelegate extends System.ServiceDelegate {
|
||||
}
|
||||
];
|
||||
if (Activity has :getProfileInfo) {
|
||||
var activity = Activity.getProfileInfo().sport;
|
||||
var sub_activity = Activity.getProfileInfo().subSport;
|
||||
data.add({
|
||||
"state" => Activity.getProfileInfo().sport,
|
||||
"state" => activity ? activity : -1,
|
||||
"type" => "sensor",
|
||||
"unique_id" => "activity"
|
||||
});
|
||||
data.add({
|
||||
"state" => Activity.getProfileInfo().subSport,
|
||||
"state" => sub_activity ? sub_activity : -1,
|
||||
"type" => "sensor",
|
||||
"unique_id" => "sub_activity"
|
||||
});
|
||||
|
@ -183,9 +183,10 @@ class WebhookManager {
|
||||
case 1:
|
||||
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
||||
if (Activity has :getProfileInfo) {
|
||||
var activity = Activity.getProfileInfo().sport;
|
||||
registerWebhookSensor({
|
||||
"name" => "Activity",
|
||||
"state" => Activity.getProfileInfo().sport,
|
||||
"state" => activity ? activity : -1,
|
||||
"type" => "sensor",
|
||||
"unique_id" => "activity",
|
||||
"disabled" => false
|
||||
@ -195,9 +196,10 @@ class WebhookManager {
|
||||
case 2:
|
||||
// System.println("WebhookManager onReturnRegisterWebhookSensor(): Registering next sensor: Activity");
|
||||
if (Activity has :getProfileInfo) {
|
||||
var sub_activity = Activity.getProfileInfo().subSport;
|
||||
registerWebhookSensor({
|
||||
"name" => "Sub-activity",
|
||||
"state" => Activity.getProfileInfo().subSport,
|
||||
"state" => sub_activity ? sub_activity : -1,
|
||||
"type" => "sensor",
|
||||
"unique_id" => "sub_activity",
|
||||
"disabled" => false
|
||||
|
Reference in New Issue
Block a user