upgrade_management_device_commands.py 914 B

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # !/usr/bin/env python
  3. """
  4. """
  5. import os
  6. import sys
  7. #: current_dir - 2
  8. PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
  9. sys.path.insert(0, PROJECT_ROOT)
  10. from script.base import init_env, get_logger
  11. logger = get_logger(__name__)
  12. init_env(interactive=True)
  13. from apps.web.device.models import DeviceCommand
  14. cmd201 = DeviceCommand(templateString='{"cmd":201,"IMEI":"$IMEI"}', common=True, name=u'查询设备', identifier='check_device_info')
  15. cmd201.save()
  16. rsd_motor_set_command = DeviceCommand(
  17. templateString='{"cmd":202,"IMEI":"$IMEI","motor_set":{"stop_delay":$stop_delay,"tissue_timeout":$tissue_timeout}}',
  18. name=u'设置纸巾机电机参数',
  19. identifier='set_tissue_box_motor_config',
  20. devTypeCode='110300',
  21. common=False)
  22. rsd_motor_set_command.save()
  23. print 'success'