From ab28a65246a29714b1e347c52f4cbe001283b9a9 Mon Sep 17 00:00:00 2001 From: Benjamin Klaus Date: Tue, 18 Feb 2025 11:58:43 +0100 Subject: [PATCH] added predefined requests for jokes and weather, https://github.com/asterics/AsTeRICS-Grid/issues/75 --- live_predefined_actions.json | 2 +- live_predefined_requests_beta.json | 2 +- ...live_predefined_actions.json.readable.json | 181 ++++++++- ...ive_predefined_requests.json.readable.json | 367 ++++++++++++++++++ ...redefined_requests_beta.json.readable.json | 252 ++++++++++++ predefined_mappings/i18n/i18n.en.json | 46 ++- .../Current_weather_open-meteo.com.json | 105 +++++ .../Random_joke_icanhazdadjoke.com.json | 24 ++ 8 files changed, 972 insertions(+), 7 deletions(-) create mode 100644 live_readable/live_predefined_requests.json.readable.json create mode 100644 live_readable/live_predefined_requests_beta.json.readable.json create mode 100644 predefined_mappings/requests/Current_weather_open-meteo.com.json create mode 100644 predefined_mappings/requests/Random_joke_icanhazdadjoke.com.json diff --git a/live_predefined_actions.json b/live_predefined_actions.json index c89f37c..10a95f9 100644 --- a/live_predefined_actions.json +++ b/live_predefined_actions.json @@ -1 +1 @@ -[{"id":"Shelly_1PM_Gen1_HTTP_API","name":"Shelly 1PM","actions":[{"name":"TURN","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"deviceAddress","type":"text","placeholder":"like <192.168.0.50> or ","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"timerSeconds","type":"number","min":0}],"presets":{"method":"GET","restUrl":"${deviceAddress}/relay/0?turn=${actionType}&timer=${timerSeconds}","noCorsMode":true}}]},{"id":"Shelly_Plus_Plug_S_Gen1_HTTP_API","name":"Shelly Plug S","actions":[{"name":"TURN","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"deviceAddress","type":"text","placeholder":"like <192.168.0.50> or ","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"timerSeconds","type":"number","min":0}],"presets":{"method":"GET","restUrl":"${deviceAddress}/relay/0?turn=${actionType}&timer=${timerSeconds}","noCorsMode":true}}]}] \ No newline at end of file +[{"id":"Shelly_1PM_Gen1_HTTP_API","name":"Shelly 1PM","actions":[{"name":"cloudControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"cloudAddress","type":"text","placeholder":"likeShellyCloudUrl","autoStartWith":["https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"deviceId","type":"text","placeholder":"likeShellyDeviceId"},{"name":"authCloudKey","type":"text","placeholder":"likeShellyAuthKey"}],"presets":{"method":"POST","restUrl":"${cloudAddress}/device/relay/control","contentType":"application/x-www-form-urlencoded","body":"channel=0&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}"}},{"name":"localControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"deviceAddress","type":"text","placeholder":"likeLocalAddress","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"timerSeconds","type":"number","min":0}],"presets":{"method":"GET","restUrl":"${deviceAddress}/relay/0?turn=${actionType}&timer=${timerSeconds}","noCorsMode":true}}]},{"id":"Shelly_2PM_Gen1_HTTP_API","name":"Shelly 2PM","actions":[{"name":"cloudControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"channel","type":"number","min":0,"placeholder":"<0> or <1>"},{"name":"cloudAddress","type":"text","placeholder":"likeShellyCloudUrl","autoStartWith":["https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"deviceId","type":"text","placeholder":"likeShellyDeviceId"},{"name":"authCloudKey","type":"text","placeholder":"likeShellyAuthKey"}],"presets":{"method":"POST","restUrl":"${cloudAddress}/device/relay/control","contentType":"application/x-www-form-urlencoded","body":"channel=${channel}&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}"}},{"name":"localControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"deviceAddress","type":"text","placeholder":"likeLocalAddress","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"timerSeconds","type":"number","min":0},{"name":"channel","type":"number","min":0,"placeholder":"<0> or <1>"}],"presets":{"method":"GET","restUrl":"${deviceAddress}/relay/${channel}?turn=${actionType}&timer=${timerSeconds}","noCorsMode":true}}]},{"id":"Shelly_Plus_Plug_S_Gen1_HTTP_API","name":"Shelly Plug S","actions":[{"name":"cloudControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"cloudAddress","type":"text","placeholder":"likeShellyCloudUrl","autoStartWith":["https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"deviceId","type":"text","placeholder":"likeShellyDeviceId"},{"name":"authCloudKey","type":"text","placeholder":"likeShellyAuthKey"}],"presets":{"method":"POST","restUrl":"${cloudAddress}/device/relay/control","contentType":"application/x-www-form-urlencoded","body":"channel=0&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}"}},{"name":"localControl","actionModelName":"GridActionHTTP","customValues":[{"name":"actionType","type":"select","values":["on","off","toggle"]},{"name":"deviceAddress","type":"text","placeholder":"likeLocalAddress","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"timerSeconds","type":"number","min":0}],"presets":{"method":"GET","restUrl":"${deviceAddress}/relay/0?turn=${actionType}&timer=${timerSeconds}","noCorsMode":true}}]}] \ No newline at end of file diff --git a/live_predefined_requests_beta.json b/live_predefined_requests_beta.json index 63cb83b..35ef8ed 100644 --- a/live_predefined_requests_beta.json +++ b/live_predefined_requests_beta.json @@ -1 +1 @@ -[{"id":"Shelly_Plus_Plug_S_Gen2+_HTTP_API","name":"Shelly Plug S (Gen2+)","actions":[{"name":"getStatusCloud","actionModelName":"GridActionHTTP","customValues":[{"name":"cloudAddress","type":"text","placeholder":"likeShellyCloudUrl","autoStartWith":["https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"deviceId","type":"text","placeholder":"likeShellyDeviceId"},{"name":"authCloudKey","type":"text","placeholder":"likeShellyAuthKey"}],"presets":{"method":"GET","restUrl":"${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"stateOnOff","selector":"data.device_status.switch:0.output","mappings":{"true":"on","false":"off"}},{"name":"currentPower","selector":"data.device_status.switch:0.apower"},{"name":"currentVoltage","selector":"data.device_status.switch:0.voltage"},{"name":"totalEnergyWh","selector":"data.device_status.switch:0.aenergy.total"},{"name":"temperatureCelsius","selector":"data.device_status.switch:0.temperature.tC"},{"name":"temperatureFahrenheit","selector":"data.device_status.switch:0.temperature.tF"}]}},{"name":"getStatusLocal","actionModelName":"GridActionHTTP","customValues":[{"name":"deviceAddress","type":"text","placeholder":"likeLocalAddress","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""}],"presets":{"method":"GET","restUrl":"${deviceAddress}/rpc/Switch.GetStatus?id=0"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"stateOnOff","selector":"output","mappings":{"true":"on","false":"off"}},{"name":"currentPower","selector":"apower"},{"name":"currentVoltage","selector":"voltage"},{"name":"totalEnergyWh","selector":"aenergy.total"},{"name":"temperatureCelsius","selector":"temperature.tC"},{"name":"temperatureFahrenheit","selector":"temperature.tF"}]}}]}] \ No newline at end of file +[{"id":"Weather_Data","name":"getWeatherData","actions":[{"name":"currentWeatherFromOpen-meteo.com","actionModelName":"GridActionHTTP","customValues":[{"name":"latitude","type":"text","placeholder":"likeLatitude"},{"name":"longitude","type":"text","placeholder":"likeLongitude"}],"presets":{"method":"GET","restUrl":"https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weather_code,cloud_cover,wind_speed_10m"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"temperatureCelsius","selector":"current.temperature_2m"},{"name":"apparentTemperatureCelsius","selector":"current.apparent_temperature"},{"name":"temperatureCelsius","selector":"current.relative_humidity_2m"},{"name":"isDayOrNight","selector":"current.is_day","mappings":{"0":"night","1":"day"}},{"name":"precipitation","selector":"current.precipitation"},{"name":"rain","selector":"current.rain"},{"name":"snowfall","selector":"current.snowfall"},{"name":"weatherDescription","selector":"current.weather_code","mappings":{"0":"day","1":"mainlyClear","2":"partlyCloudy","3":"overcast","45":"fog","48":"rimeFog","51":"drizzleLight","53":"drizzleModerate","55":"drizzleDense","56":"freezingDrizzleLight","57":"freezingDrizzleDense","61":"rainSlight","63":"rainModerate","65":"rainHeavy","66":"freezingRainLight","67":"freezingRainHeavy","71":"snowfallSlight","73":"snowfallModerate","75":"snowfallHeavy","77":"snowGrains","80":"rainShowerSlight","81":"rainShowerModerate","82":"rainShowerViolent","85":"snowShowerSlight","86":"snowShowerHeavy","95":"thunderstorm","96":"thunderstormSlightHail","99":"thunderstormHeavyHail"}},{"name":"cloudCover","selector":"current.cloud_cover"},{"name":"windSpeed","selector":"current.wind_speed_10m"}]}}]},{"id":"Jokes","name":"getJoke","actions":[{"name":"randomJokeFromIcanhazdadjoke.com","actionModelName":"GridActionHTTP","presets":{"method":"GET","restUrl":"https://icanhazdadjoke.com/","acceptHeader":"application/json"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"joke","selector":"joke"}]}}]},{"id":"Shelly_Plus_Plug_S_Gen2+_HTTP_API","name":"Shelly Plug S (Gen2+)","actions":[{"name":"getStatusCloud","actionModelName":"GridActionHTTP","customValues":[{"name":"cloudAddress","type":"text","placeholder":"likeShellyCloudUrl","autoStartWith":["https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""},{"name":"deviceId","type":"text","placeholder":"likeShellyDeviceId"},{"name":"authCloudKey","type":"text","placeholder":"likeShellyAuthKey"}],"presets":{"method":"GET","restUrl":"${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"stateOnOff","selector":"data.device_status.switch:0.output","mappings":{"true":"on","false":"off"}},{"name":"currentPower","selector":"data.device_status.switch:0.apower"},{"name":"currentVoltage","selector":"data.device_status.switch:0.voltage"},{"name":"totalEnergyWh","selector":"data.device_status.switch:0.aenergy.total"},{"name":"temperatureCelsius","selector":"data.device_status.switch:0.temperature.tC"},{"name":"temperatureFahrenheit","selector":"data.device_status.switch:0.temperature.tF"}]}},{"name":"getStatusLocal","actionModelName":"GridActionHTTP","customValues":[{"name":"deviceAddress","type":"text","placeholder":"likeLocalAddress","autoStartWith":["http://","https://"],"mustMatch":"\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\""}],"presets":{"method":"GET","restUrl":"${deviceAddress}/rpc/Switch.GetStatus?id=0"},"extract":{"mode":"EXTRACT_JSON","extractInfos":[{"name":"stateOnOff","selector":"output","mappings":{"true":"on","false":"off"}},{"name":"currentPower","selector":"apower"},{"name":"currentVoltage","selector":"voltage"},{"name":"totalEnergyWh","selector":"aenergy.total"},{"name":"temperatureCelsius","selector":"temperature.tC"},{"name":"temperatureFahrenheit","selector":"temperature.tF"}]}}]}] \ No newline at end of file diff --git a/live_readable/live_predefined_actions.json.readable.json b/live_readable/live_predefined_actions.json.readable.json index 68fa192..1227141 100644 --- a/live_readable/live_predefined_actions.json.readable.json +++ b/live_readable/live_predefined_actions.json.readable.json @@ -4,7 +4,47 @@ "name": "Shelly 1PM", "actions": [ { - "name": "TURN", + "name": "cloudControl", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "actionType", + "type": "select", + "values": [ + "on", + "off", + "toggle" + ] + }, + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "POST", + "restUrl": "${cloudAddress}/device/relay/control", + "contentType": "application/x-www-form-urlencoded", + "body": "channel=0&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}" + } + }, + { + "name": "localControl", "actionModelName": "GridActionHTTP", "customValues": [ { @@ -19,7 +59,7 @@ { "name": "deviceAddress", "type": "text", - "placeholder": "like <192.168.0.50> or ", + "placeholder": "likeLocalAddress", "autoStartWith": [ "http://", "https://" @@ -40,12 +80,145 @@ } ] }, + { + "id": "Shelly_2PM_Gen1_HTTP_API", + "name": "Shelly 2PM", + "actions": [ + { + "name": "cloudControl", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "actionType", + "type": "select", + "values": [ + "on", + "off", + "toggle" + ] + }, + { + "name": "channel", + "type": "number", + "min": 0, + "placeholder": "<0> or <1>" + }, + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "POST", + "restUrl": "${cloudAddress}/device/relay/control", + "contentType": "application/x-www-form-urlencoded", + "body": "channel=${channel}&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}" + } + }, + { + "name": "localControl", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "actionType", + "type": "select", + "values": [ + "on", + "off", + "toggle" + ] + }, + { + "name": "deviceAddress", + "type": "text", + "placeholder": "likeLocalAddress", + "autoStartWith": [ + "http://", + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "timerSeconds", + "type": "number", + "min": 0 + }, + { + "name": "channel", + "type": "number", + "min": 0, + "placeholder": "<0> or <1>" + } + ], + "presets": { + "method": "GET", + "restUrl": "${deviceAddress}/relay/${channel}?turn=${actionType}&timer=${timerSeconds}", + "noCorsMode": true + } + } + ] + }, { "id": "Shelly_Plus_Plug_S_Gen1_HTTP_API", "name": "Shelly Plug S", "actions": [ { - "name": "TURN", + "name": "cloudControl", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "actionType", + "type": "select", + "values": [ + "on", + "off", + "toggle" + ] + }, + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "POST", + "restUrl": "${cloudAddress}/device/relay/control", + "contentType": "application/x-www-form-urlencoded", + "body": "channel=0&turn=${actionType}&auth_key=${authCloudKey}&id=${deviceId}" + } + }, + { + "name": "localControl", "actionModelName": "GridActionHTTP", "customValues": [ { @@ -60,7 +233,7 @@ { "name": "deviceAddress", "type": "text", - "placeholder": "like <192.168.0.50> or ", + "placeholder": "likeLocalAddress", "autoStartWith": [ "http://", "https://" diff --git a/live_readable/live_predefined_requests.json.readable.json b/live_readable/live_predefined_requests.json.readable.json new file mode 100644 index 0000000..adb3fa6 --- /dev/null +++ b/live_readable/live_predefined_requests.json.readable.json @@ -0,0 +1,367 @@ +[ + { + "id": "Shelly_Plus_Plug_S_Gen2+_HTTP_API", + "name": "Shelly Plug S (Gen2+)", + "actions": [ + { + "name": "getStatusCloud", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "GET", + "restUrl": "${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}", + "url": "https://api.open-meteo.com/v1/forecast?latitude=48.2085&longitude=16.3721¤t=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weather_code,cloud_cover,wind_speed_10m" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "data.device_status.switch:0.output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "data.device_status.switch:0.apower" + }, + { + "name": "currentVoltage", + "selector": "data.device_status.switch:0.voltage" + }, + { + "name": "totalEnergyWh", + "selector": "data.device_status.switch:0.aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "data.device_status.switch:0.temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "data.device_status.switch:0.temperature.tF" + } + ] + } + }, + { + "name": "getStatusLocal", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "deviceAddress", + "type": "text", + "placeholder": "likeLocalAddress", + "autoStartWith": [ + "http://", + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + } + ], + "presets": { + "method": "GET", + "restUrl": "${deviceAddress}/rpc/Switch.GetStatus?id=0" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "apower" + }, + { + "name": "currentVoltage", + "selector": "voltage" + }, + { + "name": "totalEnergyWh", + "selector": "aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "temperature.tF" + } + ] + } + } + ] + }, + { + "id": "Shelly_Plus_Plug_S_Gen2+_HTTP_API", + "name": "Shelly Plug S (Gen2+)", + "actions": [ + { + "name": "getStatusCloud", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "GET", + "restUrl": "${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}", + "url": "https://icanhazdadjoke.com/" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "data.device_status.switch:0.output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "data.device_status.switch:0.apower" + }, + { + "name": "currentVoltage", + "selector": "data.device_status.switch:0.voltage" + }, + { + "name": "totalEnergyWh", + "selector": "data.device_status.switch:0.aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "data.device_status.switch:0.temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "data.device_status.switch:0.temperature.tF" + } + ] + } + }, + { + "name": "getStatusLocal", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "deviceAddress", + "type": "text", + "placeholder": "likeLocalAddress", + "autoStartWith": [ + "http://", + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + } + ], + "presets": { + "method": "GET", + "restUrl": "${deviceAddress}/rpc/Switch.GetStatus?id=0" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "apower" + }, + { + "name": "currentVoltage", + "selector": "voltage" + }, + { + "name": "totalEnergyWh", + "selector": "aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "temperature.tF" + } + ] + } + } + ] + }, + { + "id": "Shelly_Plus_Plug_S_Gen2+_HTTP_API", + "name": "Shelly Plug S (Gen2+)", + "actions": [ + { + "name": "getStatusCloud", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "GET", + "restUrl": "${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "data.device_status.switch:0.output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "data.device_status.switch:0.apower" + }, + { + "name": "currentVoltage", + "selector": "data.device_status.switch:0.voltage" + }, + { + "name": "totalEnergyWh", + "selector": "data.device_status.switch:0.aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "data.device_status.switch:0.temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "data.device_status.switch:0.temperature.tF" + } + ] + } + }, + { + "name": "getStatusLocal", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "deviceAddress", + "type": "text", + "placeholder": "likeLocalAddress", + "autoStartWith": [ + "http://", + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + } + ], + "presets": { + "method": "GET", + "restUrl": "${deviceAddress}/rpc/Switch.GetStatus?id=0" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "apower" + }, + { + "name": "currentVoltage", + "selector": "voltage" + }, + { + "name": "totalEnergyWh", + "selector": "aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "temperature.tF" + } + ] + } + } + ] + } +] \ No newline at end of file diff --git a/live_readable/live_predefined_requests_beta.json.readable.json b/live_readable/live_predefined_requests_beta.json.readable.json new file mode 100644 index 0000000..a1b4dad --- /dev/null +++ b/live_readable/live_predefined_requests_beta.json.readable.json @@ -0,0 +1,252 @@ +[ + { + "id": "Weather_Data", + "name": "getWeatherData", + "actions": [ + { + "name": "currentWeatherFromOpen-meteo.com", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "latitude", + "type": "text", + "placeholder": "likeLatitude" + }, + { + "name": "longitude", + "type": "text", + "placeholder": "likeLongitude" + } + ], + "presets": { + "method": "GET", + "restUrl": "https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weather_code,cloud_cover,wind_speed_10m" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "temperatureCelsius", + "selector": "current.temperature_2m" + }, + { + "name": "apparentTemperatureCelsius", + "selector": "current.apparent_temperature" + }, + { + "name": "temperatureCelsius", + "selector": "current.relative_humidity_2m" + }, + { + "name": "isDayOrNight", + "selector": "current.is_day", + "mappings": { + "0": "night", + "1": "day" + } + }, + { + "name": "precipitation", + "selector": "current.precipitation" + }, + { + "name": "rain", + "selector": "current.rain" + }, + { + "name": "snowfall", + "selector": "current.snowfall" + }, + { + "name": "weatherDescription", + "selector": "current.weather_code", + "mappings": { + "0": "day", + "1": "mainlyClear", + "2": "partlyCloudy", + "3": "overcast", + "45": "fog", + "48": "rimeFog", + "51": "drizzleLight", + "53": "drizzleModerate", + "55": "drizzleDense", + "56": "freezingDrizzleLight", + "57": "freezingDrizzleDense", + "61": "rainSlight", + "63": "rainModerate", + "65": "rainHeavy", + "66": "freezingRainLight", + "67": "freezingRainHeavy", + "71": "snowfallSlight", + "73": "snowfallModerate", + "75": "snowfallHeavy", + "77": "snowGrains", + "80": "rainShowerSlight", + "81": "rainShowerModerate", + "82": "rainShowerViolent", + "85": "snowShowerSlight", + "86": "snowShowerHeavy", + "95": "thunderstorm", + "96": "thunderstormSlightHail", + "99": "thunderstormHeavyHail" + } + }, + { + "name": "cloudCover", + "selector": "current.cloud_cover" + }, + { + "name": "windSpeed", + "selector": "current.wind_speed_10m" + } + ] + } + } + ] + }, + { + "id": "Jokes", + "name": "getJoke", + "actions": [ + { + "name": "randomJokeFromIcanhazdadjoke.com", + "actionModelName": "GridActionHTTP", + "presets": { + "method": "GET", + "restUrl": "https://icanhazdadjoke.com/", + "acceptHeader": "application/json" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "joke", + "selector": "joke" + } + ] + } + } + ] + }, + { + "id": "Shelly_Plus_Plug_S_Gen2+_HTTP_API", + "name": "Shelly Plug S (Gen2+)", + "actions": [ + { + "name": "getStatusCloud", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "cloudAddress", + "type": "text", + "placeholder": "likeShellyCloudUrl", + "autoStartWith": [ + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + }, + { + "name": "deviceId", + "type": "text", + "placeholder": "likeShellyDeviceId" + }, + { + "name": "authCloudKey", + "type": "text", + "placeholder": "likeShellyAuthKey" + } + ], + "presets": { + "method": "GET", + "restUrl": "${cloudAddress}/device/status?auth_key=${authCloudKey}&id=${deviceId}" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "data.device_status.switch:0.output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "data.device_status.switch:0.apower" + }, + { + "name": "currentVoltage", + "selector": "data.device_status.switch:0.voltage" + }, + { + "name": "totalEnergyWh", + "selector": "data.device_status.switch:0.aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "data.device_status.switch:0.temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "data.device_status.switch:0.temperature.tF" + } + ] + } + }, + { + "name": "getStatusLocal", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "deviceAddress", + "type": "text", + "placeholder": "likeLocalAddress", + "autoStartWith": [ + "http://", + "https://" + ], + "mustMatch": "\"^(https?:\\/\\/)?(\\d{1,3}\\.){3}\\d{1,3}$\"" + } + ], + "presets": { + "method": "GET", + "restUrl": "${deviceAddress}/rpc/Switch.GetStatus?id=0" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "stateOnOff", + "selector": "output", + "mappings": { + "true": "on", + "false": "off" + } + }, + { + "name": "currentPower", + "selector": "apower" + }, + { + "name": "currentVoltage", + "selector": "voltage" + }, + { + "name": "totalEnergyWh", + "selector": "aenergy.total" + }, + { + "name": "temperatureCelsius", + "selector": "temperature.tC" + }, + { + "name": "temperatureFahrenheit", + "selector": "temperature.tF" + } + ] + } + } + ] + } +] \ No newline at end of file diff --git a/predefined_mappings/i18n/i18n.en.json b/predefined_mappings/i18n/i18n.en.json index 68dd77c..6aaa6e3 100644 --- a/predefined_mappings/i18n/i18n.en.json +++ b/predefined_mappings/i18n/i18n.en.json @@ -22,5 +22,49 @@ "likeLocalAddress": "like <192.168.0.50> or ", "getStatusCloud": "Get status (cloud)", "getStatusLocal": "Get status (local)", - "totalEnergyWh": "Total energy [Wh]" + "totalEnergyWh": "Total energy [Wh]", + "currentWeatherFromOpen-meteo.com": "Current weather (open-meteo.com)", + "latitude": "Latitude", + "likeLatitude": "like <48.20831131203846>", + "longitude": "Longitude", + "likeLongitude": "like <16.37130426553475>", + "apparentTemperatureCelsius": "Apparent temperature [°C]", + "isDayOrNight": "Day or Night", + "night": "Night", + "day": "Day", + "precipitation": "Precipitation [mm]", + "rain": "Rain [mm]", + "snowfall": "Snowfall [cm]", + "weatherDescription": "Weather description", + "mainlyClear": "Mainly clear", + "partlyCloudy": "Partly cloudy", + "overcast": "Overcast", + "fog": "Fog", + "rimeFog": "Rime fog", + "drizzleLight": "Light drizzle", + "drizzleModerate": "Moderate drizzle", + "drizzleDense": "Dense drizzle", + "freezingDrizzleLight": "Light freezing drizzle", + "freezingDrizzleDense": "Dense freezing drizzle", + "rainSlight": "Slight rain", + "rainModerate": "Moderate rain", + "rainHeavy": "Heavy rain", + "freezingRainLight": "Light freezing rain", + "freezingRainHeavy": "Heavy freezing rain", + "snowfallSlight": "Slight snowfall", + "snowfallModerate": "Moderate snowfall", + "snowfallHeavy": "Heavy Snowfall", + "snowGrains": "Snow grains", + "rainShowerSlight": "Slight rain shower", + "rainShowerModerate": "Moderate rain shower", + "rainShowerViolent": "Violent rain shower", + "snowShowerSlight": "Slight snow shower", + "snowShowerHeavy": "Heavy snow shower", + "thunderstorm": "Thunderstorm", + "thunderstormSlightHail": "Thunderstorm with slight hail", + "thunderstormHeavyHail": "Thunderstorm with heavy hail", + "cloudCover": "Cloud cover [%]", + "windSpeed": "Wind speed [km/h]", + "randomJokeFromIcanhazdadjoke.com": "Random joke from icanhazdadjoke.com", + "joke": "joke" } \ No newline at end of file diff --git a/predefined_mappings/requests/Current_weather_open-meteo.com.json b/predefined_mappings/requests/Current_weather_open-meteo.com.json new file mode 100644 index 0000000..f6562f6 --- /dev/null +++ b/predefined_mappings/requests/Current_weather_open-meteo.com.json @@ -0,0 +1,105 @@ +{ + "id": "Weather_Data", + "name": "getWeatherData", + "actions": [ + { + "name": "currentWeatherFromOpen-meteo.com", + "actionModelName": "GridActionHTTP", + "customValues": [ + { + "name": "latitude", + "type": "text", + "placeholder": "likeLatitude" + }, + { + "name": "longitude", + "type": "text", + "placeholder": "likeLongitude" + } + ], + "presets": { + "method": "GET", + "restUrl": "https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weather_code,cloud_cover,wind_speed_10m" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "temperatureCelsius", + "selector": "current.temperature_2m" + }, + { + "name": "apparentTemperatureCelsius", + "selector": "current.apparent_temperature" + }, + { + "name": "temperatureCelsius", + "selector": "current.relative_humidity_2m" + }, + { + "name": "isDayOrNight", + "selector": "current.is_day", + "mappings": { + "1": "day", + "0": "night" + } + }, + { + "name": "precipitation", + "selector": "current.precipitation" + }, + { + "name": "rain", + "selector": "current.rain" + }, + { + "name": "snowfall", + "selector": "current.snowfall" + }, + { + "name": "weatherDescription", + "selector": "current.weather_code", + "mappings": { + "0": "day", + "1": "mainlyClear", + "2": "partlyCloudy", + "3": "overcast", + "45": "fog", + "48": "rimeFog", + "51": "drizzleLight", + "53": "drizzleModerate", + "55": "drizzleDense", + "56": "freezingDrizzleLight", + "57": "freezingDrizzleDense", + "61": "rainSlight", + "63": "rainModerate", + "65": "rainHeavy", + "66": "freezingRainLight", + "67": "freezingRainHeavy", + "71": "snowfallSlight", + "73": "snowfallModerate", + "75": "snowfallHeavy", + "77": "snowGrains", + "80": "rainShowerSlight", + "81": "rainShowerModerate", + "82": "rainShowerViolent", + "85": "snowShowerSlight", + "86": "snowShowerHeavy", + "95": "thunderstorm", + "96": "thunderstormSlightHail", + "99": "thunderstormHeavyHail" + } + }, + { + "name": "cloudCover", + "selector": "current.cloud_cover" + }, + { + "name": "windSpeed", + "selector": "current.wind_speed_10m" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/predefined_mappings/requests/Random_joke_icanhazdadjoke.com.json b/predefined_mappings/requests/Random_joke_icanhazdadjoke.com.json new file mode 100644 index 0000000..f2c19d6 --- /dev/null +++ b/predefined_mappings/requests/Random_joke_icanhazdadjoke.com.json @@ -0,0 +1,24 @@ +{ + "id": "Jokes", + "name": "getJoke", + "actions": [ + { + "name": "randomJokeFromIcanhazdadjoke.com", + "actionModelName": "GridActionHTTP", + "presets": { + "method": "GET", + "restUrl": "https://icanhazdadjoke.com/", + "acceptHeader": "application/json" + }, + "extract": { + "mode": "EXTRACT_JSON", + "extractInfos": [ + { + "name": "joke", + "selector": "joke" + } + ] + } + } + ] +} \ No newline at end of file