ralph.poh Posted June 24, 2024 Posted June 24, 2024 Hello, I am trying to get the sun position with a script. This did work properly last year. Since this year my script isn't working any more. What could be the failure? function SunPos() { //Sonnenposition mittels ipgeolocation API zum aktuellen Zeitpunkt prüfen print("SunPos gestartet"); Shelly.call( "http.get", {url: "http://api.ipgeolocation.io/astronomy?apiKey=myKey&lat=49.1877&long=8.16339"}, function (response, error_code, error_message) { //print("http.get gestartet"); if (error_code === 0) { let sonne = JSON.parse(response.body); let azimuth = Math.round(sonne.sun_azimuth); let altitude = Math.round(sonne.sun_altitude); print("Azimuth :", azimuth); print("Altitude :", altitude); //Beschattung Süd-Fenster An //Ergänzt am 28.01.2023 " && altitude >= 12" if (azimuth > 100 && azimuth < 245) { //Aktionen print("Beschattung Süd AN"); Shelly.call("Switch.set", {'id': 0, 'on': true}); //Ausgang 1 einschalten } //Beschattung Süd-Fenster aufheben if (azimuth > 245) { //Aktionen print("Beschattung Süd AUS Azimuth"); Shelly.call("Switch.set", {'id': 0, 'on': false}); } if (altitude < 12) { //Aktionen print("Beschattung Süd AUS Altitude"); Shelly.call("Switch.set", {'id': 0, 'on': false}); } } else { print("Fehler:", error_message); } }, ); } The JSON returned looks like this: {"location":{"latitude":49.1877,"longitude":8.16339},"date":"2024-06-24","current_time":"08:06:20.788","sunrise":"05:23","sunset":"21:36","sun_status":"-","solar_noon":"13:29","day_length":"16:13","sun_altitude":23.298918681102815,"sun_distance":152049111.66664976,"sun_azimuth":80.62990251132766,"moonrise":"-:-","moonset":"07:26","moon_status":"-","moon_altitude":-4.919695650588063,"moon_distance":373453.9905188856,"moon_azimuth":237.68901808084172,"moon_parallactic_angle":37.338065434948206} Can anyone please help? Quote Translate Revert translation? English (American) French German Italian Polish Portuguese (European) Spanish
Damjan64 Posted June 25, 2024 Posted June 25, 2024 Something is wrong with this call: https://api.ipgeolocation.io/astronomy?apiKey=myKey&lat=49.1877&long=8.16339 because it returns an error: { "message": "Provided API key is not valid. Contact technical support for assistance at [email protected]" } Quote Translate Revert translation? English (American) French German Italian Polish Portuguese (European) Spanish
ralph.poh Posted June 26, 2024 Author Posted June 26, 2024 Hallo Damjan64, ich habe natürlich meinen eigen API-Key aus dieser Zeile entfernt. Ich kann dir diesen für Testzwecke zur Verfügung stellen. Schreib mir einfach eine PM. Gruß Ralph Quote Translate Revert translation? English (American) French German Italian Polish Portuguese (European) Spanish
Checker Posted June 29, 2024 Posted June 29, 2024 Hi, sind die 'requests per month' überschritten worden? Wie oft wird das Script denn ausgeführt? Quote Translate Revert translation? English (American) French German Italian Polish Portuguese (European) Spanish
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.