<reponame>interactiveinstitute/watthappened<filename>energykit/fake/__main__.py<gh_stars>0
if __name__ == '__main__':
  from __init__ import *

  source = DataSource()

  streams = (
    source.get_stream_by_key(8000),
    source.get_stream_by_key(8001),
  )

  print 'keys:', source.get_stream_keys()

  for stream in streams:
    print 'set value at', 'http://localhost:%d/' % stream.key

  def handler(datapoint, source):
    print 'change', datapoint, 'from', source

  source.subscribe(handler)

  energykit.start()

if __name__ == '__main__':
  from __init__ import *

  source = DataSource()

  streams = (
    source.get_stream_by_key(8000),
    source.get_stream_by_key(8001),
  )

  print 'keys:', source.get_stream_keys()

  for stream in streams:
    print 'set value at', 'http://localhost:%d/' % stream.key

  def handler(datapoint, source):
    print 'change', datapoint, 'from', source

  source.subscribe(handler)

  energykit.start()