Anonymous Anonymous - 9 months ago
788 0

TP-Link HS110 power monitoring with InfluxDB and Grafana


HS110 Python

#!/usr/bin/env python3
from pyHS100 import SmartPlug
from influxdb import InfluxDBClient
from time import sleep
import datetime

plug = SmartPlug("")
client = InfluxDBClient(database="homelab")
now =
theMonth = now.month

while True:
        power = plug.get_emeter_realtime()['power']
        monthly_power = plug.get_emeter_monthly()[theMonth]

                "measurement": "power",

                "fields": {
                        "month": theMonth,
                        "current_power": power,
                        "monthly_power": monthly_power
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download