mirror of
https://github.com/vakius/hassio-addon-lifepo4wered.git
synced 2026-08-01 20:44:12 +03:00
Add MQTT monitor with Home Assistant autodiscovery
Poll lifepo4wered-cli every 30s (configurable), publish all registers as one JSON state payload, and announce sensors/binary sensor via MQTT discovery. run.sh pulls broker credentials from the Supervisor mqtt service (Mosquitto addon) with manual overrides in addon options. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
0
tests/stubs/paho/__init__.py
Normal file
0
tests/stubs/paho/__init__.py
Normal file
BIN
tests/stubs/paho/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
tests/stubs/paho/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
0
tests/stubs/paho/mqtt/__init__.py
Normal file
0
tests/stubs/paho/mqtt/__init__.py
Normal file
BIN
tests/stubs/paho/mqtt/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
tests/stubs/paho/mqtt/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
tests/stubs/paho/mqtt/__pycache__/client.cpython-314.pyc
Normal file
BIN
tests/stubs/paho/mqtt/__pycache__/client.cpython-314.pyc
Normal file
Binary file not shown.
41
tests/stubs/paho/mqtt/client.py
Normal file
41
tests/stubs/paho/mqtt/client.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""Minimal paho-mqtt stand-in for end-to-end smoke tests without a broker.
|
||||
|
||||
Every publish is appended to the file named by $STUB_MQTT_LOG as
|
||||
"<topic>\t<payload>".
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class CallbackAPIVersion:
|
||||
VERSION1 = 1
|
||||
VERSION2 = 2
|
||||
|
||||
|
||||
class Client:
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.on_connect = None
|
||||
self._log = open(os.environ["STUB_MQTT_LOG"], "a")
|
||||
|
||||
def username_pw_set(self, username, password=None):
|
||||
pass
|
||||
|
||||
def will_set(self, topic, payload=None, qos=0, retain=False):
|
||||
pass
|
||||
|
||||
def connect(self, host, port=1883, keepalive=60):
|
||||
pass
|
||||
|
||||
def loop_start(self):
|
||||
if self.on_connect:
|
||||
self.on_connect(self, None, {}, 0, None)
|
||||
|
||||
def loop_stop(self):
|
||||
pass
|
||||
|
||||
def disconnect(self):
|
||||
self._log.close()
|
||||
|
||||
def publish(self, topic, payload=None, qos=0, retain=False):
|
||||
self._log.write("%s\t%s\n" % (topic, payload))
|
||||
self._log.flush()
|
||||
Reference in New Issue
Block a user