From 3d1405e2d1e6362509e22dbb3b9b4a046e00bef9 Mon Sep 17 00:00:00 2001 From: RonnyWinkler Date: Mon, 7 Oct 2024 21:01:39 +0200 Subject: [PATCH] 1.6.1 Added trigger for moonphase value. --- .homeychangelog.json | 4 ++ .homeycompose/app.json | 2 +- .homeycompose/capabilities/moonphase.json | 2 +- .../flow/triggers/MoonphaseValueChanged.json | 42 +++++++++++++++ app.json | 52 +++++++++++++++++-- drivers/owmOnecallDaily/device.js | 4 ++ drivers/owmOnecallDaily/driver.compose.json | 3 +- 7 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 .homeycompose/flow/triggers/MoonphaseValueChanged.json diff --git a/.homeychangelog.json b/.homeychangelog.json index 65bbe88..24adfc9 100644 --- a/.homeychangelog.json +++ b/.homeychangelog.json @@ -278,5 +278,9 @@ "1.6.0": { "en": "Adjusted flow trigger for Homey FW 12.2.0.", "de": "Flow-Trigger angepasst für Homey-FW 12.2.0." + }, + "1.6.1": { + "en": "Added trigger for moonphase value.", + "de": "Trigger für Mondphasenwert hinzugefügt." } } diff --git a/.homeycompose/app.json b/.homeycompose/app.json index 937db4c..fb63449 100644 --- a/.homeycompose/app.json +++ b/.homeycompose/app.json @@ -1,6 +1,6 @@ { "id": "nu.baretta.openweathermap", - "version": "1.6.0", + "version": "1.6.1", "compatibility": ">=8.1.1", "sdk": 3, "name": { diff --git a/.homeycompose/capabilities/moonphase.json b/.homeycompose/capabilities/moonphase.json index c15090b..d6c4b9f 100644 --- a/.homeycompose/capabilities/moonphase.json +++ b/.homeycompose/capabilities/moonphase.json @@ -5,7 +5,7 @@ "de": "Mondphase", "nl": "Maanfase" }, - "uiComponent": "sensor", + "uiComponent": null, "getable": true, "setable": false, "icon": "/assets/moonphase.svg" diff --git a/.homeycompose/flow/triggers/MoonphaseValueChanged.json b/.homeycompose/flow/triggers/MoonphaseValueChanged.json new file mode 100644 index 0000000..dd03863 --- /dev/null +++ b/.homeycompose/flow/triggers/MoonphaseValueChanged.json @@ -0,0 +1,42 @@ +{ + "id": "MoonphaseValueChanged", + "title": { + "en": "Moon phase (value) has changed", + "de": "Mondphase (Wert) hat sich geändert", + "nl": "Maanfase (waarde) is veranderd" + }, + "hint": { + "en": "Triggers when the moon phase changes.", + "de": "Wird ausgelöst, wenn sich der Mondphase ändert.", + "nl": "Triggert zodra de maanfase veranderd." + }, + "tokens": [{ + "name": "moonphase", + "type": "number", + "title": { + "en": "Moon phase (0=new moon, 0.25=first quarter, 0.5=full, 0.75=last quarter, 1=new moon)", + "de": "Mondphase (0=Neumond, 0,25=erstes Viertel, 0,5=Vollmond, 0,75=letztes Viertel, 1=Neumond)", + "nl": "Maanfase (0=nieuwe maan, 0,25=eerste kwartier, 0,5=vol, 0,75=laatste kwartier, 1=nieuwe maan)" + }, + "example": 0.25 + }, + { + "name": "location", + "type": "string", + "title": { + "en": "Location", + "de": "Standort", + "nl": "locatie" + }, + "example": { + "en": "Amsterdam", + "de": "Berlin" + } + } + ], + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=owmOnecallDaily" + }] +} \ No newline at end of file diff --git a/app.json b/app.json index 9a7e45d..8226098 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "_comment": "This file is generated. Please edit .homeycompose/app.json instead.", "id": "nu.baretta.openweathermap", - "version": "1.6.0", + "version": "1.6.1", "compatibility": ">=8.1.1", "sdk": 3, "name": { @@ -1009,6 +1009,51 @@ } ] }, + { + "id": "MoonphaseValueChanged", + "title": { + "en": "Moon phase (value) has changed", + "de": "Mondphase (Wert) hat sich geändert", + "nl": "Maanfase (waarde) is veranderd" + }, + "hint": { + "en": "Triggers when the moon phase changes.", + "de": "Wird ausgelöst, wenn sich der Mondphase ändert.", + "nl": "Triggert zodra de maanfase veranderd." + }, + "tokens": [ + { + "name": "moonphase", + "type": "number", + "title": { + "en": "Moon phase (0=new moon, 0.25=first quarter, 0.5=full, 0.75=last quarter, 1=new moon)", + "de": "Mondphase (0=Neumond, 0,25=erstes Viertel, 0,5=Vollmond, 0,75=letztes Viertel, 1=Neumond)", + "nl": "Maanfase (0=nieuwe maan, 0,25=eerste kwartier, 0,5=vol, 0,75=laatste kwartier, 1=nieuwe maan)" + }, + "example": 0.25 + }, + { + "name": "location", + "type": "string", + "title": { + "en": "Location", + "de": "Standort", + "nl": "locatie" + }, + "example": { + "en": "Amsterdam", + "de": "Berlin" + } + } + ], + "args": [ + { + "name": "device", + "type": "device", + "filter": "driver_id=owmOnecallDaily" + } + ] + }, { "id": "MoonriseChanged", "title": { @@ -5245,7 +5290,8 @@ "measure_wind_angle", "measure_wind_direction_string", "measure_windstrength_beaufort", - "conditioncode_text" + "conditioncode_text", + "moonphase" ], "pair": [ { @@ -6865,7 +6911,7 @@ "de": "Mondphase", "nl": "Maanfase" }, - "uiComponent": "sensor", + "uiComponent": null, "getable": true, "setable": false, "icon": "/assets/moonphase.svg" diff --git a/drivers/owmOnecallDaily/device.js b/drivers/owmOnecallDaily/device.js index 782a4b6..0bef854 100644 --- a/drivers/owmOnecallDaily/device.js +++ b/drivers/owmOnecallDaily/device.js @@ -88,6 +88,9 @@ class owmOnecallDaily extends Homey.Device { "trigger": "MoonphaseChanged", "trigger_token": [] }, + "moonphase":{ + "trigger": "MoonphaseValueChanged", + }, "measure_ultraviolet":{ "trigger": "UltravioletChanged" }, @@ -363,6 +366,7 @@ class owmOnecallDaily extends Homey.Device { else if ( moonphase > 0.938 && moonphase <= 1 ){ moonphase_type = 'NM'; } + this.getDataCapability('moonphase')['value'] = moonphase; this.getDataCapability('moonphase_type')['value'] = moonphase_type; this.getDataCapability('moonphase_type').trigger_token.push({ "trigger_token_id": "moonphase_type", diff --git a/drivers/owmOnecallDaily/driver.compose.json b/drivers/owmOnecallDaily/driver.compose.json index 8b108bc..dd2c553 100644 --- a/drivers/owmOnecallDaily/driver.compose.json +++ b/drivers/owmOnecallDaily/driver.compose.json @@ -55,8 +55,9 @@ "measure_wind_direction_string", "measure_windstrength_beaufort", - "conditioncode_text" + "conditioncode_text", + "moonphase" ], "pair": [{ "id": "settings",