『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1283|回复: 15

[技术探讨] 欧瑞博22键遥控器JS转换器

[复制链接]

31

主题

296

帖子

1366

积分

金牌会员

Rank: 6Rank: 6

积分
1366
金钱
1070
HASS币
0
发表于 2023-8-23 09:23:11 | 显示全部楼层 |阅读模式
本帖最后由 hcfong2020 于 2023-10-9 08:34 编辑

2023年10月9日更新,之前代码里面有些未写入,导致显露的时候出错,现在修复了。如果需要长按功能的请自行对照代码添加,只显露了单击的功能。附件中是最新的代码。
orb (4).zip (878 Bytes, 下载次数: 19)


遥控器按键收到的反馈是
No converter available for 'Orviboremote' with cluster '23' and type 'raw' and data '{"data":[25,0,8,4,0,0],"type":"Buffer"}'
No converter available for 'Orviboremote' with cluster '23' and type 'raw' and data '{"data":[25,0,8,1,0,0],"type":"Buffer"}'
每个按键收到的信息都不一样。

参考京鱼的按键的写法,但是不知道问题在哪里!有没有高手指点一下。
const fzLocal = {
    WSZ01_on_off_action: {
      cluster: '23',
      type: ['raw'],
      convert: (model, msg, publish, options, meta) => {
          //const clickMapping = {'[25,0,8,1,0,0]': 'release', '[25,0,8,2,0,0]': 'single', '[25,0,8,3,0,0]': 'double', '[25,0,8,4,0,0]': 'hold'};
                  const clickMapping = {0: 'release', 1: 'single', 2: 'double', 3: 'hold'};
          return {action: `${clickMapping[msg.data[170]]}`};
                  //return {action: msg.data['data'][3]};
      },
  },
  //23:26:56Received Zigbee message from '橱柜按钮', type 'attributeReport', cluster '65029', data '{"1":1}' from endpoint 1 with groupID 0     
  //Received Zigbee message from '橱柜按钮', type 'attributeReport', cluster '65029', data '{"1":2}' from endpoint 1 with groupID 0
  
  //No converter available for 'Orviboremote' with cluster '23' and type 'raw' and data '{"data":[25,0,8,1,0,0],"type":"Buffer"}'
  //No converter available for 'Orviboremote' with cluster '23' and type 'raw' and data '{"data":[25,0,8,4,0,0],"type":"Buffer"}'
  
//Debug 2023-08-22 23:56:55Received Zigbee message from '欧瑞博2', type 'attributeReport', cluster 'genBasic', data '{"170":1}' from endpoint 1 with groupID 0

};

module.exports = [

    // 无线开关
    {
        zigbeeModel: ['f2f44307f16b4b289ff99278e1c8fbf7'],
        model: 'orvibo',
        vendor: 'ADEO',
        description: 'Wireless switch',
        supports: "action, battery, linkquality",
        fromZigbee: [fzLocal.WSZ01_on_off_action],
        toZigbee: [],
        exposes: [e.action(['release', 'single', 'double', '[25,0,8,4,0,0]'])],
    },
]

欧瑞博

欧瑞博



回复

使用道具 举报

31

主题

296

帖子

1366

积分

金牌会员

Rank: 6Rank: 6

积分
1366
金钱
1070
HASS币
0
 楼主| 发表于 2023-8-23 16:48:50 | 显示全部楼层
搞定了,原来写这个文件有出处的还是比较简单的。
回复

使用道具 举报

2

主题

19

帖子

2169

积分

金牌会员

Rank: 6Rank: 6

积分
2169
金钱
2150
HASS币
0
发表于 2023-8-23 17:27:17 | 显示全部楼层
怎么写的? 像这种数据,是怎么利用的。'Orviboremote' with cluster '23' and type 'raw' and data '{"data":[25,0,8,4,0,0],"type":"Buffer"}'  可否分享下
回复

使用道具 举报

31

主题

296

帖子

1366

积分

金牌会员

Rank: 6Rank: 6

