Advanced Load Shedding Using a Script
Load shedding is the intentional, temporary reduction of electrical power supply to certain appliances and/or circuits. This is done to reduce electrical consumption and is a cost saving measure. Load shedding helps to balance supply and demand, ensuring the stability of the overall electrical system during times of high demand or when there are issues with power generation.
ย
ย
ย
ย
ย
https://www.youtube.com/watch?v=LyCJ7jAz6zI
Why use a Script for Load Shedding?
Using a script running on a Shelly Pro 3EM has a lot of advantages, especially when combined with various other Shelly relays. Scripting can offer a highly customizable and extremely efficient way to accomplish load shedding. A script either from the repopulated Shelly library or manually entered is used to create a system where you can dynamically control and shed loads based on certain conditions, such as high energy consumption or demand.
In this case, we will be using an Advanced Load Shedding Script that builds upon the basic version. The advanced version includes refined notifications and enhanced scheduling features, allowing for a more granular approach to load shedding.
Prerequisites
Shelly EM Devices
These devices will be used to gather the consumption data required for load shedding
Steps to Setting up Load Shedding
1. Setting Up Shelly Pro 3EM
Wire and Configure the Pro 3EM
Install and Configure: Install the Pro 3EM per the diagram below to monitor the energy consumption of the entire home.
In scenarios where CT-B is not used, it is advised to repurpose it to cover Neutral. This requires recalibrating in the deviceโs settings.
ย
ย
ย
Legend
Terminals | Cables | ||
---|---|---|---|
A | Phase A input | LA | Phase A live (110-240 V) cable |
B | Phase B input | LB | Phase B live (110-240 V) cable |
C | Phase C and power supply input | LC | Phase C live (110-240 V) cable |
N | Neutral terminal | L | Mono-phase live (110-240 V) cable |
IA | Phase A current transformer input | N | Neutral cable |
IB | Phase B current transformer input | Current transformers | |
IC | Phase C current transformer input | CTA | Phase A current transformer |
IN | Neutral current transformer input | CTB | Phase B current transformer |
ย | ย | CTC | Phase C current transformer |
ย | ย | CTN | Neutral current transformer |
Connect to Network: Using Shelly Smart Control, connect the Pro 3EM to your network.
ย
Shelly Cloud (optional): Add Shelly Pro 3EM to a Shelly Cloud account for remote access.
2. Set Up Additional Shelly Relays
ย
ย
Install Shelly Relays: Install Shelly relays to control the specific loads you want to manage.
Connect to Network: Using Shelly Smart Control, connect the Pro 3EM to your network.
ย
Shelly Cloud (optional): Add Shelly Pro 3EM to a Shelly Cloud account for remote access.
3. Adding the Load Shedding Script to the Host Pro 3EM
Navigate to the Scripts Menu: Shelly Smart Control has a section for Scripts for each compatible device. For Load Shedding we will use a Shelly Pro 3EM. With that device select click on the { } Icon.
Click Create New Script: At the Time of this writing the Advanced Load Shedding Script is not yet available from the Library and will need to be added manually.
ย
ย
ย
ย
ย
ย
Name the Script: At the top of the screen give your script a name.
ย
Copy the Script from Github: The advanced load shedding script can be found on GitHub using the link to the right.
Paste the Code: Once copied paste the code into the code window on control.shelly.cloud
4. Configure the Script
ย
ย
Channel Settings: Device channel settings will need to be configured for the Pro 3Em and in this example Pro 4PM
Configuring the Shedding Trigger Parameters:
max_
min_
ย
ย
ย
ย
ย
ย
ย
ย
max_ = 1200;
min_ = 900;
ย
ย
ย
ย
ย
ย
ย
poll_time = 300; // unless overriden in a schedule, defines time between shedding or adding load
short_poll = 10; // faster cycle time when verifying that an "on" device is still on
ย
ย
ย
Configuring the Polling Frequency:
poll_time
Minimum interval between executing normal on/off steps
short_poll
Interval after toggling on a device assumed to be already on
Additional Settings: The following settings are used for advanced applications and troubleshooting.
logging
kvs_status
simulation_power
simulation_hhmm
simulation_day
ย
logging = false;
kvs_status = false; // store status in key-value-store
simulation_power = 0; // set this to manually test in console
simulation_hhmm = ""; // leave "" for normal operation, set to time like "03:00" to test
simulation_day = -1; // -1 for normal operation, to test, 0=Sunday, 1=Monday...
Setting the Devices to be Shed: The devices to be shed using this script are listed in a JSON schema following the example on the right.
ย
Configuring Notifications: This script has the ability to fire off IFTTT Webhook Applets to then trigger notifications via various platforms.
Setting Schedules: Schedules are defined in a JSON list and set day and time for the Shedding schedule as well as on/off times and device priority. An example of scheduling in on the left.
ย
ย
ย
Saving and Executing the Script:
Click the Save Button in the top right next the the Script Name and Play Button
Click the Play Button in the top right next to the Script Name.
5. System Testing
ย
ย
ย
Simulate High Load: Increase the load to trigger the thresholds.
Verify Script Actions: Check if the Activity Log to verify the Load Shedding Script is executing the defined commands.
ย
ย
ย
ย
ย
ย
By following these steps, you can effectively use a Script with Shelly Pro 3EM and various Shelly relays to implement load shedding, helping to manage and reduce energy consumption dynamically.