Trouble with Enphase Envoy

I dont get anything in overview
I put this into configuration.yaml

sensor:

  • platform: enphase_envoy
    ip_address: xx.xx.xx.xx

(I have Xed out the ip)
and get the following in the log

Log Details (ERROR)
Thu Sep 06 2018 06:58:19 GMT+1000 (AEST)
enphase_envoy: Error on device update!
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 251, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 353, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/enphase_envoy.py”, line 87, in update
self._state = int(envoy_reader.production(self._ip_address))
ValueError: invalid literal for int() with base 10: '{“production”:[{“type”:“inverters”,“activeCount”:20,“readingTime”:1536180737,“wNow”:78,“whLifetime”:13200042}],“storage”:[{“type”:“acb”,“activeCount”:0,“readingTime”:0,“wNow”:0,“whNow”:0,“state”:"idl

First of all, it’s really hard to read the log file snippet. Could you please follow the advise on the top of the page and format your log as a code block?

Now, from what I can see, the JSON returned by your Envoy does not contain the expected production data. I don’t know why though.

The error logged also seems to indicate that the envoy_reader library and the HA sensor don’t work well together. In case of an error while fetching data from the Envoy, the library clearly returns a string with the error message, but the HA sensor still interprets the returned value as a number.

I just saw that the next HA version (0.78) will contain an update of the envoy_reader library which should catch this particular error you experience.

I just upgraded to 0.78.3 and it doesn’t read correctly the Enphase_envoy sensor.
It prints the following error message:
“Got a response, but it doesn’t look right. Check the IP address”
The IP address is ok.
From this thread:


I tried the http://envoy/api/v1/production query and the answer was:
{
“wattHoursToday”: 5259,
“wattHoursSevenDays”: 39453,
“wattHoursLifetime”: 4333252,
“wattsNow”: 156
}
It comes from a first generation Envoy (NOT Envoy-S or Envoy-S metered).
Possibly, the added variables pertaining to consumption brake the reader.

In Addition, trying to run the envoy_reader.py script (Ubuntu install) I get the following:

nikos@Ubuntu-18:~/homeassistant/lib/python3.6/site-packages/envoy_reader$ python3 envoy_reader.py
Enter the Envoy IP address, or press enter to search for it.192.168.0.254
Traceback (most recent call last):
File “envoy_reader.py”, line 161, in
print(“production {}”.format(EnvoyReader(host).production()))
File “envoy_reader.py”, line 22, in production
raw_json = EnvoyReader.call_api(self)
File “envoy_reader.py”, line 13, in call_api
if response.status_code == 200 and len(response.json()) == 3:
File “/home/nikos/.local/lib/python3.6/site-packages/requests/models.py”, line 896, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/lib/python3/dist-packages/simplejson/init.py”, line 518, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3/dist-packages/simplejson/decoder.py”, line 370, in decode
obj, end = self.raw_decode(s)
File “/usr/lib/python3/dist-packages/simplejson/decoder.py”, line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 5 (char 4)
nikos@Ubuntu-18:~/homeassistant/lib/python3.6/site-packages/envoy_reader$

@Nikos_Michailidis Can you query http://envoy/production.json and post the results. It actually should be working with first gen Envoys now, so I’m not sure what the problem is.

@Nikos_Michailidis
Or it could be the use of SimpleJSON. I’ve only tested it with the built in Python JSON. Have you set up your system to default to SimpleJSON? If so would it be easy for you to temporarily switch to the built in JSON and see if that fixes your problem?

Yes mine is working fine now

I’m on 0.78.3 and receive the ‘Got a response, but it doesn’t look right. Check the IP address’. IP_ADDRESS/api/v1/production shows

{
  "wattHoursToday": 19945,
  "wattHoursSevenDays": 141443,
  "wattHoursLifetime": 21756695,
  "wattsNow": 0
}

Any ideas?

@jesserizzo

http://envoy/production.json returns:


Page Not Found

The page you tried to view does not exist Try the home page


Envoy firmware version: R3.12.45 (f9b2fc) ->latest available for Envoy-R-EU units

According to the following thread, it seems that the old Envoy does not publish the IP/production.json page:

Created a PR to fix detection of Envoy-C
https://github.com/jesserizzo/envoy_reader/pull/3

Will the Home Assistant component be updated with these fixes?

Yes. The PR for Home assistant has already been approved. Think it’ll land in 0.80. I’m also waiting for it, because I have the old envoy.
https://github.com/home-assistant/home-assistant/pull/17032

Excellent thank you!

Last update 0.80 fixed it for me Thanks!!
envoy software; R3.11.30 (0c976a)
sensor:

  • platform: enphase_envoy
    ip_address: ‘192.168.1.155’
    monitored_conditions:
    • production
1 Like

Seems like everything is working in version 84.6. Any idea why we don’t query the api from enphase rather than the local device?

Not all sites have reliable internet. My mother in laws place is on satellite so it is definitely better to try local data first

That could really be said for most things in HA that require a API call.

Their API is a lot harder to work with compared to just calling the local device.

Hi,

I’m not getting anything in HA

when I do http://envoy/production.json

I get this answer

{"production":[{"type":"inverters","activeCount":12,"readingTime":0,"wNow":0,"whLifetime":1281098}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}

Problem has come back for me too.
HA version 0.85.1
I have an envoy-S, Software VersionD4.6.22 (50c04d)

{“production”:[{“type”:“inverters”,“activeCount”:20,“readingTime”:1547887020,“wNow”:120,“whLifetime”:15918106}],“storage”:[{“type”:“acb”,“activeCount”:0,“readingTime”:0,“wNow”:0,“whNow”:0,“state”:“idle”}]}