From 7ac720d8dff313fa7a7d299fbcca3d64871588c3 Mon Sep 17 00:00:00 2001 From: Awin Huang Date: Thu, 10 Apr 2025 00:01:07 +0800 Subject: [PATCH] Fix ip of KasaPowerStrip in livingroom --- .gitignore | 3 +++ .python-version | 1 + README.md | 0 awinlib/tapo.py | 3 +++ prometheus_data_exporter.py | 2 +- pyproject.toml | 12 ++++++++++++ 6 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .python-version create mode 100644 README.md create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 8c2467b..4306012 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ __pycache__ +.venv +.secrect +uv.lock dockerfiles/dataExporter/code diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/awinlib/tapo.py b/awinlib/tapo.py index b3e8973..09769bc 100644 --- a/awinlib/tapo.py +++ b/awinlib/tapo.py @@ -3,6 +3,7 @@ from kasa.exceptions import KasaException from . import KasaSmartPowerStrip from .utilities import log as log +from .utilities import logE class KasaPowerStrip: @@ -11,8 +12,10 @@ class KasaPowerStrip: self.ip = ip try: self.powerStrip = KasaSmartPowerStrip.SmartPowerStrip(ip) + log(f'KasaPowerStrip connected({areaName}, {ip}).') except: self.powerStrip = None + logE(f'KasaPowerStrip connect fail({areaName}, {ip}).') def collectData(self): dataDict = {} diff --git a/prometheus_data_exporter.py b/prometheus_data_exporter.py index 0ecca91..736c538 100644 --- a/prometheus_data_exporter.py +++ b/prometheus_data_exporter.py @@ -55,7 +55,7 @@ def main(configs): hddTempExporter = HddTempDataExporter() cpuFanTempExporter = CpuFanTempDataExporter() - powerStripLivingroomExporter = KasaPowerStripDataExporter("livingroom", "192.168.1.203") + powerStripLivingroomExporter = KasaPowerStripDataExporter("livingroom", "192.168.1.204") powerStripAtticExporter = KasaPowerStripDataExporter("attic", "192.168.1.202") t315Atticexporter = TapoT315DataExporter(secrect["ip"], secrect["username"], secrect["password"], "鐵皮屋-溫濕度感測器", "attic-sensors") gaugeDict = {} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c8c6012 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,12 @@ +[project] +name = "linux-script" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "prometheus-client>=0.21.1", + "python-kasa>=0.10.2", + "rich>=14.0.0", + "schedule>=1.2.2", +]