mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-01 03:06:21 +02:00
Add mqtt global head (print timestamp) and add DC-yield-daily
MQTT record must have a timestamp for visualising last data received. DC-yield-daily is availible in "data" variable, but not printed in mqtt record. MQTT topics between ESP and RPI shoud be equel, so I sugest to change topic for YieldTotal
This commit is contained in:
parent
f8fe044e1b
commit
7dedcc2c8a
1 changed files with 7 additions and 2 deletions
|
@ -209,6 +209,10 @@ def mqtt_send_status(broker, inverter_ser, data, topic=None):
|
|||
if not topic:
|
||||
topic = f'hoymiles/{inverter_ser}'
|
||||
|
||||
# Global Head
|
||||
if data['time'] is not None:
|
||||
broker.publish(f'{topic}/time', data['time'].strftime("%d.%m.%y - %H:%M:%S"))
|
||||
|
||||
# AC Data
|
||||
phase_id = 0
|
||||
for phase in data['phases']:
|
||||
|
@ -220,10 +224,11 @@ def mqtt_send_status(broker, inverter_ser, data, topic=None):
|
|||
# DC Data
|
||||
string_id = 0
|
||||
for string in data['strings']:
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/total', string['energy_total']/1000)
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/power', string['power'])
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/voltage', string['voltage'])
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/current', string['current'])
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/power', string['power'])
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/YieldDay', string['energy_daily'])
|
||||
broker.publish(f'{topic}/emeter-dc/{string_id}/YieldTotal', string['energy_total']/1000)
|
||||
string_id = string_id + 1
|
||||
# Global
|
||||
if data['powerfactor'] is not None:
|
||||
|
|
Loading…
Add table
Reference in a new issue