12345678910111213141516171819202122232425262728 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- demeter web
- name:sub.py
- author:rabin
- """
- from demeter.mqtt import *
- import random
- Sub()
- """
- data = {}
- data['type'] = 'temprature'
- data['gateway'] = '10086'
- data['device'] = '100010'
- data['hard'] = 'sensor'
- data['farm'] = 1
- data['source'] = str(random.randint(1, 50))
- data['value'] = str(random.randint(1, 50))
- model = Demeter.model('data', 'tsdb')
- #model.insert(data)
- data = model.select(data['farm'], data['device'], type=data['type'], hard=data['hard'], gateway=data['gateway'])
- print data
- """
|