# Welcome to the Trest Solar Controller documentation 👋

Learn how to use our products and develop with Trest!

Trest is a small company that has created a software to manage a Sungrow solar grid. As a user, you can connect to it using its an Android or iOS app. We also offer OpenSource integrations for Homey and Home Assistant.&#x20;

Our vision is to create simple software that anyone can use and actually understand.&#x20;

But if the user wants to dig deeper and extend the functionallity for the service, they should be able too, therefore we expose our entire system with OpenAPI so that anyone can build their extensions as the want!&#x20;


# How does the software work?

General information about how the software is functioning.

The software operates on a scheduling timer, performing specific functions every minute to retrieve data from your Solar Grid Inverter and transmit it to the Cloud application.

Each time the timer initiates, it acquires the latest settings from your account, influencing the execution's behavior. These behaviors are called "Overrides" and "Solar Bot Actions."

Additionally, when a particular "Energy Profile" is designated, the settings of your Solar Grid Inverter will be adjusted to align with the actions specified in the profile.


# Bot Actions and Overrides

What are and how does the Bot Action and Overrides work?

### Bot Actions

Bot Actions automatically optimize your home's energy costs. The Bot analyzes your energy usage, identifies the most cost-effective hours to purchase energy daily, and determines the best times to use the purchased energy based on your consumption. This helps optimize your energy bill.

These Bot Actions have different colors for each 'mode', here are the descriptions of the Bot Action colors:&#x20;

<mark style="color:yellow;">Yellow</mark>: Pause, the battery will not charge and neither discharge

<mark style="color:green;">Green</mark>: Buy, the battery will buy electricity from the grid&#x20;

<mark style="color:red;">Red</mark>: Sell, the battery will discharge energy to the grid

<mark style="color:blue;">Blue</mark>: Self sustainable, will use the energy in the battery and charge it from your solar cells if the sun is shining

### Bot Overrides

Bot Overrides allow you to customize the Bot's actions. If you feel the Bot has chosen unusual hours for its actions, you can set your own preferred energy modes for specific hours.

You can also override 'Non-Bot' hours, such as the 'Blue hours' that are '<mark style="color:blue;">Self Sustainable</mark>'. For instance, if energy prices spike by 700% at 6 PM, you can charge the battery in the preceding hours and set a '<mark style="color:red;">Sell</mark>' mode at 6 PM, and the system will handle everything automatically.

The Bot Overrides have a different colors than Bot Actions to be able to differ between them:

<mark style="color:green;">Dark Green</mark>: Override Buy mode

<mark style="color:purple;">Purple</mark>: Override Sell mode

<mark style="color:orange;">Beige</mark>: Override Self Sustainable mode


# Settings

What does the settings do and what settings are there?

There are a few settings to control the software and make it function as you want. Here is a list of every setting and a description of what it does.

#### TIBBER\_TOKEN

Your Tibber developer token, this is not used very much currently, but the plans for the future is to fetch the purchased and sold energy per day from your household.

#### EMAIL\_NOTIFICATION

If you want to recive any email notifications direcly from the system

#### EMAIL\_RECIPIENTS

A comma seperated list of all the recipients of the system email notifications. An example value of this setting is: <email1@gmail.com>;<email2@gmail.com>;<email3@gmail.com>

#### SOLAR\_BOT

This is an 'on/off' setting, which means that if this is enabled the Bot will use its own calculations to setup the Bot Actions over the day to optimize your energy costs as much as possible for your household. If it is disabled the software will be in '<mark style="color:blue;">Self Sustainable</mark>' mode.

#### SOLAR\_BOT\_DAYS

The days of the week that the Bot will be active if SOLAR\_BOT is enabled. This is a string which you enter all of the day numbers of the week, starting from 1 which is Sunday, so for example '13457' would equal the days: Sunday, Tuesday, Wednesday, Thursday and Saturday.

#### SOLAR\_BOT\_BUY

This setting is used as a complementary setting to SOLAR\_BOT, if this is enabled the Bot will be able to set '<mark style="color:green;">Buy</mark>' mode on certain hours, if it is disabled the Bot cannot create '<mark style="color:green;">Buy</mark>' mode hours.

#### SOLAR\_BOT\_SELL

This setting is used as a complementary setting to SOLAR\_BOT, if this is enabled the Bot will be able to set '<mark style="color:red;">Sell</mark>' mode on certain hours, if it is disabled the Bot cannot create '<mark style="color:red;">Sell</mark>' mode hours.

#### SOLAR\_BOT\_PAUSE

This setting is used as a complementary setting to SOLAR\_BOT, if this is enabled the Bot will be able to set '<mark style="color:yellow;">Pause</mark>' mode on certain hours, if it is disabled the Bot cannot create '<mark style="color:yellow;">Pause</mark>' mode hours.

#### SOLAR\_INVERTER\_IP

The IP Address of your Sungrow WiNet module, this will be auto- detected by the software.

#### SOLAR\_BOT\_TERIFF\_WEEKDAY

This is an 'on/off' setting, which means if you have an energy teriff in your electricity conract on the weekends (monday to friday). If this is enabled, the Bot will not purchase energy with the '<mark style="color:green;">Buy</mark>' mode during the period between SOLAR\_BOT\_TERIFF\_WEEKDAY\_START and SOLAR\_BOT\_TERIFF\_WEEKDAY\_STOP.

Also, the Bot uses the SOLAR\_BOT\_TERIFF\_WEEKDAY\_START to know when to buy energy with the '<mark style="color:green;">Buy</mark>' mode during the morning when the energy prices are the cheapest.

