#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    demeter service
    name:record_power.py 处理电源数据
    author:rabin
    key:power/type/gateway/device
"""
import time
import json
from demeter.core import *
class Record_power(object):

	def handle(self, record, config, value):
		self.record = record
		model = Demeter.model('setting_device_type')
		model.key = config['type']
		device_type = model.select(type='fetchone')
		if device_type:
			name = device_type['name'] + '#' + str(config['child'])
			self.record.save(config, value, name, device_type)