Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luizbizzio/tuya-smart-plug-exporter
Prometheus exporter written in Python to collect metrics from Tuya smart plugs.
https://github.com/luizbizzio/tuya-smart-plug-exporter
exporter grafana homeautomation iot metrics monitoring open-source prometheus prometheus-exporter python smartplug tuya-devices
Last synced: 2 months ago
JSON representation
Prometheus exporter written in Python to collect metrics from Tuya smart plugs.
- Host: GitHub
- URL: https://github.com/luizbizzio/tuya-smart-plug-exporter
- Owner: luizbizzio
- License: mit
- Created: 2024-08-09T19:48:26.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-10T04:42:43.000Z (4 months ago)
- Last Synced: 2024-09-28T15:23:15.930Z (3 months ago)
- Topics: exporter, grafana, homeautomation, iot, metrics, monitoring, open-source, prometheus, prometheus-exporter, python, smartplug, tuya-devices
- Language: Python
- Homepage:
- Size: 69.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tuya Smart Plug Exporter 🔌📈
## Overview 📊
This script collects and exports key metrics from Tuya smart plugs to Prometheus. It tracks three important data points: power , current, and voltage. This allows you to monitor the performance of your smart plugs with ease.
## Features 🌟
- **Metrics Collection:** Retrieves power, current, and voltage data from Tuya smart plugs.
- **Prometheus Integration:** Provides metrics in a format compatible with Prometheus scraping.
- **Simple Configuration:** Easy to set up with minimal configuration required.
- **Low CPU Usage:** Designed to be efficient and have a minimal impact on system resources.## Configuration ⚙️
1. **Device Configuration:**
Update the `DEVICE_CONFIGS` list with your device details:
```python
# Device Configuration
DEVICE_IP = "DEVICE_LOCAL_IP"
DEVICE_ID = "DEVICE_ID"
LOCAL_KEY = "LOCAL_KEY"
```
If you are unsure how to obtain these following details, refer to [this tutorial](https://www.youtube.com/watch?v=Q1ZShFJDvE0)
- `DEVICE_IP`: Local IP address of your Tuya smart plug.
- `DEVICE_ID`: Unique identifier for your Tuya device.
- `LOCAL_KEY`: Authentication key for your Tuya device.3. **Exporter Port (Optional):**
Set the port for the Prometheus exporter in the script:
```python
EXPORTER_PORT = 9999
```## Usage 🚀
1. **Install Dependencies:**
Install the required Python packages:
```sh
pip install click tinytuya prometheus_client
```2. **Run the Script:**
Launch the script to start the Prometheus exporter:
```sh
python tuya_exporter.py
```3. **Access Metrics:**
After running the script, you can access the metrics at:
```init
http://localhost:9999/metrics
```## Notes 📝
- **Automatic Version Detection:** The script automatically tries different versions of the Tuya protocol to ensure connectivity. Manual adjustment is not needed for the version.
- **Configuration:** Ensure that device IPs, IDs, and local keys are correctly configured. You can verify these settings in the configuration section of the script.## License
This project is licensed under the MIT License.