积分
1366
金钱
1070
HASS币
0
 楼主| 发表于 2023-8-24 22:01:50 | 显示全部楼层
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const fzLocal = {
    orvibo_raw_remote: {
        cluster: 23,
        type: 'raw',
        convert: (model, msg, publish, options, meta) => {
            const buttonLookup = {
                1: 'button_openall',
                2: 'button_athome',
                3: 'button_leavehome',
                4: 'button_closeall',
                5: 'button_1',
                6: 'button_2',
                7: 'button_3',
                8: 'button_4',
                9: 'button_5',
                10: 'button_6',
                11: 'button_7',
                12: 'button_8',
                13: 'button_10',
                14: 'button_9',
                15: 'button_0',
                16: 'button_20',
                17: 'button_lock',
                21: 'button_sleep',
                                23: 'button_music',
            };

            const actionLookup = {
                0: 'click',
                2: 'hold',
                3: 'release',
            };
            const button = buttonLookup[msg.data[3]];
            const action = actionLookup[msg.data[5]];
            if (button) {
                return {action: `${button}_${action}`};
            }
        },
    },
};

module.exports = [

    {
        zigbeeModel: ['f2f44307f16b4b289ff99278e1c8fbf7'],
        model: 'RC808ZB',
        vendor: 'ORVIBO',
        description: 'MixSwitch 22 gangs',
        fromZigbee: [fzLocal.orvibo_raw_remote],
        toZigbee: [],
        exposes: [e.action()],
    },        
]
回复

使用道具 举报

7

主题

1086

帖子

3423

积分

论坛元老

Rank: 8Rank: 8

积分
3423
金钱
2337
HASS币
0
发表于 2023-8-25 11:04:06 | 显示全部楼层

我得记下来,作为参考,这个是第一个从debug到成品的帖子
回复

使用道具 举报

0

主题

143

帖子

1339

积分

金牌会员

Rank: 6Rank: 6

积分
1339
金钱
1196
HASS币
0
发表于 2023-8-28 10:37:25 | 显示全部楼层
感谢分享,刚好我也买了两个,这下可以用了
回复

使用道具 举报

4

主题

193

帖子

2633

积分

金牌会员

Rank: 6Rank: 6

积分
2633
金钱
2440
HASS币
0
发表于 2023-9-8 21:46:15 | 显示全部楼层
本帖最后由 kylin_fedora 于 2023-9-8 21:48 编辑

进入设备的exposes页面错了,楼主能帮忙看下吗?
系统信息如下:
Home Assistant 2023.9.0
Supervisor 2023.08.3
前端版本: 20230906.1 - latest


Zigbee2MQTT

Current version: 1.33.0-1

error.png
回复

使用道具 举报

31

主题

296

帖子

1366

积分

金牌会员

Rank: 6Rank: 6

积分
1366
金钱
1070
HASS币
0
 楼主| 发表于 2023-9-8 22:22:42 | 显示全部楼层
kylin_fedora 发表于 2023-9-8 21:46
进入设备的exposes页面错了,楼主能帮忙看下吗?
系统信息如下:
Home Assistant 2023.9.0

不太清楚。没有碰到过。
回复

使用道具 举报

31

主题

296

帖子

1366

积分

金牌会员

Rank: 6Rank: 6

积分
1366
金钱
1070
HASS币
0
 楼主| 发表于 2023-10-9 08:34:43 | 显示全部楼层
kylin_fedora 发表于 2023-9-8 21:46
进入设备的exposes页面错了,楼主能帮忙看下吗?
系统信息如下:
Home Assistant 2023.9.0

已经修复了。请自行下载。
回复

使用道具 举报

2

主题

19

帖子

2169

积分

金牌会员

Rank: 6Rank: 6

积分
2169
金钱
2150
HASS币
0
发表于 2023-10-9 12:18:39 | 显示全部楼层
显示支持的zigbee的设备,支持的不好, 想修改,有办法吗? 好像直接写js。还是调用之前的。 修改容器里面的,但是加载项的zigbee2mqtt,一重启就没了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-21 00:29 , Processed in 0.057793 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表