poll data from real BT device
This commit is contained in:
parent
df9447eee4
commit
cccfbf589c
|
@ -11,11 +11,12 @@ import threading
|
|||
from datetime import datetime
|
||||
from urllib.parse import urlsplit, parse_qs
|
||||
from random import randrange
|
||||
from eq3bt import Thermostat
|
||||
|
||||
hostName = "127.0.0.1"
|
||||
serverPort = 9100
|
||||
hostName = "10.10.3.3"
|
||||
serverPort = 9101
|
||||
exporter_prefix = "eq3bt_"
|
||||
eq3bt_max = "00:1A:22:0F:20:CA"
|
||||
eq3bt_mac = "00:1A:22:0F:20:CA"
|
||||
|
||||
request_count = 0
|
||||
scrape_healthy = True
|
||||
|
@ -73,11 +74,13 @@ def update_metrics():
|
|||
scrape_healthy = True
|
||||
eq3bt_metrics.clear()
|
||||
|
||||
try:
|
||||
eq3bt_metrics.append("target_temperature " + str(int(12.2)))
|
||||
eq3bt_metrics.append("valve " + str(int(12.2)))
|
||||
eq3bt_metrics.append("low_battery " + str(int(False)))
|
||||
eq3bt_metrics.append("window_open " + str(int(False)))
|
||||
try:
|
||||
thermostat = Thermostat(eq3bt_mac)
|
||||
thermostat.update()
|
||||
eq3bt_metrics.append("target_temperature " + str(int(thermostat.target_temperature)))
|
||||
eq3bt_metrics.append("valve " + str(int(thermostat.valve_state)))
|
||||
eq3bt_metrics.append("low_battery " + str(int(thermostat.low_battery)))
|
||||
eq3bt_metrics.append("window_open " + str(int(thermostat.window_open)))
|
||||
except Exception as ex:
|
||||
print("unable to poll data from eq3bt! error: " + str(ex))
|
||||
scrape_healthy = False
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[Unit]
|
||||
Description=Prometheus gas station exporter for fuel prices
|
||||
Documentation=https://git.mosad.xyz/localhorst/gas-station-exporter
|
||||
Documentation=https://git.mosad.xyz/localhorst/eq3bt-exporter
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
After=wg-quick@wg0.service
|
||||
|
@ -8,8 +8,8 @@ After=wg-quick@wg0.service
|
|||
[Service]
|
||||
Restart=always
|
||||
User=prometheus
|
||||
WorkingDirectory=/usr/bin/gas-station-exporter/
|
||||
ExecStart=/usr/bin/python3 gas-station-exporter.py
|
||||
WorkingDirectory=/usr/bin/eq3bt-exporter/
|
||||
ExecStart=/usr/bin/python3 eq3bt-exporter.py
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
TimeoutStopSec=20s
|
||||
SendSIGKILL=no
|
||||
|
|
Loading…
Reference in New Issue