|
@@ -6,11 +6,11 @@
|
|
|
author:rabin
|
|
|
"""
|
|
|
from __load__ import *
|
|
|
+from demeter.mqtt import *
|
|
|
|
|
|
class index_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
|
|
|
self.data['gateway'] = self.service('common').list('device_gateway', state=True, search={'farm_id':self.data['setting']['farm']})
|
|
@@ -22,19 +22,19 @@ class index_path(Load):
|
|
|
class mul_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['list'] = self.service('common').list('device_mul', search={'farm_id':self.data['setting']['farm']})
|
|
|
if self.data['list']:
|
|
|
for key, value in enumerate(self.data['list']):
|
|
|
- info = self.service('common').one('device_mul_queue', mul_id=value['id'])
|
|
|
+ model = Demeter.model('device_mul_queue')
|
|
|
+ model.status = 1
|
|
|
+ info = model.select(type='fetchone')
|
|
|
if not info:
|
|
|
self.data['list'][key]['oper'] = ''
|
|
|
self.view("device/mul.html")
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
value = self.input('value')
|
|
@@ -69,7 +69,6 @@ class mul_path(Load):
|
|
|
class screen_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
device = self.input('device')
|
|
|
|
|
@@ -115,7 +114,6 @@ class screen_path(Load):
|
|
|
class screen_set_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['info'] = self.data['setting']['farmInfo']
|
|
|
self.data['info']['devices'] = self.data['info']['gateway']
|
|
@@ -125,7 +123,6 @@ class screen_set_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -135,6 +132,13 @@ class screen_set_path(Load):
|
|
|
self.out(u'请选择设备')
|
|
|
return
|
|
|
update['gateway'] = str(update['gateway'])
|
|
|
+ if update['welcome']:
|
|
|
+ value = update['welcome']
|
|
|
+ else:
|
|
|
+ value = self.data['setting']['farmInfo']['name']
|
|
|
+ key = 'update/w/' + id
|
|
|
+ pub = Pub()
|
|
|
+ pub.push(key, value)
|
|
|
state = self.service('common').update('farm', id, update)
|
|
|
self.out('yes', {'id':state})
|
|
|
|
|
@@ -142,7 +146,6 @@ class screen_set_path(Load):
|
|
|
class data_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
Device.data(self)
|
|
|
if 'stat' in self.data and self.data['stat']:
|
|
@@ -153,7 +156,6 @@ class data_path(Load):
|
|
|
class pic_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
Device.pic(self)
|
|
|
self.view("device/pic.html")
|
|
@@ -162,7 +164,6 @@ class pic_path(Load):
|
|
|
class stat_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
Device.stat(self)
|
|
|
self.view("device/stat.html")
|
|
@@ -171,7 +172,6 @@ class stat_path(Load):
|
|
|
class log_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
Device.log(self)
|
|
|
self.view("device/logs.html")
|
|
@@ -180,7 +180,6 @@ class log_path(Load):
|
|
|
class group_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
|
|
|
self.data['page'] = self.service('common').list('device_page', order='inorder asc,cdate desc', search={'farm_id':self.data['setting']['farm']})
|
|
@@ -197,7 +196,6 @@ class group_path(Load):
|
|
|
class update_device_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('device_id')
|
|
|
if id:
|
|
@@ -213,7 +211,6 @@ class update_device_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -234,7 +231,6 @@ class update_device_path(Load):
|
|
|
class update_page_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('id')
|
|
|
|
|
@@ -248,7 +244,6 @@ class update_page_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -276,7 +271,6 @@ class update_page_path(Load):
|
|
|
class update_group_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
page = self.input('page')
|
|
|
self.data['page'] = self.service('common').one('device_page', id=page)
|
|
@@ -292,7 +286,6 @@ class update_group_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -315,7 +308,6 @@ class update_group_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def delete(self):
|
|
|
id = self.input('id')
|
|
|
if not id:
|
|
@@ -328,7 +320,6 @@ class update_group_path(Load):
|
|
|
class set_mul_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['name'] = '批量控制'
|
|
|
Device.set(self)
|
|
@@ -342,7 +333,6 @@ class set_mul_path(Load):
|
|
|
class update_set_mul_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('id')
|
|
|
self.data['info'] = {}
|
|
@@ -356,7 +346,6 @@ class update_set_mul_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -378,7 +367,6 @@ class update_set_mul_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def delete(self):
|
|
|
id = self.input('id')
|
|
|
if not id:
|
|
@@ -391,7 +379,6 @@ class update_set_mul_path(Load):
|
|
|
class set_timing_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['name'] = '定时设置'
|
|
|
Device.set(self)
|
|
@@ -421,7 +408,6 @@ class set_timing_path(Load):
|
|
|
class update_set_timing_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('id')
|
|
|
Device.setCronOper(self)
|
|
@@ -437,7 +423,6 @@ class update_set_timing_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -460,7 +445,6 @@ class update_set_timing_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def delete(self):
|
|
|
id = self.input('id')
|
|
|
if not id:
|
|
@@ -473,7 +457,6 @@ class update_set_timing_path(Load):
|
|
|
class set_loop_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['name'] = '周期设置'
|
|
|
Device.set(self)
|
|
@@ -511,7 +494,6 @@ class set_loop_path(Load):
|
|
|
class update_set_loop_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('id')
|
|
|
Device.setCronOper(self)
|
|
@@ -525,7 +507,6 @@ class update_set_loop_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -556,7 +537,6 @@ class update_set_loop_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def delete(self):
|
|
|
id = self.input('id')
|
|
|
if not id:
|
|
@@ -572,7 +552,6 @@ class update_set_loop_path(Load):
|
|
|
class set_condition_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
self.data['name'] = '条件控制'
|
|
|
Device.set(self)
|
|
@@ -603,7 +582,6 @@ class set_condition_path(Load):
|
|
|
class update_set_condition_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
id = self.input('id')
|
|
|
Device.setCronOper(self)
|
|
@@ -618,7 +596,6 @@ class update_set_condition_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
update = {}
|
|
@@ -658,7 +635,6 @@ class update_set_condition_path(Load):
|
|
|
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def delete(self):
|
|
|
id = self.input('id')
|
|
|
if not id:
|
|
@@ -674,7 +650,6 @@ class update_set_condition_path(Load):
|
|
|
class update_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def post(self):
|
|
|
id = self.input('id')
|
|
|
value = self.input('value')
|
|
@@ -707,7 +682,6 @@ class update_path(Load):
|
|
|
class get_path(Load):
|
|
|
@Web.auth
|
|
|
@Web.setting
|
|
|
- @Web.setting
|
|
|
def get(self):
|
|
|
|
|
|
id = self.input('id')
|