Add README.md, Rocket.toml.example and LICENSE file
Also link the files from the crate and include README.md documentation.
This commit is contained in:
parent
24c1d7a22a
commit
855d2a7eed
|
@ -3,6 +3,13 @@ name = "autarco-scraper"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
authors = ["Paul van Tilburg <paul@luon.net>"]
|
authors = ["Paul van Tilburg <paul@luon.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
description = """"
|
||||||
|
Web service that provides a REST API layer over the My Autarco site/API to get
|
||||||
|
statistical data of your solar panels.
|
||||||
|
"""
|
||||||
|
readme = "README.md"
|
||||||
|
repository = "https://git.luon.net/paul/autarco-scraper"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
color-eyre = "0.5.6"
|
color-eyre = "0.5.6"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2018 Paul van Tilburg
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,67 @@
|
||||||
|
# Autarco Scaper
|
||||||
|
|
||||||
|
Autarco Scraper is a web service that provides a REST API layer over the My
|
||||||
|
Autarco site/API to get statistical data of your solar panels.
|
||||||
|
|
||||||
|
## Building & running
|
||||||
|
|
||||||
|
First you need to provide your My Autarco credentials in the file
|
||||||
|
`autarco.toml` by setting the username and password. You can copy and modify `autarco.toml.example` for this:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
# Put your My Autarco credentials below
|
||||||
|
username = "foo@domain.tld"
|
||||||
|
password = "secret"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, using Cargo, it is easy to build and run Autarco Scraper, just run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cargo run --release
|
||||||
|
...
|
||||||
|
Compiling autarco-scraper v0.1.1 (/path/to/autarco-scraper)
|
||||||
|
Finished release [optimized] target(s) in 9m 26s
|
||||||
|
Running `/path/to/autarco-scraper/target/release/autarco-scraper`
|
||||||
|
```
|
||||||
|
|
||||||
|
(Note that Rocket listens on `127.0.0.1:8000` by default for debug builds, i.e.
|
||||||
|
builds when you don't add `--release`.)
|
||||||
|
|
||||||
|
You can provide Rocket with configuration to use a different address and/or port.
|
||||||
|
Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[default]
|
||||||
|
address = "0.0.0.0"
|
||||||
|
port = 8080
|
||||||
|
```
|
||||||
|
|
||||||
|
This will work independent of the type of build. For more about Rocket's
|
||||||
|
configuration, see: <https://rocket.rs/v0.5-rc/guide/configuration/>.
|
||||||
|
|
||||||
|
## API endpoint
|
||||||
|
|
||||||
|
The `/` API endpoint provides the current statistical data of your solar panels
|
||||||
|
once it has successfully logged into the My Autarco website using your
|
||||||
|
credentials. There is no path and no query parameters, just:
|
||||||
|
|
||||||
|
```http
|
||||||
|
GET /
|
||||||
|
```
|
||||||
|
|
||||||
|
### Response
|
||||||
|
|
||||||
|
A response uses the JSON format and typically looks like this:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"current_w":23, "total_kwh":6159, "last_updated":1661194620}
|
||||||
|
```
|
||||||
|
|
||||||
|
This contains the current production power (`current_w`) in Watt,
|
||||||
|
the total of produced energy since installation (`total_kwh`) in kilowatt-hour
|
||||||
|
and the (UNIX) timestamp that indicates when the information was last updated.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Autarco Scraper is licensed under the MIT license (see the `LICENSE` file or
|
||||||
|
<http://opensource.org/licenses/MIT>).
|
|
@ -0,0 +1,3 @@
|
||||||
|
[default]
|
||||||
|
address = "0.0.0.0"
|
||||||
|
port = 2356
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
|
|
Reference in New Issue