Change default mqtt prefix to hoymiles/serial

This commit is contained in:
Jan-Jonas Sämann 2022-05-05 21:07:25 +02:00
parent a33c49fd35
commit a1cfaf5918
2 changed files with 8 additions and 5 deletions

View file

@ -96,11 +96,14 @@ def poll_inverter(inverter):
print()
if mqtt_client:
mqtt_send_status(mqtt_client, inverter_ser, data)
mqtt_send_status(mqtt_client, inverter_ser, data,
topic=inverter.get('mqtt', {}).get('topic', None)
def mqtt_send_status(broker, interter_ser, data, topic=None):
""" Publish StatusResponse object """
def mqtt_send_status(broker, interter_ser, data):
topic = f'ahoy/{inverter_ser}'
if not topic:
topic = f'hoymiles/{inverter_ser}'
# AC Data
phase_id = 0
@ -125,7 +128,7 @@ def mqtt_send_status(broker, interter_ser, data):
def mqtt_on_command():
"""
Handle commands to topic
ahoy/{inverter_ser}/command
hoymiles/{inverter_ser}/command
frame it and put onto command_queue
"""
raise NotImplementedError('Receiving mqtt commands is yet to be implemented')