Skip to content

topi314/shelly-exporter

Repository files navigation

Go Report Go Version KittyBot License KittyBot Version Docker Discord

shelly-exporter

Prometheus exporter for Shelly Plug S devices.

Installation

You can either run the exporter directly or use the provided Docker image.

Docker-Compose

version: '3.7'

services:
  prometheus:
    image: prom/prometheus:latest
    ...
  shelly-exporter:
    image: ghcr.io/topisenpai/shelly-exporter:master
    container_name: shelly-exporter
    restart: unless-stopped
    volumes:
      - ./shelly.yml:/var/lib/shelly-collector/config.yml
    expose:
      - 2112

Configuration

The exporter is configured via a YAML file. The default path is /etc/shelly-exporter/config.yml but you can change it with the --config flag.

global:
  scrape_interval: 1m
  scrape_timeout: 10s

log:
  level: info
  format: text
  add_source: false

server:
  listen_addr: :2112
  endpoint: /metrics

configs:
  - name: Plug1
    address: 123.456.789.123:80
    secure: false
    username: admin
    password: admin
    interval: 1m
    timeout: 10s

Metrics

Shelly Exporter exposes the following metrics:

Metric Description Labels
shellyplug_power Current real AC power being drawn, in Watts name, meter
shellyplug_power_valid Whether power metering self-checks OK (0.0 = not OK, 1.0 = OK) name, meter
shellyplug_overpower Value in Watts, on which an overpower condition is detected name, meter
shellyplug_total_power Total energy consumed by the attached electrical appliance in Watt-minute name, meter
shellyplug_temperature PlugS only internal device temperature in °C name
shellyplug_uptime Seconds elapsed since boot name
shellyplug_has_update Whether an update is available (0.0 = no update, 1.0 = update) name

Details

The exporter uses the Shelly API to get the current power consumption of the devices. You can find more information here and here

License

Shelly Exporter is licensed under the Apache License 2.0.

Contributing

Contributions are always welcome! Just open a pull request or discussion and I will take a look at it.

Contact