Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/52north/edis-lib
https://github.com/52north/edis-lib
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/52north/edis-lib
- Owner: 52North
- License: mit
- Created: 2024-04-17T07:58:55.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-29T11:45:43.000Z (5 months ago)
- Last Synced: 2024-10-11T06:45:02.403Z (28 days ago)
- Language: TypeScript
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# edis-lib
Library to consume the DICT-API and the [Pegelonline REST-API](https://www.pegelonline.wsv.de/webservice/guideRestapi)
## Build libs
To get a packaged build of the edis lib use `pnpm build`. After that you got an npm package in both folders `browser` and `node`.
## Getting started with the lib
``` typescript
const edis = new Edis({
dictApiUrl: 'http://localhost:3000', // optional, example is for local development
mqttCredentials: {
username: '...', // needed for a secured mqtt broker
password: '...', // needed for a secured mqtt broker
},
});// request all stations
edis.getStations().subscribe({
next: (stations) => {
if (stations.length >= 1) {
// select the first station of the list
const station = stations[0];
// get all timeseries of the station
const ts = station.getTimeSeries();
if (ts.length >= 1) {
// get first timeseries
const timeseries = ts[0];
// get timeseriesData for the last 10 hours
timeseries.getTimeSeriesData('PT10H').subscribe((data) => console.log(data));
// get characteristicValues for the given timeseries
timeseries.getCharacteristicValues().subscribe((values) => console.log(values));
// get current timeseries data by internally subscribing to the corresponding mqtt topic for this time series
timeseries.getCurrentTimeSeriesData().subscribe((data) => console.log(data));
}
}
},
});
```