Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for M9-zigbee-SL #5965

Merged
merged 35 commits into from
Jul 17, 2023
Merged

Adds support for M9-zigbee-SL #5965

merged 35 commits into from
Jul 17, 2023

Conversation

Qianli-Ma
Copy link
Contributor

``` ...[1, 2, 3, 4, 5, 6,].map((no) => power_on_behavior_l${no}),
...[1, 2, 3, 4, 5, 6,].map((no) => `mode_l${no}`),
'light_mode',

Are required for individual switch controls.

Qianli-Ma and others added 28 commits June 19, 2023 01:41
Added Terncy CL001 support
Fixed linting issues
added support for tuya G3 smart 4 gang switch with 2 scene controller
Changed model name
fix typo
Adds support for tuya 4gang + 2 scene switch with backlight.
Power on behavior is still WIP.
master_switch requires Koenkk/zigbee2mqtt#18157 to work
fixed linting errors
Moved _TZE200_wunufsil to an individual device with switch countdown timer, power on behavior, backlight control, and master switch functions.
Changed model name to reflect 2 gang control
_TZE200_0j5jma9b :
  fixed description
  fixed master switch
_TZE200_wunufsil:
  removed extra endpoints
Added TS0601_3gang switch with backlight
Fixed duplicate _TZE200_vhy3iakz (new code supports countdown, backlight mode, and main switch)  and changed some formatting
fix duplicates and format
Changed _TZE200_k6jhsr0q to support additional features
Update device names per request
Updated model names
Fixed power on behavior
Fixed backlightModeOffOn get
 Add individual mode/power on behavior switch for tuya devices
Adds support for M9-zigbee-SL
'light_mode' is needed to control individual indicator lights.
new exposes.Enum('mode_l6', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l6 to act as a switch or as a scene'),
new exposes.Enum('mode_l7', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l6 to act as a switch or as a scene'),
new exposes.Enum('mode_l8', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l6 to act as a switch or as a scene'),
new exposes.Enum('light_mode_l1', ea.STATE_SET, ['normal', 'on', 'off', 'flash']).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of duplication here, can you add them here:

const tuyaExposes = {

tuya.exposes.switch().withEndpoint('l5'),
tuya.exposes.switch().withEndpoint('l6'),
tuya.exposes.backlightModeOffOn().withAccess(ea.STATE_SET),
new exposes.Enum('power_on_behavior_l1', ea.STATE_SET, ['off', 'on', 'memory'])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use e.power_on_behavior().withAccess(ea.STATE_SET) for all (memory will become previous)

tuya.exposes.switch().withEndpoint('l8'),
new exposes.Enum('mode_l1', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l1 to act as a switch or as a scene'),
new exposes.Enum('mode_l2', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l2 to act as a switch or as a scene'),
new exposes.Enum('mode_l3', ea.STATE_SET, ['switch', 'scene']).withDescription('Sets the mode of l3 to act as a switch or as a scene'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[5, 'state_l5', tuya.valueConverter.onOff],
[6, 'state_l6', tuya.valueConverter.onOff],
[16, 'backlight_mode', tuya.valueConverter.onOff],
[29, 'power_on_behavior_l1', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'memory': tuya.enum(2)})],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use tuya.valueConverter.powerOnBehavior here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using tuya.valueConverter.powerOnBehavior results in the following error

Zigbee2MQTT:error 2023-07-14 10:08:38: Publish 'set' 'power_on_behavior' to '0xe0798dfffe66bfb1' failed: 'TypeError: Cannot read properties of undefined (reading 'to')'
Zigbee2MQTT:debug 2023-07-14 10:08:38: TypeError: Cannot read properties of undefined (reading 'to')
    at Object.convertSet (E:\zigbee2mqtt\zigbee2mqtt\node_modules\zigbee-herdsman-converters\src\lib\tuya.js:1447:54)
    at Publish.onMQTTMessage (E:\zigbee2mqtt\zigbee2mqtt\lib\extension\publish.ts:247:52)
    at EventEmitter.emit (node:events:525:35)
    at EventBus.emitMQTTMessage (E:\zigbee2mqtt\zigbee2mqtt\lib\eventBus.ts:109:22)
    at MQTT.onMessage (E:\zigbee2mqtt\zigbee2mqtt\lib\mqtt.ts:140:27)
    at WebSocket.<anonymous> (E:\zigbee2mqtt\zigbee2mqtt\lib\extension\frontend.ts:126:27)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (E:\zigbee2mqtt\zigbee2mqtt\node_modules\ws\lib\websocket.js:1184:20)      
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (E:\zigbee2mqtt\zigbee2mqtt\node_modules\ws\lib\receiver.js:541:14)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The four previous devices I've added also used
[29, 'power_on_behavior_l1', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'on': tuya.enum(1), 'memory': tuya.enum(2)})],
Should I create a new converter in tuya.valueConverter for this kind of power_on_behavior

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but please use previous instead of memory (since most other devices also use previous)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

[111, 'action', tuya.valueConverter.static('scene_8')],
[112, 'state_l7', tuya.valueConverter.onOff],
[113, 'state_l8', tuya.valueConverter.onOff],
[114, 'mode_l1', tuya.valueConverterBasic.lookup({'switch': tuya.enum(0), 'scene': tuya.enum(1)})],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both mode and light_mode add a new valueConverter (

export const valueConverter = {
)

src/lib/tuya.ts Outdated
@@ -788,6 +788,9 @@ const tuyaTz = {
'motor_speed', 'timer', 'reset_frost_lock', 'schedule_periodic', 'schedule_weekday', 'backlight_mode', 'calibration', 'motor_steering',
'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program',
...[1, 2, 3, 4, 5, 6].map((no) => `schedule_slot_${no}`), 'minimum_range', 'maximum_range', 'detection_delay', 'fading_time',
...[1, 2, 3, 4, 5, 6].map((no) => `power_on_behavior_l${no}`),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect this is needed (because multiEndpoint: true is set for this device), so adding just mode and light_mode here should be enough.

@Koenkk
Copy link
Owner

Koenkk commented Jul 13, 2023

Note to self: after this merge Koenkk/zigbee2mqtt.io#2131

@Koenkk Koenkk merged commit fc33990 into Koenkk:master Jul 17, 2023
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Jul 17, 2023

Thanks!

@latel
Copy link

latel commented Sep 5, 2023

where can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

@Qianli-Ma
Copy link
Contributor Author

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

@latel
Copy link

latel commented Sep 9, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。
买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。
我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

@Qianli-Ma
Copy link
Contributor Author

Qianli-Ma commented Sep 10, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个
【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」
点击链接直接打开 或者 淘宝搜索直接打开

@latel
Copy link

latel commented Oct 25, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

链接失效了

@latel
Copy link

latel commented Nov 1, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈?

@Qianli-Ma
Copy link
Contributor Author

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈?

我买的当时zigbee2mqtt支持不完善,自己补了一部份内容上去并commit了。方便的话可以加个wx

@latel
Copy link

latel commented Nov 10, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈?

我买的当时zigbee2mqtt支持不完善,自己补了一部份内容上去并commit了。方便的话可以加个wx

怎么加, 这也没私信功能啊 😢

@Qianli-Ma
Copy link
Contributor Author

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈?

我买的当时zigbee2mqtt支持不完善,自己补了一部份内容上去并commit了。方便的话可以加个wx

怎么加, 这也没私信功能啊 😢

wxid_gfghdnlfhh9k11

@latel
Copy link

latel commented Nov 13, 2023

why can I buy device based on M9-zigbee-SL, I searched google but found nothing 😢

Could be found on alibaba, not sure if it's readily exported

咱说中文就可以了吧 :), 我1688上没找到呀,商家不会写这些参数,问了基本都是销售而已不知道。 买几个回来试了下,z2m里显示是TS0726MS-104BZ,没法单独控制灯光颜色。 我需要可以自己设置显示黄光还是白光,目前看就M9-zigbee-SL这个型号支持。

其实很多设备都可以增加显示黄光还是白光,我用的是这个 【淘宝】https://m.tb.cn/h.5f3spDl?tk=bZAWdBOxolS CZ3457 「涂鸦ZigBee3.0智能PC塑料八键开关语音远程手机场景联动灯光控制」 点击链接直接打开 或者 淘宝搜索直接打开

你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈?

我买的当时zigbee2mqtt支持不完善,自己补了一部份内容上去并commit了。方便的话可以加个wx

怎么加, 这也没私信功能啊 😢

wxid_gfghdnlfhh9k11

搜不到呀,你加我吧 https://pastebin.com/pVyGJ63P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants