From b475c34878e55bf89e77b7dfc9da830d15c2fa16 Mon Sep 17 00:00:00 2001 From: vendetta Date: Mon, 17 Jul 2023 19:32:11 +0200 Subject: [PATCH] fixed NoneType access --- tools/rpi/hoymiles/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/rpi/hoymiles/__main__.py b/tools/rpi/hoymiles/__main__.py index 3ca840da..581b5acb 100644 --- a/tools/rpi/hoymiles/__main__.py +++ b/tools/rpi/hoymiles/__main__.py @@ -236,14 +236,14 @@ def poll_inverter(inverter, dtu_ser, do_init, retries): if isinstance(result, hoymiles.decoders.StatusResponse): data = result.__dict__() - if 'event_count' in data: + if data is not None and 'event_count' in data: if event_message_index[inv_str] < data['event_count']: event_message_index[inv_str] = data['event_count'] command_queue[inv_str].append(hoymiles.compose_send_time_payload(InfoCommands.AlarmData, alarm_id=event_message_index[inv_str])) if mqtt_client: mqtt_client.store_status(result, topic=inverter.get('mqtt', {}).get('topic', None)) - + if influx_client: influx_client.store_status(result)