record_status.py 587 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter service
  5. name:record_status.py 处理update控制器的实时错误码
  6. author:rabin
  7. key:status/type/gateway/device
  8. """
  9. from demeter.core import *
  10. class Record_status(object):
  11. def handle(self, record, config, value):
  12. model = Demeter.model('device_info')
  13. model.hardware_id = config['child']
  14. model.hardware_type = 3
  15. device = model.select(type='fetchone')
  16. if device:
  17. param = {}
  18. param['info'] = device
  19. Demeter.service('device').switchAction(param, False, False, False, msg=value)