Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aexel90/shelly_exporter
Shelly humidity sensor exporter for prometheus
https://github.com/aexel90/shelly_exporter
exporter go grafana grafana-dashboard humidity humidity-monitoring humidity-sensor prometheus prometheus-exporter shelly shelly-api shelly-cloud
Last synced: 13 days ago
JSON representation
Shelly humidity sensor exporter for prometheus
- Host: GitHub
- URL: https://github.com/aexel90/shelly_exporter
- Owner: aexel90
- License: apache-2.0
- Created: 2021-01-04T16:05:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-29T21:44:44.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T21:51:26.614Z (about 1 month ago)
- Topics: exporter, go, grafana, grafana-dashboard, humidity, humidity-monitoring, humidity-sensor, prometheus, prometheus-exporter, shelly, shelly-api, shelly-cloud
- Language: Go
- Homepage:
- Size: 1.08 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prometheus Shelly Exporter and Grafana integration
This exporter exports some metrics from Shelly to Prometheus.
Testes with:
| Shelly H&T | Shelly Plus 2PM |
| ------------- | ------------- |
| | |
## Shelly APIShelly API: https://shelly-api-docs.shelly.cloud/#shelly-h-amp-t
Shelly cloud API access: https://shelly.cloud/documents/developers/shelly_cloud_api_access.pdf
Test API with HTTP POST:
https:///device/status?auth_key=&id=
## Configuration File: shelly-metrics.jsonDetermine "auth_key", "id" and "url" of your device via Shelly cloud API access and update in shelly-metrics.json.
"shelly_name" and "name" can be determined on your own.{
"account":{
"auth_key": "...",
"url": "..."
},
"products": [
{
"type": "ht",
"export": {
"isok": "isok",
"temperature": "data.device_status.tmp.value",
"humidity": "data.device_status.hum.value",
"battery": "data.device_status.bat.value",
"has_update": "data.device_status.update.has_update",
"firmware": "data.device_status.getinfo.fw_info.fw",
"mac": "data.device_status.mac",
"updated": "data.device_status._updated"
},
"devices": [
{
"id": "956b54",
"shelly_name": "S1",
"name": "Indoor"
},
{
"id": "9574a8",
"shelly_name": "S2",
"name": "Outdoor"
}
]
},
...## Build
go get github.com/aexel90/shelly_exporter/
cd $GOPATH/src/github.com/aexel90/shelly_exporter
go install## Execution
Usage:
$GOPATH/bin/shelly_exporter -h
Usage of ./shelly_exporter:
-listen-address string
The address to listen on for HTTP requests. (default "127.0.0.1:9784")
-metrics-file string
The JSON file with the metric definitions. (default "shelly-metrics.json")
-test
Test configured metrics### Execute:
$GOPATH/go/bin/shelly_exporter -metrics-file $GOPATH/go/bin/shelly-metrics.json
### Testing:
$GOPATH/go/bin/shelly_exporter -metrics-file $GOPATH/go/bin/shelly-metrics.json -test
Metric: shelly_ht_info
- Exporter Result:
- Exporter Result 0:
- humidity="53"
- mac="E09806956B54"
- name="Indoor"
- isok="true"
- shelly_name="S1"
- temperature="22.88"
- battery="85"
- has_update="false"
- firmware=""
- updated="2021-11-23 19:43:54"
- Exporter Result 1:
- has_update="false"
- firmware="20210323-104951/v1.10.1-gf276b51"
- isok="true"
- name="Outdoor"
- temperature="6.38"
...## Docker
cp shelly-metrics.json.template shelly-metrics.json
vi shelly-metrics.json
docker-compose up -d --build## Grafana Dashboard
### weather widget
https://weatherwidget.io/
DRESDEN
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src='https://weatherwidget.io/js/widget.min.js';
fjs.parentNode.insertBefore(js,fjs);
setInterval('__weatherwidget_init()', 1800000) <!-- refresh widget every 30 minutes (1800000 milliseconds): -->
}
}(document,'script','weatherwidget-io-js');
### dashboard
Grafana-ID: 13739
https://grafana.com/grafana/dashboards/13739#### grafana.ini
[panels]
# If set to true Grafana will allow script tags in text panels. Not recommended as it enable XSS vulnerabilities.
disable_sanitize_html = true![Grafana](https://raw.githubusercontent.com/aexel90/shelly_exporter/main/grafana/screenshot_temp.jpg)
![Grafana Rollo](https://raw.githubusercontent.com/aexel90/shelly_exporter/main/grafana/screenshot_rollo.jpg)