Grafana, Prometheus and InfluxDB exporter for Tp-Link Tapo smart devices
6.5K
A Grafana, Prometheus and InfluxDB exporter for Tapo smart devices. This container automatically collects metrics from your Tapo smart plugs and makes them available for monitoring and visualization.
# Create a .env file
cat > .env << EOL
# Number of devices to monitor
TAPO_DEVICE_COUNT=1
# Device 1 configuration (P110)
TAPO_DEVICE_1_NAME="Living Room"
TAPO_DEVICE_1_TYPE="p110"
TAPO_DEVICE_1_IP="192.168.1.100"
TAPO_DEVICE_1_EMAIL="[email protected]"
TAPO_DEVICE_1_PASSWORD="your_password"
# InfluxDB Configuration (optional)
INFLUXDB_URL=http://influxdb:8086
INFLUXDB_TOKEN=your_influxdb_token
INFLUXDB_ORG=tapo
INFLUXDB_BUCKET=tapo
# Logging Configuration
LOG_LEVEL=INFO
LOG_DIR=/var/log/tapo
EOL
# Run the container
docker run -d \
--name tapo-exporter \
-p 8000:8000 \
-v $(pwd)/.env:/app/.env \
-v /var/log/tapo:/var/log/tapo \
j4v3l/tapo-exporter:latest
Create a docker-compose.yml file:
version: '3.8'
services:
tapo-exporter:
image: j4v3l/tapo-exporter:latest
container_name: tapo-exporter
ports:
- "8000:8000"
volumes:
- ./.env:/app/.env
- /var/log/tapo:/var/log/tapo
restart: unless-stopped
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
restart: unless-stopped
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
restart: unless-stopped
influxdb:
image: influxdb:2.0
container_name: influxdb
ports:
- "8086:8086"
volumes:
- influxdb-data:/var/lib/influxdb2
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=admin
- DOCKER_INFLUXDB_INIT_PASSWORD=your_password
- DOCKER_INFLUXDB_INIT_ORG=tapo
- DOCKER_INFLUXDB_INIT_BUCKET=tapo
restart: unless-stopped
volumes:
grafana-data:
influxdb-data:
Create a prometheus.yml file:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'tapo'
static_configs:
- targets: ['tapo-exporter:8000']
Start the stack:
docker-compose up -d
| Variable | Description | Required | Default |
|---|---|---|---|
| TAPO_DEVICE_COUNT | Number of devices to monitor | Yes | - |
| TAPO_DEVICE_X_NAME | Name of device X | Yes | - |
| TAPO_DEVICE_X_TYPE | Type of device X (p110/p115) | Yes | - |
| TAPO_DEVICE_X_IP | IP address of device X | Yes | - |
| TAPO_DEVICE_X_EMAIL | Email for device X | Yes | - |
| TAPO_DEVICE_X_PASSWORD | Password for device X | Yes | - |
| INFLUXDB_URL | InfluxDB URL | No | - |
| INFLUXDB_TOKEN | InfluxDB token | No | - |
| INFLUXDB_ORG | InfluxDB organization | No | tapo |
| INFLUXDB_BUCKET | InfluxDB bucket | No | tapo |
| LOG_LEVEL | Logging level | No | INFO |
| LOG_DIR | Log directory | No | /var/log/tapo |
The exporter collects the following metrics:
For issues and feature requests, please visit our GitHub repository.
MIT License
Content type
Buildkit_cache
Digest
sha256:ecd6ebadb…
Size
568.5 MB
Last updated
10 months ago
docker pull j4v3l/tapo-exporter:buildcache