server/api.py
def api_sensors():
  """ Returns all available sensors, their name, ID
  """

  # Parse callback name. If not found take default
  callbackFunc = request.args.get("callback")
  if not callbackFunc:
    callbackFunc = DEFAULT_CALLBACK_FUNC

  # Retrieve sensors
  cur = app.sqlite.cursor()
  query = """
      SELECT 
        DISTINCT('"' || device_uid || '":"' || device_name || '"') AS device
        FROM {0};
    """.format(DB_TABLE)

  # Execute query
  cur.execute(query)      
  rows = cur.fetchall()

  # Parse and return
  sensors = []
  for row in rows:
    sensors.append(row[0])
  return "{0}({{ \"sensors\":{{{1}}} }});".format(callbackFunc, ','.join(sensors))
 Returns all available sensors, their name, ID
  
Returns all available sensors, their name, ID
Returns all available sensors their name ID
def api_sensors():
  callbackFunc = request.args.get("callback")
  if not callbackFunc:
    callbackFunc = DEFAULT_CALLBACK_FUNC
  cur = app.sqlite.cursor()
  query = """
      SELECT 
        DISTINCT('"' || device_uid || '":"' || device_name || '"') AS device
        FROM {0};
    """.format(DB_TABLE)
  cur.execute(query)      
  rows = cur.fetchall()
  sensors = []
  for row in rows:
    sensors.append(row[0])
  return "{0}({{ \"sensors\":{{{1}}} }});".format(callbackFunc, ','.join(sensors))
def api_sensors ( ) : callbackFunc = request . args . get ( "callback" ) if not callbackFunc : callbackFunc = DEFAULT_CALLBACK_FUNC cur = app . sqlite . cursor ( ) query = """
      SELECT 
        DISTINCT('"' || device_uid || '":"' || device_name || '"') AS device
        FROM {0};
    """ . format ( DB_TABLE ) cur . execute ( query ) rows = cur . fetchall ( ) sensors = [ ] for row in rows : sensors . append ( row [ 0 ] ) return "{0}({{ \"sensors\":{{{1}}} }});" . format ( callbackFunc , ',' . join ( sensors ) )
Returns all available sensors, their name, ID
Returns all available sensors their name ID
""" Returns all available sensors, their name, ID
  """ # Parse callback name. If not found take default # Retrieve sensors # Execute query # Parse and return