|
@@ -103,35 +103,36 @@ class Device(object):
|
|
|
model = Demeter.model('device_gateway')
|
|
|
model.id = info['gateway_id']
|
|
|
gateway = model.select(type='fetchone')
|
|
|
+
|
|
|
+ model = Demeter.model('device_type')
|
|
|
+ model.id = info['type_id']
|
|
|
+ type_info = model.select(type='fetchone')
|
|
|
+ if type_info['unit'] == 'button':
|
|
|
+ if param['switch'] == 1:
|
|
|
+ oper = '升起'
|
|
|
+ elif param['switch'] == 2:
|
|
|
+ oper = '降下'
|
|
|
+ elif param['switch'] == 5:
|
|
|
+ oper = '停止'
|
|
|
+ else:
|
|
|
+ if param['switch'] == 1:
|
|
|
+ oper = '开启'
|
|
|
+ else:
|
|
|
+ oper = '关闭'
|
|
|
+
|
|
|
if msg == 'ok':
|
|
|
model = Demeter.model('device_info')
|
|
|
model.id = info['id']
|
|
|
model.update(value=param['switch'], exp='1')
|
|
|
|
|
|
|
|
|
- self.mul(info['id'], info['name'], param['switch'], '成功', True)
|
|
|
+ self.mul(info['id'], info['name'], param['switch'], '成功', True, oper=oper)
|
|
|
else:
|
|
|
msg = self.notice(msg)
|
|
|
model = Demeter.model('device_info')
|
|
|
model.id = info['id']
|
|
|
model.update(exp=msg)
|
|
|
|
|
|
- model = Demeter.model('device_type')
|
|
|
- model.id = info['type_id']
|
|
|
- type_info = model.select(type='fetchone')
|
|
|
- if type_info['unit'] == 'button':
|
|
|
- if param['switch'] == 1:
|
|
|
- oper = '升起'
|
|
|
- elif param['switch'] == 2:
|
|
|
- oper = '降下'
|
|
|
- elif param['switch'] == 5:
|
|
|
- oper = '停止'
|
|
|
- else:
|
|
|
- if param['switch'] == 1:
|
|
|
- oper = '开启'
|
|
|
- else:
|
|
|
- oper = '关闭'
|
|
|
-
|
|
|
|
|
|
self.mul(info['id'], info['name'], param['switch'], '失败:' + msg, False, oper=oper)
|
|
|
|