Skip to content

Commit

Permalink
added predefined requests for jokes and weather, asterics/AsTeRICS-Gr…
Browse files Browse the repository at this point in the history
  • Loading branch information
klues committed Feb 18, 2025
1 parent 3cb3087 commit ab28a65
Show file tree
Hide file tree
Showing 8 changed files with 972 additions and 7 deletions.
2 changes: 1 addition & 1 deletion live_predefined_actions.json
Original file line number Diff line number Diff line change
@@ -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 <https://192.168.0.50>","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 <https://192.168.0.50>","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_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}}]}]
2 changes: 1 addition & 1 deletion live_predefined_requests_beta.json
Original file line number Diff line number Diff line change
@@ -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"}]}}]}]
[{"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}&current=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"}]}}]}]
181 changes: 177 additions & 4 deletions live_readable/live_predefined_actions.json.readable.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -19,7 +59,7 @@
{
"name": "deviceAddress",
"type": "text",
"placeholder": "like <192.168.0.50> or <https://192.168.0.50>",
"placeholder": "likeLocalAddress",
"autoStartWith": [
"http://",
"https://"
Expand All @@ -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": [
{
Expand All @@ -60,7 +233,7 @@
{
"name": "deviceAddress",
"type": "text",
"placeholder": "like <192.168.0.50> or <https://192.168.0.50>",
"placeholder": "likeLocalAddress",
"autoStartWith": [
"http://",
"https://"
Expand Down
Loading

0 comments on commit ab28a65

Please sign in to comment.