Skip to content

Shelly Plus Plug valo-ohjaus pörssisähkön hinnan perusteella - RGB-light control for Shelly Plus Plug by Nord Pool electricity price

License

Notifications You must be signed in to change notification settings

jisotalo/shelly-plug-nordpool-light

Repository files navigation

shelly-plug-nordpool-light

License GitHub Support

Pörssisähkön hinnan mukaan valoa ohjaava skripti Shelly Plus Plug S -etäohjattavaan pistorasiaan. Skripti konfiguroidaan selaimella toimivalla käyttöliittymällä kotiverkosta. Käyttää Eleringin rajapintaa eikä vaadi rekisteröitymistä. Tällä saat esimerkiksi "liikennevalot" näyttämään sähkön hintaa.

Huom: Tämä skripti ei ohjaa pistorasialähtöä! Tämä ainoastaan asettaa RGB-valon hinnan mukaan. Jos haluat ohjata pistorasiaa pörssisähkön hinnan mukaan, katso toinen projektini shelly-porssisahko. Voit laittaa molemmat skriptit toimimaan samanaikaisesti samassa laitteessa.


A script for Shelly Plus Plug S to control the RGB light based on active Nord Pool electricity price. The prices are available for Finland, Estonia, Latvian and Lithuania. Settings can be adjusted using web-based UI in the local network. Uses Elering API, so no registeration is needed.

Note: This script does not control the output - it only handles the RGB LED color. If you want to control the output based on electricity price, see my other project shelly-porssisahko. You can run both scripts at the same time.

image

shelly-plug-nordpool-light gif

Sisällysluettelo / Table of Contents

Suomeksi

Ominaisuudet

  • Ilmainen sekä avoin lähdekoodi
  • Oma web-serveri Shellyn sisällä ja siinä pyörivä käyttöliittymä
  • Ei rekisteröitymistä
  • Valvonta ja konfigurointi nettiselaimen avulla kotiverkossa (PC, puhelin, tabletti)
  • Vapaasti konfiguroitava väri, kirkkaus ja vilkutus* eri hinnoille ja vikatilanteelle
  • Asetusten testaus ennen tallennusta
  • Mahdollista himmentää kirkkautta ja vilkutusta yön ajaksi
  • Mahdollista asettaa eri kirkkaus jos lähtö on päällä

* Vilkutuksen käyttö kuluttaa laitteen muistia pitkässä juoksussa - käytä ainoastaan vikatilanteessa tai harvinaisessa hintatilanteessa. Käyttö omalla vastuulla.

Asennus

HUOMIO: Skripti vaatii firmwaren 1.0.7 tai uudemman

  1. Ota Shelly käyttöön, yhdistä se wifi-verkkoon ja päivitä sen firmware. Avaa Shellyn hallinta nettiselaimella.

  2. Laita Websocket debug päälle (Settings -> Debug -> Enable websocket debug). Näin näet suoraan hallintapaneelin osoitteen skriptin alla.

  3. Avaa Scripts-sivu Shellyn hallinnasta

  4. Paina Library-painiketta

    image

  5. Aukeavassa ikkunassa paina Configure URL

    image

  6. Syötä osoitteeksi https://github.com/raw/jisotalo/shelly-plug-nordpool-light/master/shelly-library.json ja paina Save

    image

  7. Nyt kirjastoon ilmestyy tämä skripti. Asenna se painamalla Import code

    image

  8. Kun skripti ilmestyy, paina Save

    image

  9. Tallentamisen jälkeen paina Start, jolloin skripti käynnistyy

    image

  10. Jos websocket debug on päällä (kohta 2), näet hallinnan osoitteen suoraan skriptin alla konsolissa. Kopioi tämä osoite ja avaa se selaimella. Jos et näe sitä niin osoite on muotoa http://ip-osoite/script/1 (jos kyseessä on 1. skripti)

    image

  11. Varmista vielä että skripti käynnistyy aina automaattisesti. Eli Scripts-sivulla pitää shelly-plug-nordpool-light.js -skriptin kohdalla olla valinta päällä.

    image

  12. Valmis! Avaa käyttöliittymä selaimessa (kohta 10) ja säädä asetukset kohdilleen Asetukset-kappaleen ohjeilla.

Asetukset

image

Asetus Selite Esim. (kuva yllä)
Country Maa/alue, jolle hinta haetaan Finland
VAT-% Käytettävä ALV-% sähkön hinnalle. [%] 24 %
Output on Paljonko kirkkautta muutetaan jos lähtö on päällä. [%]

100 % = alkuperäinen / ei muutosta
150 %
 
