sub.py 561 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter web
  5. name:sub.py
  6. author:rabin
  7. """
  8. from demeter.mqtt import *
  9. import random
  10. Sub()
  11. """
  12. data = {}
  13. data['type'] = 'temprature'
  14. data['gateway'] = '10086'
  15. data['device'] = '100010'
  16. data['hard'] = 'sensor'
  17. data['farm'] = 1
  18. data['source'] = str(random.randint(1, 50))
  19. data['value'] = str(random.randint(1, 50))
  20. model = Demeter.model('data', 'tsdb')
  21. #model.insert(data)
  22. data = model.select(data['farm'], data['device'], type=data['type'], hard=data['hard'], gateway=data['gateway'])
  23. print data
  24. """