-- 测试区域
INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('320100', '0', '0', '测试区域', '测试区域', '测试区域', 4, 0);
INSERT INTO `adm_area` (`area_code`, `parent_code`, `ancestors`, `area_name`, `short_name`, `desc`, `order_num`, `status`) VALUES ('32010010', '320100', '0,320100', '1号楼', '1号楼', '1号楼', 1, 0);

INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('320100', '狄诺尼', '狄诺尼', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, 118.91,32.02);
INSERT INTO `adm_area_attr` (`area_code`, `attr_org`, `mgr_org`, `leader`, `phone`, `open_date`, `floor_area`, `usable_area`, `floor`, `longitude`, `latitude`) VALUES ('32010010', '狄诺尼', '狄诺尼', 'xxx', '13000000000', '2025-01-01', NULL, NULL, NULL, 118.91,32.02);

INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`) VALUES ('W203', '测试-供电网', 'W', 'W2', 1, '320100');

-- 对象模型表
INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W2_QF_GEEKOPEN', 'GeekOpen断路器', 2, 'http://127.0.0.1:9203/ems-dev-adapter/circuit-breaker/GeekOpen/abilityCall', NULL);
INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`, `ability_handler`, `event_handler`) VALUES ('M_W2_QS_KEKA_86', 'KEKA开关（86型）', 2, 'http://127.0.0.1:9203/ems-dev-adapter/button-switch/keka/86ButtonSwitchCall', NULL);

-- 测试能源设备
INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('864142073640059', '智能断路器', 'GEEK-OPEN', '30A-4G', 1, '综合楼茶水间', '32010010', '320100', 'M_W2_QF_GEEKOPEN', 'W203', 'QF', 'SYS_BA');
INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-QS-10000001', '照明控制-灯1', '德力西', '485开关', 1, '综合楼大厅', '32010010', '321283124S3001', 'M_W2_QS_KEKA_86', 'W203', 'QS', 'SYS_BA');
INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-QS-10000002', '照明控制-灯2', '德力西', '485开关', 1, '综合楼大厅', '32010010', '321283124S3001', 'M_W2_QS_KEKA_86', 'W203', 'QS', 'SYS_BA');
INSERT INTO `adm_ems_device` (`device_code`, `device_name`, `device_brand`, `device_spec`, `device_status`, `location`, `location_ref`, `area_code`, `device_model`, `ref_facs`, `ps_code`, `subsystem_code`) VALUES ('D-B-QS-10000003', '照明控制-锁定', '德力西', '485开关', 1, '综合楼大厅', '32010010', '321283124S3001', 'M_W2_QS_KEKA_86', 'W203', 'QS', 'SYS_BA');


-- 测试计量设备
INSERT INTO `adm_meter_device` (`area_code`, `device_code`, `device_model`, `device_name`, `device_enable`, `location_ref`, `location`, `meter_cls`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('321283124S3001', '864142073640059', 'M_W2_QF_GEEKOPEN', '智能断路器', 1, '321283124S300101', '综合楼C3-茶水间', 45, 3600, 0, 1, '智能表');


-- 对象属性DEMO数据
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Base', 'version', '固件版本号', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Base', 'iccid', '物联网卡ICCID号', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Base', 'imei', '设备imei', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'timerEnable', '上报定时开关', '', 'Enum');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'timerInterval', '上报时间间隔', '秒（S）', 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'signal', '信号强度', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'keyLock', '状态-按键锁定', NULL, 'Enum');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'key', '状态-通断', NULL, 'Enum');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'resetLock', '重置锁', NULL, 'Enum');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'State', 'onState', '设备上电的默认状态', NULL, 'Enum');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'power', '实时功率', '瓦（W）', 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'voltage', '实时电压', '伏特（V）', 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'current', '实时电流', '安培（A）', 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Measure', 'energy', '累计电量值', '千瓦时（kW·h）', 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'protocol', '协议', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'server', 'MQTT地址', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'port', 'MQTT端口', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'clientId', '设备ID', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'username', '用户名', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'subcribe', '订阅主题', NULL, 'Value');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QF_GEEKOPEN', 'Protocol', 'publish', '发布主题', NULL, 'Value');

INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Base', 'gatewayId', '网关编号', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Base', 'buttonId', '按键编号', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'protocol', '协议', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'server', 'MQTT地址', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'port', 'MQTT端口', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'publish', '发布主题', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'Protocol', 'subcribe', '订阅主题', NULL, 'String');
INSERT INTO `adm_ems_obj_attr` (`model_code`, `attr_group`, `attr_key`, `attr_name`, `attr_unit`, `attr_value_type`) VALUES ('M_W2_QS_KEKA_86', 'State', 'Switch', '开关状态', NULL, 'Enum');

-- 对象属性DEMO数据
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'current', '0.050', '2025-03-05 16:07:36');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'energy', '421.787', '2025-03-05 16:02:36');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'iccid', '898604E6192390306801', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'key', '1', '2025-03-05 15:57:59');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'keyLock', '0', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'onState', '2', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'power', '5.108', '2025-03-05 16:07:36');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'resetLock', '0', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'signal', '31', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'timerEnable', '1', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'timerInterval', '300', '2025-03-05 15:51:00');
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('864142073640059', 'M_W2_QF_GEEKOPEN', 'version', '1.0.1', '2025-03-05 15:51:00');

INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'gatewayId', '864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'buttonId', '1', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'protocol', 'mqtt', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'server', 'xt.wenhq.top', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'port', '8581', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'publish', '/sc/dtu/rep/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'subcribe', '/sc/dtu/ctl/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000001', 'M_W2_QS_KEKA_86', 'Switch', '0', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'gatewayId', '864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'buttonId', '2', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'protocol', 'mqtt', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'server', 'xt.wenhq.top', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'port', '8581', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'publish', '/sc/dtu/rep/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'subcribe', '/sc/dtu/ctl/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'Switch', '0', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'gatewayId', '864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'buttonId', '3', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'protocol', 'mqtt', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'server', 'xt.wenhq.top', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'port', '8581', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'publish', '/sc/dtu/rep/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'subcribe', '/sc/dtu/ctl/864814074089037', null);
INSERT INTO `adm_ems_obj_attr_value` (`obj_code`, `model_code`, `attr_key`, `attr_value`, `update_time`) VALUES ('D-B-QS-10000003', 'M_W2_QS_KEKA_86', 'Switch', '0', null);


-- 对象属性值枚举
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '0', '记忆');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '1', '分闸');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '2', '合闸');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'key', '1', '合闸');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'key', '0', '分闸');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'timerEnable', '0', '关闭');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'timerEnable', '1', '开启');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'keyLock', '0', '关闭');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'keyLock', '1', '开启');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'resetLock', '0', '关闭');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'resetLock', '1', '开启');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QS_KEKA_86', 'Switch', '0', '关闭');
INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QS_KEKA_86', 'Switch', '1', '开启');