#### SOLAR\_BOT\_TERIFF\_WEEKDAY\_START

The time of day when your teriff starts (monday to friday). Doesnt matter if the SOLAR\_BOT\_TERIFF\_WEEKDAY setting is turned off.

#### SOLAR\_BOT\_TERIFF\_WEEKDAY\_END

The time of day when your teriff ends (monday to friday). Doesnt matter if the SOLAR\_BOT\_TERIFF\_WEEKDAY setting is turned off.

#### SOLAR\_BOT\_TERIFF\_WEEKEND

This is an 'on/off' button which means if you have an energy teriff in your electricity conract on the weekends (monday to friday). If this is enabled, the Bot will not purchase energy with the '<mark style="color:green;">Buy</mark>' mode  during the period between SOLAR\_BOT\_TERIFF\_WEEKEND\_START and SOLAR\_BOT\_TERIFF\_WEEKEND\_STOP.

Also, the Bot uses the SOLAR\_BOT\_TERIFF\_WEEKEND\_START to know when to buy energy with the '<mark style="color:green;">Buy</mark>' mode during the morning when the energy prices are the cheapest.

#### SOLAR\_BOT\_TERIFF\_WEEKEND\_START

The time of day when your teriff starts (monday to friday). Doesnt matter if the SOLAR\_BOT\_TERIFF\_WEEKEND setting is turned off.

#### SOLAR\_BOT\_TERIFF\_WEEKEND\_END

The time of day when your teriff ends (monday to friday). Doesnt matter if the SOLAR\_BOT\_TERIFF\_WEEKEND setting is turned off.


# Licensing

How does the licensing work?

There isn't much to discuss regarding licensing, but it's beneficial to understand how it works.

* If your user license for this device expires, your device will be 'disabled' immediately. You will still be able to login everywhere and do everything you used to do, but your device won't perform any actions. Once the license is renewed via the checkout with 'Stripe', your device will be activated and continue working as usual.
* If the license were to expire in the middle of, let's say, an 'Override', your Solar Grid Inverter will be stuck in that energy mode for now. We will look into resetting the energy mode to 'Self Sustainable' as soon as the license expires.

<br>


# How to use the Android/iOS application?

How to use the application and what features does it include?

First of all, download the application on the Google Play Store or iOS App Store.&#x20;

Then launch the app and login with your Trest account. If you dont have an accout, you can signup at <https://trest.se/signup>

### Solar Page

The first thing you will see when you have logged in is this:&#x20;

<figure><img src="/files/PgqZryqiCDbZPOuy52CT" alt="" width="188"><figcaption></figcaption></figure>

Here you can see some basic information about your Solar Grid, this data is transitted from the software running on your Raspberry Pi and is updated every minute.&#x20;

All the fields explain themselves pretty good.

If you scroll down a little bit you will see a graph with the today and the day aheads energy prices. One important thing is that the day ahead energy prices get release at 12 a-clock UTC every day, so they will appear shortly after release.

It should look something like this:&#x20;

<figure><img src="/files/901UcwxnKiQWBsJLfZVl" alt="" width="188"><figcaption></figcaption></figure>

All of the different 'colors' are described in the 'legend' below the chart. The actions of the different colors that does not include the name 'Override' is reffered to as '[Solar Bot Actions](/the-basics/how-does-the-software-work/bot-actions-and-overrides#bot-actions)', which are the hours that the Bot selects automatically if it is enabled. And the actions containing the name 'Override' is the '[Override Actions](/the-basics/how-does-the-software-work/bot-actions-and-overrides#bot-overrides)' you, the user can set manually.

Every 'Blue' dot in the graph repressents an hour and its energy price, if they are just 'Blue' it means that it will use the energy mode 'Self Sustainable', and no specific 'Bot Action' or 'Override' is set.&#x20;

If you want to override the action of any hour you can 'click' on 'blue' dot hour in the graph, then you will be shown a popup menu with a few different alternatives looking like this:&#x20;

<figure><img src="/files/MqKxpxyU4BQvKzzOZlqE" alt="" width="188"><figcaption></figcaption></figure>

Here you can select your preffered 'Override' action, when you select an action, all of the hours ahead will get this selected action, this is by design to make it easier to bulk edit which hours you want to set your override hours. The option 'Inget' will remove all 'Override' actions from all of the hours ahead of the selected hour.&#x20;

### Setting Page

To view and edit the settings of the software running on your Raspberry Pi you can click on the 'Hambuger Menu' in the top right corner and click on 'Inställningar'

Then you will land on a page that looks like this:

<figure><img src="/files/cbUc67ruYkjQYyGiAE5o" alt="" width="188"><figcaption></figcaption></figure>

Here you can modify the settings as you prefer. The description of the settings can be found on the '[Settings](/the-basics/how-does-the-software-work/settings)' page.


# Homey

Work in progress


# Home Assistant

Work in progress


# Google Home

Work in progress


# Getting Started


# Packages & Libraries

### Here are some of the links to the available libraries to integrate with the Trest Cloud

#### Python

{% embed url="<https://pypi.org/project/trest-solar/>" %}
For communication with the Trest Solar Controller Cloud
{% endembed %}

{% embed url="<https://pypi.org/project/trest-identity/>" %}
For authentication
{% endembed %}

#### .NET

Comming soon

#### Javascript

Comming soon


# OpenAPI

This page will be enriched soon, the link to the swagger is currently: <https://cloud.solar.trest.se/swagger/index.html>