Night settings Asetukset yötä varten
Night time Aikaväli, jolloin yöasetukset ovat käytössä. 22:00-06:00
Brightness adjust Paljonko kirkkautta muutetaan

100 % = alkuperäinen / ei muutosta
50 %
Blink allowed Sallitaanko vilkutus yöaikaan ei
 
Rules Sääntöjen hinta- ja väriasetukset
≥ c/kWh Hintaraja, jonka yläpuolella sääntö on aktiivinen. [c/kWh]

Jos hinnan jättää tyhjäksi, sääntö ei ole käytössä.
#1: -999 c/kWh
Color Käytettävä väri. Syötä arvo käsin tai paina laatikkoa avataksesi värivalinnan. #1: 0, 255, 0 (vihreä)
Brightness Valon kirkkaus [%] #1: 10 %
Blink* Jos päällä, valoa vilkutetaan 2s välein #1: ei

* Vilkutuksen käyttö kuluttaa laitteen muistia pitkässä juoksussa - käytä ainoastaan vikatilanteessa tai harvinaisessa hintatilanteessa. Käyttö omalla vastuulla.

Esimerkkikuvan asetuksilla säännöt toimivat seuraavasti:

  • Jos hintaa ei saada haettua - väri on punainen ja valo vilkkuu
  • Hinta < 5 c/kWh - väri on vihreä (sääntö #1)
  • Hinta 5...10 c/kWh - väri on keltainen (sääntö #2)
  • ...
  • Hinta > 20 c/kWh - väri on punainen (sääntö #5)

Kysymyksiä ja vastauksia

Miksi sääntöjä on vain kuusi kappaletta?

Shellyn KVS-muistiin mahtuu 256 tavua dataa. Enempää sääntöasetuksia ei mahdu muistiin järkevästi.

In English

Features

  • Free and open source
  • Own webserver that runs UI
  • No registeration
  • Monitoring and configuration using web browser in local network
  • Freely configurable color, brightness and blink* for each price and error situation
  • Testing setting before saving
  • Possible to adjust brightness and blink during night-time
  • Possible to adjust brighness when output is on

* Using blink might cause device lifetime to decrease. Use only in error situation or in rare price condition. Use at your own risk.

Installation

NOTE: Script requires firmware 1.0.7 or newer

  1. Commission the Shelly product, connect it to a wifi and update the firmware. Open Shelly web admin panel with the web browser.

  2. Enable Websocket debug (Settings -> Debug -> Enable websocket debug) to see UI address in the console below the script.

  3. Open Scripts page from Shelly

  4. Press Library button

    image

  5. In the window that opens, press Configure URL

    image

  6. Enter address https://github.com/raw/jisotalo/shelly-plug-nordpool-light/master/shelly-library.json and press Save

    image

  7. Now this script should be visible. Add it by pressing Import code

    image

  8. After script has been installed, press Save

    image

  9. After saving, press Start to start the script

    image

  10. If websocket debug is enabled (step 2), the UI address is seen in the console just below the script code. Copy the address and open it in your web browser. The address is in a format of http://ip-address/script/1 (if this is 1st script)

    image

  11. Check that script starts automatically. In Scripts page the shelly-plug-nordpool-light.js script should have the switch in enabled position.

    image

  12. Ready! Open UI in browser and continue with setting up the script (see Settings chapter).

Settings

image

Setting Description Example (picture above)
Country Country/group to get the price for Finland
VAT-% VAT-% added to electricity price [%] 24 %
Output on How much to adjust the brightness if output is on. [%]

100% = original / no changes
150 %
 
Night settings
Night time Time period to use night settings for 22:00-06:00
Brightness adjust How much to adjust brightness during night period

100% = original / no changes
50 %
Blink allowed Is blink allowed during night time no
 
Rules Price and color settings for each rule
≥ c/kWh If price is over this limit, the rule is active. [c/kWh]

If empty, the rule is not in use.
#1: -999 c/kWh
Color Color to use. Enter it manually or press the rectangle to open a color picker. #1: 0, 255, 0 (green)
Brightness Light brightness [%] #1: 10 %
Blink* If true, the the light is blinking every 2s #1: no

* Using blink might cause device lifetime to decrease. Use only in error situation or in rare price condition. Use at your own risk.

In the example picture above, the rules work as follows:

  • If no price is available - color is red and light is blinking
  • Price < 5 c/kWh - color is green (rule #1)
  • Price 5...10 c/kWh - color is yellow (rule #2)
  • ...
  • Price > 20 c/kWh - color is red (rule #5)

FAQ

Why there are maximum of six rules?

Shelly KVS memory has 256 bytes of space. There isn't any free space to add more rules without too much work.

License

GNU Affero General Public License v3.0 - LICENSE.txt