-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Conversation
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
Changed
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.
src/devices/tuya.ts
Outdated
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']). |
There was a problem hiding this comment.
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:
zigbee-herdsman-converters/src/lib/tuya.ts
Line 224 in 3440313
const tuyaExposes = { |
src/devices/tuya.ts
Outdated
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']) |
There was a problem hiding this comment.
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
)
src/devices/tuya.ts
Outdated
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'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/devices/tuya.ts
Outdated
[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)})], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
src/devices/tuya.ts
Outdated
[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)})], |
There was a problem hiding this comment.
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 (
zigbee-herdsman-converters/src/lib/tuya.ts
Line 374 in 3440313
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}`), |
There was a problem hiding this comment.
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.
Note to self: after this merge Koenkk/zigbee2mqtt.io#2131 |
Thanks! |
where 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 |
其实很多设备都可以增加显示黄光还是白光,我用的是这个 |
链接失效了 |
你买的这些是不是需要额外写点脚本呢,还是直接zigbee2mqtt或者zha识别后就直接支持的? 如果需要额外写脚本的话有没有个什么教程哈? |
我买的当时zigbee2mqtt支持不完善,自己补了一部份内容上去并commit了。方便的话可以加个wx |
怎么加, 这也没私信功能啊 😢 |
wxid_gfghdnlfhh9k11 |
搜不到呀,你加我吧 https://pastebin.com/pVyGJ63P |
``` ...[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',