Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hemtjanst/sensorer
Prometheus exporter for sensor data
https://github.com/hemtjanst/sensorer
domotic exported-metrics home-automation mqtt prometheus sensors smarthome
Last synced: about 1 month ago
JSON representation
Prometheus exporter for sensor data
- Host: GitHub
- URL: https://github.com/hemtjanst/sensorer
- Owner: hemtjanst
- License: apache-2.0
- Created: 2018-06-06T14:11:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-06T16:23:39.000Z (over 1 year ago)
- Last Synced: 2024-06-21T02:55:50.341Z (6 months ago)
- Topics: domotic, exported-metrics, home-automation, mqtt, prometheus, sensors, smarthome
- Language: Go
- Homepage: https://hemtjan.st/sensorer
- Size: 66.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sensorer
Sensorer, aka "sensors", reads sensor data from MQTT and makes it available
for scraping to Prometheus. It's a Hemtjanst exporter.This package was written with Go 1.14.
## Installation
* `go install github.com/hemtjanst/sensorer/cmd/sensorer`
### Development
* `git clone github.com/hemtjanst/sensorer`
* `go mod download`## Exported metrics
There are two endpoints:
* `/metrics` which contains metrics internal to Sensorer, like HTTP
request statistics, memory utilisation etc
* `/sensors` with the sensor metricsWhich metrics are exported depends on the features the device announces.
Every exported metric has a label named `source` which holds the device's
MQTT topic.* `currentTemperature`: gauge `sensors_temperature_celsius`
* `currentRelativeHumidity`: gauge `sensors_humidity_relative_percent`
* `contactSensorState`: gauge `sensors_contact_state`
* `currentPower`: gauge `sensors_power_current_watts`
* `currentPowerProduced`: gauge `sensors_power_produced_current_watts`
* `energyUsed`: counter `sensors_power_total_kwh`
* `energyProduced`: counter `sensors_power_produced_total_kwh`
* `currentVoltage`: gauge `sensors_power_current_voltage`
* `currentAmpere`: gauge `sensors_power_current_ampere`
* `batteryLevel`: gauge `sensors_battery_level_percent`
* `precipitation` gauge `sensors_precipitation_mm_per_hour`
* `airPressure` gauge `sensors_air_pressure_hpa`
* `windSpeed` gauge `sensors_wind_speed_meters_per_second`
* `windDirection` gauge `sensors_wind_direction_degrees`
* `globalRadiation` gauge `sensors_global_radiation_watts_per_square_meter`### Built-in sensors
A time series is computed for humiture, also known as
the "feels like" temperature: `sensors_humiture_celsius`.Two time series are computed based on `location.lat` and `location.long`,
respectively `sensors_sunrise_time_seconds` and `sensors_sunset_time_seconds`.
A third time series, `sensors_daylight` returns 1 if the current time
is between sunrise and sunset, and 0 otherwise.## Options
A number of options can be passed at startup in order to configure the
behaviour. Most importantly are probably `-exporter.listen-address` and
`-mqtt.address`. These let you configure on what `host:port` combination
the metrics are exported and on what `host:port` combination the MQTT
broker can be found.Issue a `sensorer -help` for all possible options.
## Caveats
Depending on the Prometheus scrape time and how certain contact sensors
report in, it's very possible that you would not be able to see something
like a door opening and closing in fairly rapid succession reflected
in Prometheus. As such you **must not** rely on this data for the purposes
of home security.