Skip to content
  • 版块
  • 最新
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
品牌标识

AIRIOT智慧系统搭建平台经验交流

Y

yunmoo

@yunmoo
关于
帖子
主题
群组
粉丝
关注

帖子

最新 最佳 有争议的

  • G340T驱动下发指令报错
    Y yunmoo

    中台数据表,发送关灯指令以后这个数据点更改为关灯
    image.png


  • G340T驱动下发指令报错
    Y yunmoo

    还有一个问题,在指令下发成功以后要更改某个数据点的数据如何设置?


  • G340T驱动下发指令报错
    Y yunmoo

    已经可以了 需要勾选单寄存器


  • G340T驱动下发指令报错
    Y yunmoo

    G340驱动下发写线圈指令报错
    以下为报错信息5c12107a-6ded-428d-bc92-1053a796b784-image.png
    指令配置
    56528891-e382-49b0-8bd7-5e18be4919a9-image.png
    实际需要发送的指令
    开:64 05 00 02 FF 00 24 0F
    关: 64 05 00 02 00 00 65 FF


  • MQTT驱动解析报文返回结果为什么会少一个字段
    Y yunmoo

    image.png负载电流为空
    image.png


  • MQTT驱动解析报文返回结果为什么会少一个字段
    Y yunmoo

    image.png这个返回的里面是有的


  • MQTT驱动解析报文返回结果为什么会少一个字段
    Y yunmoo

    收到数据不是json,是16进制数据帧51ac 2017 1ac8 0474 0000 0016 0000 0000 0000 0000 0000 0000 0081 7bca 14


  • MQTT驱动解析报文返回结果为什么会少一个字段
    Y yunmoo

    解析脚本如下

    
    // Parse the received data.(解析接收数据)
    // This method will be called to parse the messages received by this server and topic. The message topic is the method parameter topic, and the message content is the method parameter package.(该服务器和主题收到的消息会调用此方法进行解析,消息主题是方法参数topic,消息内容是方法参数package.)
    // The type of topic is string. Considering that the message content of some devices is binary data, the type of package is byte array.(topic类型为字符串;考虑到部分设备的消息内容为二进制数据,package类型为字节数组,)
    // When the uploaded data is a JSON string, first use JSON.parse(package) to convert the received data into a JSON object.(当上传数据为json字符串时,首先使用JSON.parse(package)将收到的数据转为json对象.)
    
    ParseHandle = function (topic, package) {
        // 1. 将输入数据转换为HEX字符串
        let hexData = '';
        if (typeof package === 'string') {
            hexData = package;
        } else if (package instanceof Uint8Array || Buffer.isBuffer(package)) {
            hexData = Array.from(package).map(b => 
                b.toString(16).padStart(2, '0')).join('');
        } else {
            console.error('[ERROR] 不支持的数据格式');
            return [];
        }
        hexData = hexData.toLowerCase().replace(/\s+/g, '');
        console.log('[DEBUG] 原始HEX数据:', hexData);
    
        // 2. 去除头部51(严格验证位置)
        if (hexData.startsWith('51')) {
            hexData = hexData.slice(2);
            console.log('[DEBUG] 去除头部51后的数据:', hexData);
        }
    
        // 3. 验证起始符(0xAC)和结束符(0xCA)
        // ------------------------------------------------------------
        // 关键修复:正确提取结束符位置(倒数第4-2字节为结束符0xCA)
        // ------------------------------------------------------------
        const endFlagPosition = hexData.length - 4; // 结束符位于倒数第4-2字节
        const actualEndFlag = hexData.substr(endFlagPosition, 2);
        if (!hexData.startsWith('ac')) {
            console.error('[ERROR] 起始符校验失败: 期望ac,实际为', hexData.substr(0,2));
            return [];
        }
        if (actualEndFlag !== 'ca') {
            console.error('[ERROR] 结束符校验失败: 期望ca,实际为', actualEndFlag);
            return [];
        }
    
        // 4. 提取核心数据区(去除起始符ac和结束符ca及后续字节)
        const coreData = hexData.slice(2, endFlagPosition);
        console.log('[DEBUG] 核心数据区:', coreData);
        if (coreData.length % 2 !== 0) {
            console.error('[ERROR] 数据长度异常: 非偶数字节长度');
            return [];
        }
    
        // 5. 转换为字节数组
        const bytes = [];
        for (let i = 0; i < coreData.length; i += 2) {
            bytes.push(parseInt(coreData.substr(i, 2), 16));
        }
        console.log('[DEBUG] 字节数组:', bytes);
        // 6. 关键字段解析(根据协议文档索引)
        const params = {
            isDaytime: "未知",
            batteryVoltage: null,
            loadCurrent: null,
            loadVoltage: null,
            isWorking: false,
            temp:null
        };
    
        try {
            // 6.1 蓄电池电压(命令字0x03-0x04,索引4-5)
            if (bytes.length >= 6) { // 至少需要6字节
                const batHigh = bytes[4];
                const batLow = bytes[5];
                params.batteryVoltage = ((batHigh << 8 | batLow) / 100).toFixed(2);
                console.log('[DEBUG] 蓄电池电压计算:', { batHigh, batLow, voltage: params.batteryVoltage });
            }
    
            // 6.2 负载电压(命令字0x08,索引8)
            if (bytes.length >= 9) { // 至少需要7字节
                params.loadVoltage = (bytes[8] * 0.1).toFixed(1);
                console.log('[DEBUG] 负载电压计算:', params.loadVoltage );
            }
    
            // 6.3 负载电流(命令字0x06-0x07,索引6-7)
            if (bytes.length >= 8) { // 至少需要8字节
                const loadCHigh = bytes[6];
                const loadCLow = bytes[7];
                params.loadCurrent = ((loadCHigh << 8 | loadCLow) / 10).toFixed(2);
                console.log('[DEBUG] 负载电流:', {loadCHigh, loadCLow, voltage: params.loadCurrent});
            }
    
            // 6.4 昼夜模式(命令字0x01,索引2低4位)
            if (bytes.length >= 4) {
                const modeByte = bytes[2];
                const mode = (modeByte & 0xF0) >> 4;
                params.isDaytime = mode === 0 ? "白天" : mode === 1 ? "夜晚" : "异常";
                console.log('[DEBUG] 昼夜模式:', { modeByte, mode });
            }
            //温度采集
            if (bytes.length >= 24) {
                params.temp = ((bytes[23] + 100) * 0.1).toFixed(1);
                console.log('[DEBUG] 温度:', params.temp );
            }
            // 6.5 工作状态判断(阈值过滤噪声)
            params.isWorking = (
                params.loadVoltage !== null && parseFloat(params.loadVoltage) > 0 &&
                params.loadCurrent !== null && parseFloat(params.loadCurrent) > 0
            );
            console.log('[DEBUG] 工作状态:', params.isWorking);
        } catch (e) {
            console.error('[ERROR] 解析异常:', e);
            return [];
        }
    
        // 7. 返回结果(设备ID从topic中提取)
        const topicParts = topic.split('/').filter(seg => seg !== '');
        const deviceId = topicParts.length >= 3 ? topicParts[1] : 'unknown'; 
        return [{
            id: deviceId,
            values: {
                operating_mode: params.isDaytime,
                battery_voltage: params.batteryVoltage !== null ? parseFloat(params.batteryVoltage) : 0,
                load_current: params.loadCurrent !== null ? parseFloat(params.loadCurrent) : 0,
                load_voltage: params.loadVoltage !== null ? parseFloat(params.loadVoltage) : 0,
                working_status: params.isWorking,
                temperature: params.temp !== null ? parseFloat(params.temp) : 0
            },
            time: Date.now()
        }];
    };
    // Build sending data. (构建发送数据。)
    CommandHandle = function (topic, id, op) {
      console.log(topic)
      console.log(id)
      console.log(JSON.stringify(op))
    
      // Build sending data. (构建发送数据。)
      let sendTopic = topic
      let c = JSON.stringify([{ "abc": op.value }])
      console.log(c)
      let sendData = Buffer.from(c)
      return {sendTopic, sendData} //The names of the keys in the returned object must be sendTopic and sendData. (返回的对象中的 key 的名字必须为 sendTopic、sendData。)
    }
    

    以下是日志
    b07a045e-1b33-46c6-8b84-a9abae485b2c-a56d78ee2124f0fe925e91df8c9b6ac.png
    没有返回 load_current


  • mqtt-client服务占用过多内存
    Y yunmoo

    是的
    image.png


  • mqtt-client服务占用过多内存
    Y yunmoo

    @Zhang书书


  • mqtt-client服务占用过多内存
    Y yunmoo

    更新了,但是现在登录项目后台报错
    image.png


  • mqtt-client服务占用过多内存
    Y yunmoo

    @Zhang书书 core找不到4.4.68版本的,并且没有tsdb-backup这个服务
    image.png


  • mqtt-client服务占用过多内存
    Y yunmoo

    我的也是这个问题,mqtt-client驱动占用内存比较高@Zhang书书
    image.png


  • 关于数据接口驱动指令不生效问题
    Y yunmoo

    这个是指令配置

    image.png
    这个是指令里对象的配置

    image.png
    这个是数据接口里的配置

    image.png


  • 关于数据接口驱动指令不生效问题
    Y yunmoo

    image.png
    2025-03-14 14:00:31 DEBUG 执行指令 msg="执行指令: 设备表=物联网杀虫灯,设备=njef1qDvEfaDoO982024082706866986,指令={"form":[{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"ioway":"表单写入","mod":null,"name":"adjustLight","objectValue":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"modelProperties","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"根对象","treeKey":"root","type":"object"}},"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null,"type":"object"}],"formSchema":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"adjustLight","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"adjustLight","treeKey":"root","type":"object"}},"id":"adjustLight","name":"adjustLight","ops":[{"key":"adjustLight","param":"adjustLight"}],"params":{"adjustLight":{"style":"on"}},"showName":"杀虫灯开关","tag":null,"title":"adjustLight","writeOut":{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"mod":null,"objectValue":null,"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null}}"
    2025-03-14 14:00:31 DEBUG 执行指令 msg="执行指令: 表=物联网杀虫灯,设备=njef1qDvEfaDoO982024082706866986,流水号=67d3c5ffc233d4cf4168f344,指令内容={"form":[{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"ioway":"表单写入","mod":null,"name":"adjustLight","objectValue":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"modelProperties","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"根对象","treeKey":"root","type":"object"}},"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null,"type":"object"}],"formSchema":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"adjustLight","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"adjustLight","treeKey":"root","type":"object"}},"id":"adjustLight","name":"adjustLight","ops":[{"key":"adjustLight","param":"adjustLight"}],"params":{"adjustLight":{"style":"on"}},"showName":"杀虫灯开关","tag":null,"title":"adjustLight","writeOut":{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"mod":null,"objectValue":null,"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null}}"
    2025-03-14 14:19:40 DEBUG 启动驱动 msg="读取设备数据: 设备表=物联网杀虫灯,设备:njef1qDvEfaDoO982024082706866986,周期=3600s"
    2025-03-14 14:19:40 DEBUG 启动驱动 msg="存数据点: 设备表=物联网杀虫灯,设备=njef1qDvEfaDoO982024082706866986,数据={"id":"njef1qDvEfaDoO982024082706866986","cid":"","source":"device","fields":{"battery_percent":69,"battery_voltage":11.5,"is_lighting":0,"is_online":1,"latitude":"30.680581650462","led_voltage":0,"longitude":"114.32987566655","outer_temperature":17,"rain_ctl_state":1,"run_day":3},"time":1741933180663,"fieldTypes":null}. 保存数据成功"
    2025-03-14 14:46:51 DEBUG 执行指令 msg="执行指令: 设备表=物联网杀虫灯,设备=njef1qDvEfaDoO982024082706866986,指令={"form":[{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"ioway":"表单写入","mod":null,"name":"adjustLight","objectValue":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"modelProperties","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"根对象","treeKey":"root","type":"object"}},"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null,"type":"object"}],"formSchema":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"adjustLight","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"adjustLight","treeKey":"root","type":"object"}},"id":"adjustLight","name":"adjustLight","ops":[{"key":"adjustLight","param":"adjustLight"}],"params":{"adjustLight":{"style":"on"}},"showName":"杀虫灯开关","tag":null,"title":"adjustLight","writeOut":{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"mod":null,"objectValue":null,"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null}}"
    2025-03-14 14:46:51 DEBUG 执行指令 msg="执行指令: 表=物联网杀虫灯,设备=njef1qDvEfaDoO982024082706866986,流水号=67d3d0dbc233d4cf4168f347,指令内容={"form":[{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"ioway":"表单写入","mod":null,"name":"adjustLight","objectValue":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"modelProperties","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"根对象","treeKey":"root","type":"object"}},"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null,"type":"object"}],"formSchema":{"schema":{"form":["style",""],"key":"root","listFields":["style"],"name":"adjustLight","properties":{"style":{"canOrder":false,"config":"选择器","createShow":true,"dataType":"string","descriptionType":"tooltip","editShow":true,"enum1":["on","off"],"enum_title1":["开","关"],"fieldType":"select","invalid":false,"key":"style","listFields":true,"metricStore":false,"need":false,"numRange":null,"selectFace":"flatten","selectType":"single","size":"middle","title":"style","type":"string","widthInForm":"24"}},"required":[],"title":"adjustLight","treeKey":"root","type":"object"}},"id":"adjustLight","name":"adjustLight","ops":[{"key":"adjustLight","param":"adjustLight"}],"params":{"adjustLight":{"style":"on"}},"showName":"杀虫灯开关","tag":null,"title":"adjustLight","writeOut":{"arrayValue":null,"defaultValue":null,"ifRepeat":null,"mod":null,"objectValue":null,"objectValue2":null,"select":null,"select2":null,"tableValue":null,"tableValue2":null,"tag":null,"tagValue":null}}"


  • 关于数据接口驱动指令不生效问题
    Y yunmoo

    数据接口设置了指令,能执行成功但是不生效,帮忙看下是什么原因
    f3267dbd-eeea-4b91-9295-3f4f0426a10c-image.png
    05cc1535-01f6-402c-babe-f85e8adf9baf-image.png
    aa09fd98-26a8-4a28-8424-0724a3ee4626-image.png


  • TCP server或者HTTP server驱动脚本支持字符转GB2312编码吗
    Y yunmoo

    好的,我这边试一下


  • TCP server或者HTTP server驱动脚本支持字符转GB2312编码吗
    Y yunmoo

    请问一下TCP server或者HTTP server驱动脚本支持字符转GB2312编码吗


  • 新建驱动报错发送下载响应错误:404 Not Found
    Y yunmoo

    @Zhang书书 这个可以了

  • 登录

  • 没有帐号? 注册

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 版块
  • 最新
  • 标签
  • 热门
  • 用户
  • 群组