Close

Making use of the data

A project log for ISS HDEV image availability

The "High Definition Earth Viewing" experiment onboard the ISS runs a few cameras, but not always. Let's find out when video is available!

christophChristoph 08/17/2018 at 21:140 Comments

Now that the live image availability data is published as an MQTT topic that can be subscribed to, here's a script that combined this data with the ISS position:

# http://open-notify.org/Open-Notify-API/ISS-Location-Now/

import urllib2
import json
import paho.mqtt.client as mqtt
import time

def on_message(client, userdata, message):
  try:
    available = message.payload

    req = urllib2.Request("http://api.open-notify.org/iss-now.json")
    response = urllib2.urlopen(req)
    obj = json.loads(response.read())
    timestamp = obj['timestamp']
    lat = obj['iss_position']['latitude']
    lon = obj['iss_position']['longitude']

    print("{},{},{},{}".format(timestamp,lat,lon,available))

  except URLError:
    pass

client = mqtt.Client("issclient")
client.on_message = on_message
client.connect("test.mosquitto.org", 1883)
client.subscribe("iss-hdev-availability/available-bool")
client.loop_start()
while True:
  try:
    time.sleep(1)
  except KeyboardInterrupt:
    break
client.loop_stop()

 I've got a modified version of this running which will will self-terminate after 24 hours, to draw an availability map.

Discussions