#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    demeter service
    name:record_status.py 处理update控制器的实时错误码
    author:rabin
    key:status/type/gateway/device
"""
from demeter.core import *
class Record_status(object):

	def handle(self, record, config, value):
		model = Demeter.model('device_info')
		model.hardware_id = config['child']
		model.hardware_type = 3
		device = model.select(type='fetchone')
		if device:
			param = {}
			param['info'] = device
			Demeter.service('device').switchAction(param, False, False, False, msg=value)