找回密码
 立即注册

微信扫码登录

搜索
查看: 5171|回复: 17

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

[复制链接]

35

主题

285

回帖

1535

积分

金牌会员

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

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


遥控器按键收到的反馈是
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]'])],
    },
]

欧瑞博

欧瑞博



回复

使用道具 举报

35

主题

285

回帖

1535

积分

金牌会员

积分
1535
金钱
1215
HASS币
0
 楼主| 发表于 2025-5-3 05:34:53 | 显示全部楼层
zuobianfy 发表于 2023-10-9 12:18
显示支持的zigbee的设备,支持的不好, 想修改,有办法吗? 好像直接写js。还是调用之前的。 修改容器里面 ...

最近我才下载了最新版本的zigbee2mqtt,最新的代码在我后面的回复里面,应该可以使用了
回复

使用道具 举报

35

主题

285

回帖

1535

积分

金牌会员

积分
1535
金钱
1215
HASS币
0
 楼主| 发表于 2025-5-2 17:57:59 | 显示全部楼层
import {battery, diyruz_freepad_config} from "zigbee-herdsman-converters/converters/fromZigbee";
import {factory_reset} from "zigbee-herdsman-converters/converters/toZigbee";
import {access, presets} from "zigbee-herdsman-converters/lib/exposes";
import {bind} from "zigbee-herdsman-converters/lib/reporting";
import {getFromLookup, getKey} from "zigbee-herdsman-converters/lib/utils";

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',
                18: 'button_+',
                19: 'button_-',
                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}`};
            }
        },
    },
};

export default {
    zigbeeModel: ['f2f44307f16b4b289ff99278e1c8fbf7','RemoteControl-22'],
    model: 'RC808ZB',
    vendor: 'ORVIBO',
    description: 'MixSwitch 22 gangs',
    fromZigbee: [fzLocal.orvibo_raw_remote],
    toZigbee: [],
    exposes: [presets.action([
        'button_1_click', 'button_2_click', 'button_3_click', 'button_4_click', 'button_5_click', 'button_6_click',
        'button_7_click', 'button_8_click', 'button_9_click', 'button_10_click', 'button_lock_click', 'button_sleep_click',
        'button_openall_click', 'button_closeall_click', 'button_leavehome_click', 'button_athome_click', 'button_music_click', 'button_20_click',
        'button_0_click'
    ])],

    configure: async (device, coordinatorEndpoint, definition) => {
        // 这里可以添加配置逻辑,如果需要的话
    },
    endpoint: (device) => {
        // 这里可以添加端点逻辑,如果需要的话
        return {};
    },
回复

使用道具 举报

35

主题

285

回帖

1535

积分

金牌会员

积分
1535
金钱
1215
HASS币
0
 楼主| 发表于 2024-2-6 17:18:23 | 显示全部楼层
sunshine 发表于 2024-1-18 10:18
请问+  - 设置按键是不支持的吗?

这个遥控有多种型号,有些版本可以支持加减,支持加减的不支持10和20,不支持加减的支持10和20.
回复

使用道具 举报

0

主题

244

回帖

2190

积分

金牌会员

积分
2190
金钱
1946
HASS币
0
QQ
发表于 2024-1-18 10:18:57 | 显示全部楼层
请问+  - 设置按键是不支持的吗?
回复

使用道具 举报

2

主题

44

回帖

3108

积分

论坛元老

积分
3108
金钱
3062
HASS币
0
发表于 2023-10-13 19:42:59 | 显示全部楼层
hcfong2020 发表于 2023-10-9 17:36
没有明白你说的?

比如一个开关是三开,加入zigbee2mqtt可以识别,显示支持。 但是只识别到一开。 怎么把两个识别出来。 写这种js,好像调用系统里面的,不是调用js里面的。 像这种情况怎么处理。
回复

使用道具 举报

4

主题

200

回帖

3265

积分

论坛元老

积分
3265
金钱
3061
HASS币
0
发表于 2023-10-9 23:06:43 | 显示全部楼层
hcfong2020 发表于 2023-10-9 08:34
已经修复了。请自行下载。

谢谢!
回复

使用道具 举报

5

主题

82

回帖

669

积分

论坛积极会员

积分
669
金钱
582
HASS币
0
发表于 2023-10-9 20:16:42 | 显示全部楼层
老古董了。。
回复

使用道具 举报

35

主题

285

回帖

1535

积分

金牌会员

积分
1535
金钱
1215
HASS币
0
 楼主| 发表于 2023-10-9 17:36:54 | 显示全部楼层
zuobianfy 发表于 2023-10-9 12:18
显示支持的zigbee的设备,支持的不好, 想修改,有办法吗? 好像直接写js。还是调用之前的。 修改容器里面 ...

没有明白你说的?
回复

使用道具 举报

2

主题

44

回帖

3108

积分

论坛元老

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

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-10-14 03:35 , Processed in 0.089691 second(s), 13 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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