diff --git a/README.md b/README.md index a0e2047..2bbb67c 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,10 @@ Enjoy automatic control of your relays when the electricity price is cheap (or.. ## Shelly scripts in this package -1. "Pikakoodi" - this script is for Finnish market to provide simple pre-defined rules for heating. -2. "Minimal heating" - this script is a minimal but still very versatile script for, for example water boiler heating -3. "SmartHeating" - this script is Smart! It can control heating based on outdoor temperature plus much more! -4. "Rank and Price limit" - this script can control two relays according to the fixed price, average price and also using the cheapest hours -5. "SmartMonitoring" - Stores history of relay status changes in spot-hinta.fi cloud. Monitors Internet connection and script executions. -6. "Street light" - Shows Green/Yellow/Red color led depending on electricity price. Only for Shelly Plus Plug S -device! +1. "Vesivaraaja" - This script is for Finnish market and designed especially for water boiler heating (night and afternoon hours) +2. "Pikakoodi" - this script is for Finnish market to provide simple pre-defined rules for heating. +3. "Minimal heating" - this script is a minimal but still very versatile script for, for example water boiler heating +4. "SmartHeating" - this script is Smart! It can control heating based on outdoor temperature plus much more! +5. "Rank and Price limit" - this script can control two relays according to the fixed price, average price and also using the cheapest hours +6. "SmartMonitoring" - Stores history of relay status changes in spot-hinta.fi cloud. Monitors Internet connection and script executions. +7. "Street light" - Shows Green/Yellow/Red color led depending on electricity price. Only for Shelly Plus Plug S -device! diff --git a/Scripts/Shelly-Minimal-Heating.js b/Scripts/Shelly-Minimal-Heating.js index c9ba52a..5fa355c 100644 --- a/Scripts/Shelly-Minimal-Heating.js +++ b/Scripts/Shelly-Minimal-Heating.js @@ -1,11 +1,11 @@ -// You can support spot-hinta.fi service here: https://www.buymeacoffee.com/spothintafi -// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2023-12-22 +// Thank you for your support: https://www.buymeacoffee.com/spothintafi +// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2024-01-21 // Change these settings as you like let Region = "FI"; // Supported regions: DK1, DK2, EE, FI, LT, LV, NO1, NO2, NO3, NO4, NO5, SE1, SE2, SE3, SE4 -let Relays = [0]; // Relays to control with this script. List relays as comma separated. For example: [0,1,2] +let Relays = [0]; // Relays to control. For example: [0,1,2] let CheapestHours = "4"; // How many cheapest hours relay will be turned on? To ONLY use a price limit, put CheapestHours to "0". -let OnlyNightHours = false; // false == cheapest hours can be any during day. true == cheapest hours are only searched from the night hours (22:00 - 07:00) +let OnlyNightHours = false; // If true, cheapest hours are only searched from the night hours (22:00 - 07:00), false == all hours let PriceAlwaysAllowed = "0"; // Below what hour price the relay can be always on (or off, if inverted)? Value is in full euro cents. Use "-999" to disable. let BackupHours = [3, 4, 5, 6]; // If Internet connection is down, turn relay ON during these hours (0...23). Use [99], if you don't want any backup hours. let Inverted = false; // If "true", relay logic is inverted (= relay is turned ON when price is too exepensive and OFF when cheap) diff --git a/Scripts/Shelly-Pikakoodi.js b/Scripts/Shelly-Pikakoodi.js index c807572..dc5059b 100644 --- a/Scripts/Shelly-Pikakoodi.js +++ b/Scripts/Shelly-Pikakoodi.js @@ -1,5 +1,5 @@ -// Voit halutessasi tukea palvelun ylläpitoa täällä: https://www.buymeacoffee.com/spothintafi -// Tuetut Shelly laiteohjelmistoversiot: 1.0.3 - 1.1.0. Skriptin versio: 2023-12-22 +// Kiitos tuestasi: https://www.buymeacoffee.com/spothintafi +// Tuetut Shelly ohjelmistot: 1.0.3 - 1.1.0. Skriptin versio: 2024-01-21 // Asetukset let Pikakoodi = 103; // Hae sopiva pikakoodi: https://spot-hinta.fi/pikakoodit diff --git a/Scripts/Shelly-PlusPlugS-StreetLight.js b/Scripts/Shelly-PlusPlugS-StreetLight.js index ed47438..b97d775 100644 --- a/Scripts/Shelly-PlusPlugS-StreetLight.js +++ b/Scripts/Shelly-PlusPlugS-StreetLight.js @@ -1,5 +1,5 @@ -// You can support spot-hinta.fi service here: https://www.buymeacoffee.com/spothintafi -// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2023-12-22 +// Thank you for your support: https://www.buymeacoffee.com/spothintafi +// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2024-01-21 // NOTE! This script works only with "Shelly Plus Plug S" -smart plug diff --git a/Scripts/Shelly-Rank-and-Price.js b/Scripts/Shelly-Rank-and-Price.js index 6cfb00c..c8a1e33 100644 --- a/Scripts/Shelly-Rank-and-Price.js +++ b/Scripts/Shelly-Rank-and-Price.js @@ -1,5 +1,5 @@ -// You can support spot-hinta.fi service here: https://www.buymeacoffee.com/spothintafi -// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2023-12-22 +// Thank you for your support: https://www.buymeacoffee.com/spothintafi +// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2024-01-21 // Region to use let Region = "FI"; // Supported regions: DK1, DK2, EE, FI, LT, LV, NO1, NO2, NO3, NO4, NO5, SE1, SE2, SE3, SE4 diff --git a/Scripts/Shelly-SmartHeating.js b/Scripts/Shelly-SmartHeating.js index 3cb311f..d85e995 100644 --- a/Scripts/Shelly-SmartHeating.js +++ b/Scripts/Shelly-SmartHeating.js @@ -1,5 +1,5 @@ -// You can support spot-hinta.fi service here: https://www.buymeacoffee.com/spothintafi -// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2023-12-22 +// Thank you for your support: https://www.buymeacoffee.com/spothintafi +// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2024-01-21 // SmartHeating: outdoor temperature controlled heating with a possibility to control multiple relays with the same rules // It is possible to configure the heating curve with a seven temperature points. diff --git a/Scripts/Shelly-SmartMonitoring.js b/Scripts/Shelly-SmartMonitoring.js index ecee6c9..a2d8234 100644 --- a/Scripts/Shelly-SmartMonitoring.js +++ b/Scripts/Shelly-SmartMonitoring.js @@ -1,5 +1,5 @@ -// You can support spot-hinta.fi service here: https://www.buymeacoffee.com/spothintafi -// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2023-12-22 +// Thank you for your support: https://www.buymeacoffee.com/spothintafi +// Supported Shelly firmwares: 1.0.3 - 1.1.0. Script version: 2024-01-21 // Common settings const Region = "FI"; // Supported regions: DK1, DK2, EE, FI, LT, LV, NO1, NO2, NO3, NO4, NO5, SE1, SE2, SE3, SE4 diff --git a/Scripts/Shelly-Vesivaraaja.js b/Scripts/Shelly-Vesivaraaja.js new file mode 100644 index 0000000..7725cf7 --- /dev/null +++ b/Scripts/Shelly-Vesivaraaja.js @@ -0,0 +1,20 @@ +// Kiitos tuestasi: https://www.buymeacoffee.com/spothintafi +// Tuetut Shelly ohjelmistot: 1.0.3 - 1.1.0. Skriptin versio: 2024-01-21 + +// ASETUKSET +let TUNNIT_YO = 3; // Yötuntien lukumäärä 22:00 - 06:59? +let TUNNIT_IP = 0; // Iltapäivätuntien lukumäärä 12:00 - 19:59? +let RELE = 0; // Mitä relettä ohjataan? + +// KOODI +let url = "https://api.spot-hinta.fi/WaterBoiler/" + TUNNIT_YO + "/" + TUNNIT_IP; let hour = null; +print("WaterBoiler: Ohjaus käynnistyy 30 sekunnissa."); +Timer.set(30000, true, function () { + if (hour == new Date().getHours()) { print("WaterBoiler: Odotetaan tunnin vaihtumista."); return; } + Shelly.call("HTTP.GET", { url: url, timeout: 15, ssl_ca: "*" }, function (res, err) { + hour = (err != 0 || res == null || (res.code !== 200 && res.code !== 400)) ? null : new Date().getHours(); + let on = hour ? res.code != 400 : true; + Shelly.call("Switch.Set", "{ id:" + RELE + ", on:" + on + "}", null, null); + print("WaterBoiler: Kytketty " + (on ? "päälle" : "pois päältä") + (hour ? "." : " (virhetilanne).")); + }); +}); \ No newline at end of file diff --git a/Scripts/Shelly-manifest.json b/Scripts/Shelly-manifest.json index 3754b89..a0fa1f1 100644 --- a/Scripts/Shelly-manifest.json +++ b/Scripts/Shelly-manifest.json @@ -1,4 +1,9 @@ [ + { + "fname": "Shelly-Vesivaraaja.js", + "title": "Suomenkielinen lämminvesivaraaja-skripti", + "description": "Todella helppo skripti lämminvesivaraajalle! Valitse kuinka monta halvinta tuntia varaaja lämmitetään yöllä ja iltapäivällä. (Finnish region only)" + }, { "fname": "Shelly-Pikakoodi.js", "title": "Suomenkielinen pikakoodi-skripti",