vk2him / Enphase-Envoy-mqtt-json

Takes real time stream from Enphase Envoy and publishes to mqtt broker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work on Envoy Standard

panosnl opened this issue · comments

The script fails to continue when some API requests repond with in an empty [] result.

Is seems that some api call does not give a response on Envoy Standard since it does not have the CT meter readings.

Is the Envoy Standard not supported? There are still plenty of parameters I like to have logged real time... Don't care about the CT meter values since I have a P1 utility meter reporting to HA.

11/06/2024 19:34:59 Url: https://192.168.0.xxx/ivp/meters/readings
11/06/2024 19:34:59 headers: {'Authorization': 'Bearer eyJraW......'}
11/06/2024 19:34:59 stream: b'[]'
11/06/2024 19:34:59 Json Response: []
Exception in thread Thread-1 (scrape_stream_meters):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/root/Enphase-Envoy-mqtt-json/envoy_to_mqtt_json.py", line 379, in scrape_stream_meters
    json_string_freeds = json.dumps(round(stream.json()[1]["activePower"]))
                                          ~~~~~~~~~~~~~^^^
IndexError: list index out of range

This is only designed to work with production.json - do can clone this repo and change to work with other sources if you want