Use energy when cheap

Learn to build blocks to use energy when cheapest. In this guide, we will use the Seluxit EMS automation tool Blockly to schedule automatic battery charging when electricity prices are low throughout the night.

Scheduling block

Before you start, make sure you have:

  • Wappsto account. If you don’t have it, click here to create one.
  • Smart devices connected to your Wappsto account


1. Install the Blockly app and create automation.

Blockly app consists of simple programming blocks that allow you to program hardware devices and create simple rules and automations.

  • Log in to your wappsto account and install the Blockly app.
  • Open the app and click “Add new” to create your first Blockly program (application).
  • Give it a name. Eg: “Battery charging automation” and click “Create”.

Once your application is created you will see your workspace with a few initial blocks.


Blockly app workspace

2. Create a Power-moving block. 

First of all, we will clear up space and remove the initial blocks. Click on the block to select it and then press the “Delete” key to delete it.

  • Find the “Power” section in the left-side menu (yellowish colour) and click to open it.
  • Drag the “Use power between” block into your workspace as shown in the image.
  • Change the time period and duration.
Blockly Power moving

For this task, we want to charge the battery before the working day starts, so we use power between 22:00 and 08:00. Our battery takes 2h to charge.


Move power block configuration

3. Set the commands.

Since we are going to charge our battery, we need to switch the power on and off. For that, we need a “Set value” block.

  • Find the “Wappsto” section in the left-side menu (dark blue colour).
  • Drag the “Set value” block into the “Switch on command”, as shown in the image.
  • Repeat the last action for the “Switch off command”.


Value configuration

4. Select values.

Now we need to add the correct values to the block.

  • Find the “Devices” section in the left-side menu (dark blue colour).
  • Click on the “Select devices” button to open a list of the devices present in your Wappsto account. Check the devices that you want to add to your workspace. Then click the “Save” button to confirm the selection.

We have selected “Power plug” from Shelly. 


Wappsto Set Value Block

Selected devices will now appear in the left-side menu and you can click on them to see the list of values they are available.

  • Drag to your workspace the necessary control values. In our case, they are called “On/Off”.


Select Values for the Set value block

5. Configure values.

  • For ON commands, we set the value “Relay” to “on“.
  • For OFF commands, we set the value “Relay” to “off“.


Value configuration

6. Repeat the task every day

To schedule this task to repeat every day:

  • Find the “Scheduling” section in the left-side menu (orange colour).
  • Drag the “Every day…” block into your workspace, and move the “Use power” block inside the “Every day…” block, as shown in the image.
  • Change frequency and time.


Scheduling block

Automation needs to start just before the power-moving tasks.

We select a “weekday“, and the time “21:30“.

Scheduling block

7. Select region to ensure correct prices

In Denmark, electricity prices in the West region differ from the East.

  1. Add the “On initialization” block from the “Wappsto” section.
  2. Add the “Set energy prices region…” block from the “Power” section and set the region you want to use (east or west from the Great belt Bridge).
  3. Arrange the two new blocks as shown in the image.


Select region for correct energy prices.

8. Save your program

For this program to run, remember to press “Save files”.

If you want to STOP the automation, go to the Blockly app main page, where you see all your created programs. Click on the programs menu button to view its settings. Click the “Stop app” button.

Blockly Save button


From now on the power plug will switch on for 2 hours throughout the night, when the electricity price is the lowest.

As the next step, you can add more functionality to this automation or create a new one.