Browse Source

Change default mqtt prefix to hoymiles/serial

pull/25/head
Jan-Jonas Sämann 3 years ago
parent
commit
a1cfaf5918
  1. 11
      tools/rpi/ahoy.py
  2. 2
      tools/rpi/ahoy.yml.example

11
tools/rpi/ahoy.py

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

2
tools/rpi/ahoy.yml.example

@ -17,4 +17,4 @@ ahoy:
- name: 'balkon' - name: 'balkon'
serial: 114172220003 serial: 114172220003
mqtt: mqtt:
topic: 'ahoy/114172220143' # defaults to 'ahoy/{serial}' topic: 'hoymiles/114172221234' # defaults to 'hoymiles/{serial}'

Loading…
Cancel
Save