ISS binary sensor doesn't seem to update until HASS is restarted

Hi there. I’m running Home Assistant 0.38.4 and I’m using the ISS binary_sensor in combination with a template sensor to display the next overhead pass for my home location, and to show the position of the ISS on a map using the generic camera component.

It seems that once the “Next Visible” time has passed, it does not update to show when the next pass will be, and the map showing the location of the ISS freezes. It’s now been stuck like this for two days. I’m sure if I restart Home Assistant now everything will start working again until the next overhead pass time occurs.

The log seems to be very full (23MB in just a few days), starting with this error on the day the ISS component appeared to stop working:

17-02-21 16:47:14 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 386, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 382, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.4/socket.py", line 371, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/hass/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 388, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 308, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='api.open-notify.org', port=80): Read timed out. (read timeout=5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 387, in _update_entity_states
    yield from update_coro
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 209, in async_update_ha_state
    yield from self.hass.loop.run_in_executor(None, self.update)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/binary_sensor/iss.py", line 103, in update
    self.iss_data.update()
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
    result = method(*args, **kwargs)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/binary_sensor/iss.py", line 125, in update
    self.is_above = iss.is_ISS_above(self.latitude, self.longitude)
  File "/srv/hass/lib/python3.4/site-packages/pyiss/__init__.py", line 140, in is_ISS_above
    test = self.pass_times(latitude, longitude, altitude, 2)
  File "/srv/hass/lib/python3.4/site-packages/pyiss/__init__.py", line 87, in pass_times
    params=payload, timeout=5)
  File "/srv/hass/lib/python3.4/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/srv/hass/lib/python3.4/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/hass/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/hass/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/srv/hass/lib/python3.4/site-packages/requests/adapters.py", line 499, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='api.open-notify.org', port=80): Read timed out. (read timeout=5)
17-02-21 16:47:45 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 386, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/hass/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 382, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.4/socket.py", line 371, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

and so on…

##My configuration##

###includes/binary_sensors.yaml###
- platform: iss

###includes/sensors.yaml###
- platform: template
sensors:
iss_next_rise:
value_template: ‘{% set nextrise = as_timestamp(states.binary_sensor.iss.attributes.next_rise) | timestamp_custom("%a %d at %H:%M") %} {{ nextrise }}’
friendly_name: ‘Next Visible’

###includes/cameras.yaml###
- platform: generic
name: ISS
still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{ states.binary_sensor.iss.attributes.lat }},{{ states.binary_sensor.iss.attributes.long }}&zoom=4&size=500x300&maptype=roadmap&markers=anchor:center%7Cicon:https://example.com/images/satellite-variant.png|{{ states.binary_sensor.iss.attributes.lat }},{{ states.binary_sensor.iss.attributes.long }}
limit_refetch_to_url_change: true

###includes/groups.yaml###
iss:
name: International Space Station
entities:
- sensor.iss_next_rise
- camera.iss

Thanks for any info!

Chris

It looks like the issue is with the API at http://open-notify.org/ as on the site, the location and astronaut count are working but the pass predictions are not.

Oh, for goodness sake, I didn’t even think to check on the website!

Thanks for the reply, I will disable the component for now!

Chris

Pass Times calculator seems to be back up and running now

Sorry I never replied to your message - thanks for updating me.

Chris