API documentation

API documentation

Introduction

Welcome to the Cloud Solar REST API documentation.


 

Begin

API tokens are distributed to users with administration roles. If you are an administrator, log in to https://cloud-solar.com and go to the 'My Organisation' section of the platform. Here you will see an API key that is unique to your user. You will need to submit this key in an authorization header along with every request you make. If you do not see your API key, get in touch with a member of staff at support@cloud-solar.com

 

End Points

Root end point: https://cloud-solar.com/api/v1/

At present, there are 2 API endpoints available:

  1. Get Device Data
  2. Update Load Status

 

Authorization

With each request, include the provided API token as an authorization header as follows:

Authorization: Token <token>

 

Error Codes

  • 200 for a successful operation.
  • 400 for an invalid request.
  • 401 for missing authentication credentials.
  • 403 for forbidden access.
  • 404 for an invalid device ID.

 

Get Device Data

GET /devices/<deviceID>/reports

This allows you to retrieve all data reports from a particular device given a date-time range. The start of the range is inclusive and the end is exclusive. The date-time range is provided via the query parameters start and end as integer unix timestamps at the granularity of a second. The endpoint allows you to retrieve up to 30 days of data at a time.

 

curl -H "Authorization: Token <token>" "https://cloud-solar.com/api/v1/devices/<device_id>/reports?start=1610542493&end=1610546064"

 

Outputs

Parameter

Type Description
timestamp number Unix Timestamp for the creation of the data report in seconds.
load_state string

The status of the load output

 

0: DISABLED
1: 'ON'
2: OFF_LOW_SOC
3: OFF_OVERCURRENT
4: OFF_OVERVOLTAGE
5: OFF_LOAD_SHORT_CIRCUIT
6: OFF_TEMPERATURE
7: MULTIPLE_ERRORS
8: OFF_LOAD_VOLTAGE_DIP

load_w number Instantaneous power consumption at the load and USB ports
output_wh_total number The total amount of energy consumed through the load and USB ports over the lifetime of the device in Wh.
output_wh_delta number The delta between the previous data point and the current data point. i.e. The amount of energy used in the time since the data point on the previous line (usually 1 hour).
solar_w number The power of the solar input at the time of sending in watts.
solar_v
number The voltage of the solar input at the time of sending in volts.
input_wh_total
number The total amount of energy inputted from the solar panel over the lifetime of the device in Wh.
bat_v
number

Battery voltage at the time of sending in volts.

state_of_charge
number

The state of charge of the battery calculated using the algorithm on the device as a percentage.

full_charges_count
number

The number of times the battery has been fully charged since the device started recording data.

deep_discharges_count
number The number of times the load has been disconnected due to low battery since the device started recording data.
bat_chg_total_wh
number

Accumulated battery charging energy in Wh. BETA mode - for comparison and testing purposes only.

bat_dis_total_wh
number Accumulated battery discharging energy in Wh. BETA mode - for comparison and testing purposes only.
bat_usable_ah
number Shows the available capacity of the battery in Ah. This is using a different algorithm to the state of charge and is not currently used in the software platform. BETA mode - for comparison and testing purposes only.
bat_temp
number

This refers to the internal temperature in °C of the charge controller unless an external temperature sensor is fitted, in which case it displays this temperature.

restart_detected
 
boolean

If the device has restarted, the value is set to TRUE.

signal_strength
 
number

Signal strength in dB. The scale is from 0 to -120. The closer to 0, the stronger the signal. 

error_flag
 
number TBC

 

Update Load Status

PUT /devices/<deviceID>/state

This allows you to remotely switch the load and USB ports on/off for a particular device.

 

Parameter

Type Description Input
enabled boolean True to turn the load and USB output on. False to turn them off. Input

 

Turning on a device:

curl -X PUT -H "Content-Type: application/json" -H "Authorization: Token <token>" --data '{"enabled": true}' "https://cloud-solar.com/api/v1/devices/<device_id>/state"

 

Turning off a device:

curl -X PUT -H "Content-Type: application/json" -H "Authorization: Token <token>" --data '{"enabled": false}' "https://cloud-solar.com/api/v1/devices/<device_id>/state"

 

 

 

    • Related Articles

    • Cloud Solar PAYG

      Introduction Cloud Solar Pay-as-you-go products operate using the OpenPAYGO Token, a standard developed by Solaris Offgrid and the EnAccess Foundation. This means that it is possible to integrate the Cloud Solar PAYG units with any software that is ...
    • Can I change the voltage set points of the charge controller?

      Yes. There are 2 ways of doing this. The easiest is to ask a Inclusive Energy member of staff to change the settings remotely. Or you could do it yourself via the serial port at the front of the device. The charge controller responds to 'thingset', ...