Skip to content

This feature allows you to view the exact cost of your electricity usage in Shelly Cloud using Live Tariff if you have any Shelly power monitoring device installed.

License

Notifications You must be signed in to change notification settings

LeivoSepp/Shelly-Live-Tariff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shelly Live Tariff Script

Tip

This feature allows you to view the exact cost of your electricity usage in Shelly Cloud using Live Tariff if you have any Shelly power monitoring device installed.

Shelly Live Tariff

Features

This Shelly script automates electricity tariffs in the Shelly cloud by retrieving energy market prices from Elering and updating the Live Tariff hourly.

  • Retrieves electricity market prices from Elering.
  • Updates Shelly cloud with Live Tariffs hourly or every 15min.
  • Supports multiple network packages and countries.
  • Stores user settings in Shelly KVS or Virtual components (gen2 Pro or never devices).
  • Automatically starts on boot.

Installation

New installation

  1. Copy the contents of ShellyLiveTariff.js to your Shelly device's script editor.
  2. Run the script to create KVS or Virtual Components.
  3. Configure script settings either in KVS or using Virtual Components.
    • networkPacket: Set the energy transmission packet (VORK2, Partner24 etc).
    • IsEnergy15min / Meter supports: 1h or 15min electricity meter. Default value 1h (false), set it 15min or true only if your meter supports it.
    • country: Set the country (ee for Estonia, fi for Finland etc).
    • apiUrl: Shelly Cloud token.
  4. Run the script again. Now everything is fully automatic.

Configuration using Virtual Components

Shelly Gen2 Pro and never devices supports Virtual Components, with all settings managed directly through the Shelly web page or mobile app.
Please make sure to configure properly Shelly API URL and Network Package, as well as country.

Note

The script will always update the field Live Tariff Updated with the date and time when new tariff was uploaded to Shelly Cloud.

Enable Shelly Live Tariff

How to force script to KVS mode

Tip

This script can be forced to KVS mode even if Virtal Components are available.

You want to have this in KVS mode in case you have other important scripts already using Virtual Components in the same device.
Open the script and set the ManualKVS parameter mnKv: true. Now the script will install in KVS mode.

let c = {
    pack: "VORK2",     // NONE, VORK1, VORK2, VORK4, VORK5, PARTN24, PARTN24PL, PARTN12, PARTN12PL, PAMATA1, SPECIAL1
    is15: false,       // 1h or 15min measurements
    cnty: "ee",        // Estonia-ee, Finland-fi, Lithuania-lt, Latvia-lv
    api: "API_url",    // Shelly Cloud token
    mnKv: false,       // Forcing KVS mode in case of Virtual components support
}

Configuration using KVS

Important

There is a bug in Shelly firmware version 1.7.1 that prevents saving JSON data to KVS. You can view the data, but you cannot modify or save it.

Therefore, when using KVS mode, the script parameters (such as network package, API URL, etc.) must be defined directly within the script itself before installation.

If the script in KVS mode, then settings can be modified via the device's web page using its IP address: Menu → Advanced → KVS.
All the user settings are stored in JSON format under the key LiveTariffConf.

  • API: Set your Shelly Cloud token.
  • IsEnergy15min: 1h or 15min electricity meter. Default value 1h (false), set it 15min or true only if your meter supports it.
  • EnergyProvider: Choose the appropriate network package (e.g., VORK2, PARTN24, etc.).
  • Country: Set the country code (e.g., ee for Estonia, fi for Finland, etc.).

Enable Shelly Live Tariff

Supported Network Packages

The script supports the following network packages from Elektrilevi and Imatra:

  • VORK1
  • VORK2
  • VORK4
  • VORK5
  • PARTN24
  • PARTN24P
  • PARTN12
  • PARTN12P
  • PAMATA1
  • SPECIAL1
  • NONE

Supported Countries

  • ee (Estonia)
  • fi (Finland)
  • lv (Latvia)
  • lt (Lithuania)

Shelly Live Tariff Configuration

Configure Shelly cloud to use Live Tariff

  1. Open Shelly web portal
  2. Select Energy -> Electricity Tariff
  3. Under Tariff select Live
  4. Copy API URL and paste it to Live Tariff settings.

Enable Shelly Live Tariff

Updating the Script

To update the script, simply copy the new code into the Shelly code editor — everything will continue to work automatically, since the configuration is stored in Virtual Components or in the KVS storage.

Important

With the addition of 15-minute electricity meter support, a new virtual component has been introduced, which is created only during a fresh script installation. Follow these steps:

  • Delete the LiveTariffConf entry from the KVS storage.
  • Run the script — this will trigger a new LiveTariff installation.
  • Reconfigure the API URL and other necessary parameters.

Usage

Device configuration

There are various ways to configure Shelly devices to ensure the Shelly Cloud energy measurement and cost reports appears accurate and well-organized.

  1. Shelly Pro 3EM + Individual Shelly Power Monitoring Devices in the Same Room.
    To avoid double-counting energy costs at the room or total account level, devices must be configured properly:
    • Configure Shelly Pro 3EM to include power monitoring in both the room and total account levels.
    • Configure other Shelly monitoring devices in the same room to exclude their data from the total room and total account energy.
Shelly Live Tariff Shelly Live Tariff
  1. Shelly Pro 3 EM at Account level + Individual Shelly Power Monitoring Devices in the Different Rooms.
    To avoid missing energy costs at the room or double-counting at the total account level, devices must be configured properly:
    • Configure Shelly Pro 3EM to include power monitoring in total account level.
    • Configure other Shelly monitoring devices to include their data fom the total room and exclude from total account energy.
Shelly Live Tariff Shelly Live Tariff
  1. Individual Shelly Power Monitoring Devices in the Different Rooms. Account level measurement is missing.
    To avoid missing energy costs at the total account level, devices must be configured properly:
    • Configure every Shelly monitoring devices to include power monitoring in both the room and total account levels.

Cost monitoring

There are many ways to explore the electricity usage cost.

  1. Total Cost. Open the Shelly Cloud Total Energy history to explore the total cost across your entire energy usage.

Shelly Live Tariff

  1. Room Cost. Open the Shelly Cloud Total Energy history and scroll down to explore the energy cost for any individual room.

Shelly Live Tariff

  1. Phase Cost. This feature is available only if you have a Shelly Pro 3EM. Open the Shelly device consumption page and hover over the graph with your mouse or finger to explore the individual phase and total energy costs passing through the device.

Shelly Live Tariff

  1. Device Cost. Open the consumption page of any power monitoring Shelly device to explore the cost at the device level.

Enable Shelly Live Tariff

Script Monitoring

  • The Virtual Component Live Tariff updated is updated whenever the tariff is sent to the Shelly Live Tariff cloud.
  • Fields LastCalculation and TariffUpdated under the LiveTariffSys in KVS is updated whenever electricity prices are pulled from Elering and the tariff is sent to the Shelly Live Tariff cloud.
  • The script will automatically run and update the Shelly Cloud Live Tariffs on an hourly basis.
  • To modify user settings, access the Shelly KVS via the Shelly web page: Menu → Advanced → KVS.
  • If your Shelly device supports Virtual components, you can modify settings directly from the Shelly web page or Shelly mobile app.

Last Updated data in KVS

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Created by Leivo Sepp, 07.01.2025

Shelly Live Tariff - GitHub Repository

About

This feature allows you to view the exact cost of your electricity usage in Shelly Cloud using Live Tariff if you have any Shelly power monitoring device installed.

Topics

Resources

License

Stars

Watchers

Forks