home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.99k stars 29.64k forks source link

Enphase Envoy Component #16137

Closed rgabrielson11 closed 6 years ago

rgabrielson11 commented 6 years ago

Home Assistant release with the issue:

Last working Home Assistant release (if known):

New Component in 76.2

Operating environment (Hass.io/Docker/Windows/etc.):

Component/platform:

Description of problem:

The component does not work unless firmware on envoy is >R3.9 so only works on newer devices. May want to consider using API call from https://developer.enphase.com/ method instead

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):

Additional information:

2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/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: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 89, in update
    self._state = int(envoy_reader.daily_production(self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 92, in update
    self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 95, in update
    self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 98, in update
    self._state = int(envoy_reader.consumption(self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 101, in update
    self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:13:59 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 104, in update
    self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:14:00 ERROR (MainThread) [homeassistant.components.sensor] enphase_envoy: Error on device update!
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/app/homeassistant/helpers/entity.py", line 322, 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/src/app/homeassistant/components/sensor/enphase_envoy.py", line 107, in update
    self._ip_address))
ValueError: invalid literal for int() with base 10: '    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n    <html lang="en">\n    <!-- START HEAD CONTENT -->\n    <head>\n      <title>error</title>\n      <meta http-equiv="Content-Type" content="t
2018-08-22 19:14:06 ERROR (MainThread) [homeassistant.components.cover] Error while setting up platform myq
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/local/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='myqexternal.myqdevice.com', port=443): Read timed out. (read timeout=3.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/cover/myq.py", line 45, in setup_platform
    if not myq.is_login_valid():
  File "/usr/local/lib/python3.6/site-packages/pymyq/__init__.py", line 90, in is_login_valid
    timeout=self.REQUEST_TIMEOUT
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 526, in send
    raise ReadTimeout(e, request=request)
rgabrielson11 commented 6 years ago

@jesserizzo May want to look at this or address this in component comments. The local API address as called does not work on older envoy devices. there is an alternate API address

http://device.ip.address.here/api/v1/production

gives reduced info however but works on older systems

image

rgabrielson11 commented 6 years ago

image

I cannot update firmware beyond this version 'up to date'

jesserizzo commented 6 years ago

@rgabrielson11

I'll definitely look into this. That older api seems to update only every 15 minutes, but it might be the best we can do for older systems. Using the Enlighten api would be significantly more complicated for the user, and also I prefer to keep it on the local network, so I'm probably going to avoid that if at all possible.

jesserizzo commented 6 years ago

@rgabrielson11 If you have a minute can you pop over to https://github.com/jesserizzo/envoy_reader/blob/master/envoy_reader/envoy_reader.py and run that python script on the command line and see if it works for you. I believe I've got it supporting the original Envoy, the Envoy S and the Envoy IQ. Thanks.

rgabrielson11 commented 6 years ago

That seems to pull the data.

Enter the Envoy IP address, or press enter to search for it.192.168.1.13
Enter the model of the Envoy ('Original', 'S', or 'IQ'), or press enter.S
production 4258
consumption Unavailable
daily_production 10148
daily_consumption Unavailable
seven_days_production 220019
seven_days_consumption Unavailable
lifetime_production 37400569
lifetime_consumption Unavailable