Files
home-data-collection-tools/docs/SOLAR_API.md

1.5 KiB

The solar-server REST API

This project depends on the pistache HTTP framework, see their website for more info.

Endpoints

All endpoints respond in JSON. Examples can be found in the Examples section. Dates are always in ISO format, meaning they take the shape of year-month-day with leading zeroes for month and day. Example: 2019-01-11 is the eleventh day of January, 2019.

  • /day?start=[yyyy-MM-dd] This tells the server what date to serve all the collected records from the specified day.
  • /day?start=[yyyy-MM-dd]&stop=[yyyy-MM-dd] This tells the server what date to serve the highest recorded kilowatt hour collected for each day in the specified date range. Stop date is inclusive.
  • /month?&start=[yyyy-mm]&stop=[yyyy-mm] This returns the total kilowatthours generated for a given month. The stop month is inclusive.

Example Response

All times are always in UTC. For these examples the current date is 25 December, 2019.

/day?start=2019-02-15

Will give you as many objects as there are recorded values for the 15th of Febuary, 2019. Ordered from earliest to latest.

[
	{
		"time": 1550226776,
		"watt": 1456,
		"kwh": 14.53
	},
	{
		"time": 1550226834,
		"watt": 1456,
		"kwh": 14.54
	},
	...
]

/month?start=2019-06&stop=2019-06

Will give you a total kilowatt hours generated for the month July, 2019. The time component is the first day of the month at 00:00 (midnight) UTC. For multiple months the result is ordered earliest to latest.

[
	{
		"time": 1559347200,
		"watt": 0,
		"kwh": 451.64
	}
]