mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-08-02 09:58:39 +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) {
|
if (Activity has :getProfileInfo) {
|
||||||
|
var activity = Activity.getProfileInfo().sport;
|
||||||
|
var sub_activity = Activity.getProfileInfo().subSport;
|
||||||
data.add({
|
data.add({
|
||||||
"state" => Activity.getProfileInfo().sport,
|
"state" => activity ? activity : -1,
|
||||||
"type" => "sensor",
|
"type" => "sensor",
|
||||||
"unique_id" => "activity"
|
"unique_id" => "activity"
|
||||||
});
|
});
|
||||||
data.add({
|
data.add({
|
||||||
"state" => Activity.getProfileInfo().subSport,
|
"state" => sub_activity ? sub_activity : -1,
|
||||||
"type" => "sensor",
|
"type" => "sensor",
|
||||||
"unique_id" => "sub_activity"
|
"unique_id" => "sub_activity"
|
||||||
});
|
});
|
||||||
|
@ -183,9 +183,10 @@ class WebhookManager {
|
|||||||
case 1:
|
case 1:
|
||||||
// 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;
|
||||||
registerWebhookSensor({
|
registerWebhookSensor({
|
||||||
"name" => "Activity",
|
"name" => "Activity",
|
||||||
"state" => Activity.getProfileInfo().sport,
|
"state" => activity ? activity : -1,
|
||||||
"type" => "sensor",
|
"type" => "sensor",
|
||||||
"unique_id" => "activity",
|
"unique_id" => "activity",
|
||||||
"disabled" => false
|
"disabled" => false
|
||||||
@ -195,9 +196,10 @@ class WebhookManager {
|
|||||||
case 2:
|
case 2:
|
||||||
// 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;
|
||||||
registerWebhookSensor({
|
registerWebhookSensor({
|
||||||
"name" => "Sub-activity",
|
"name" => "Sub-activity",
|
||||||
"state" => Activity.getProfileInfo().subSport,
|
"state" => sub_activity ? sub_activity : -1,
|
||||||
"type" => "sensor",
|
"type" => "sensor",
|
||||||
"unique_id" => "sub_activity",
|
"unique_id" => "sub_activity",
|
||||||
"disabled" => false
|
"disabled" => false
|
||||||
|
Reference in New Issue
Block a user