-- 对象能力DEMO数据
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'OnOffCtl', '通断控制', '控制线路通断', '{"type":"Options", "list":[{"key":"断电", "value":"0"},{"key":"通电", "value":"1"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'KeyLockCtl', '按键控制', '设置按键控制锁定/解锁', '{"type":"Options", "list":[{"key":"解锁按钮", "value":"0"},{"key":"锁定按钮", "value":"1"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'settingCtl', '设备设置', '设备软重启/重置', '{"type":"Options", "list":[{"key":"软重启", "value":"restart"},{"key":"重置/恢复出厂", "value":"reset"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'settAutoReport', '电量上报设置', '设置电量信息定时上报', '{"type":"Options", "list":[{"key":"关闭上报", "value":"0"},{"key":"15分钟", "value":"900"},{"key":"30分钟", "value":"1800"},{"key":"1小时", "value":"3600"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'setOnState', '上电状态设置', '设置上电通断（默认关闭）', '{"type":"Options", "list":[{"key":"上电记忆", "value":"0"},{"key":"上电断开", "value":"1"},{"key":"上电开启", "value":"2"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'triggerSync', '数据同步', '触发设备信息同步', '{"type":"Options", "list":[{"key":"通讯同步", "value":"protocol"},{"key":"电量同步", "value":"statistic"},{"key":"状态同步", "value":"info"}]}', 1);

INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'on-off', '开关', '开启/关闭', '{"type":"Options", "list":[{"key":"开启", "value":"1"},{"key":"关闭", "value":"0"}]}', 1);
INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `param_definition`, `hidden_flag`) VALUES ('M_W2_QS_KEKA_86', 'syncState', '同步状态', '同步状态', null, 1);


-- 对象事件DEMO数据
INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event_name`, `event_desc`, `event_code`, `ext_event_code`) VALUES ('M_W2_QF_GEEKOPEN', 2, 'key-on', '设备上电', '设备上电', 'e-qf-on-0001', null);
INSERT INTO `adm_ems_obj_event` (`model_code`, `event_type`, `event_key`, `event_name`, `event_desc`, `event_code`, `ext_event_code`) VALUES ('M_W2_QF_GEEKOPEN', 2, 'key-off', '设备断电', '设备断电', 'e-qf-off-0001', null);


INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `scene_type`, `strategy_category`, `trigger_type`, `trigger_config`, `strategy_state`, `priority`, `strategy_desc`, `exec_mode`, `timeout`, `retry_times`, `last_exec_time`, `last_exec_result`, `exec_count`, `success_count`, `fail_count`, `version`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ('320100', 'POLLING_LIGHT_001', '灯1开启后打开灯2（轮询监控V2）', 'ENERGY_SAVE', 'AUTO', 5, NULL, 1, 50, '使用轮询监控机制：每2秒调用syncState能力查询灯1状态，当灯1开启时自动打开灯2', 1, 300, 0, '2025-12-11 17:10:06', 0, 16, 16, 0, 1, NULL, '2025-12-11 14:16:20', NULL, '2025-12-11 17:08:33');
INSERT INTO `adm_op_energy_strategy_trigger` (`strategy_code`, `trigger_name`, `trigger_type`, `source_obj_type`, `source_obj_code`, `source_model_code`, `event_key`, `attr_key`, `condition_expr`, `enable`, `priority`) VALUES ('POLLING_LIGHT_001', '监控灯1开关状态', 'POLLING', 2, 'D-B-QS-10000001', 'M_W2_QS_KEKA_86', '', 'Switch', '{\"left\":\"Switch\",\"op\":\"==\",\"right\":\"1\",\"polling\":{\"enabled\":true,\"interval\":2000,\"initialDelay\":1000,\"activeQuery\":true,\"queryWaitTime\":500,\"triggerMode\":\"ALWAYS\",\"queryAbility\":{\"abilityKey\":\"syncState\",\"abilityParam\":\"\"}}}', 1, 50);
INSERT INTO `adm_op_energy_strategy_step` (`strategy_code`, `step_code`, `step_name`, `step_type`, `step_index`, `parent_step_code`, `condition_expr`, `target_obj_type`, `target_obj_code`, `target_model_code`, `ability_key`, `ability_param`, `param_source`, `param_mapping`, `delay_seconds`, `retry_on_fail`, `retry_times`, `retry_interval`, `continue_on_fail`, `timeout`, `enable`, `remark`, `loop_max_count`, `loop_interval`, `loop_condition`) VALUES ('POLLING_LIGHT_001', 'STEP_1765444159961_kin3j', '能力调用', 'ABILITY', 1, NULL, NULL, 2, 'D-B-QS-10000002', 'M_W2_QS_KEKA_86', 'on-off', '1', 'STATIC', NULL, 10, NULL, NULL, NULL, 0, NULL, 1, NULL, 100, 1000, '');

