Refactoring #34

Merged
bendodroid merged 10 commits from :Bendodroid-refactoring into main 2024-05-26 21:06:30 +02:00
Showing only changes of commit b98174c7da - Show all commits

View file

@ -3,7 +3,7 @@
`spaceapid` serves a [SpaceAPI](https://spaceapi.io)-compatible JSON on port 8080:
```shell
$ curl -X GET http://[::1]:8080 | jq
$ curl http://[::1]:8080 | jq
{
"api_compatibility": [
"14"
@ -26,7 +26,7 @@ The config consists of three parts:
- `"response"`
- The static (pre-filled) parts of the response
See [Running](#running) for details.
See [Running](#Running) for details.
## Updating values
@ -37,12 +37,18 @@ curl -X PUT -u user:password -d true http://[::1]:8080/state/open
```
The same is true for the endpoints for sensors configured under `"dynamic"`.
Currently only `temperature` and `humidity` are implemented.
Currently only the sensors with the `value/unit/location/name/description` schema are implemented.
At the time of writing this includes `temperature`, `barometer`, `humidity`, `beverage_supply`, `power_consumption`,
and `account_balance`.
Out-of-spec sensors may also be used as long as they share the same schema.
```shell
curl -X PUT -u user:password -d 23.42 http://[::1]:8080/sensors/{temperature,humidity}/location[/name]
curl -X PUT -u user:password -d 23.42 http://[::1]:8080/sensors/{temperature,humidity,...}[/location[/name]]
```
As can be seen in the example, the http urls are generated from sensor type and optionally `location` and `name`.
Depending on sensor type `location` might be required for your sensors, see the schema for details.
## Building
See the `go.mod` file for minimum required Go version.