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

Adding inching switch feature to Tuya devices #7898

Merged
merged 3 commits into from
Sep 2, 2024
Merged

Conversation

guidugli
Copy link
Contributor

Tuya multi-gang switches may have extra features like inching switch, which turns off the switch after the specified amount of time. Tuya switches are supposed to be from 1 to 6 gangs.

This pull request implements inching switch and adds the feature to TS0002_zemismart device (the device also supports countdown, so it was added to it, since the feature was added recently).

REFERENCE:
https://developer.tuya.com/en/docs/connect-subdevices-to-gateways/tuya-zigbee-multiple-switch-access-standard?id=K9ik6zvnqr09m
https://developer.tuya.com/en/docs/connect-subdevices-to-gateways/tuya-zigbee-measuring-smart-plug-access-standard?id=K9ik6zvofpzqk#title-8-TUYA_COMMON_PRIVATE%20cluster
https://developer.tuya.com/en/docs/iot-device-dev/Jog-switch-Wi-Fi?id=Kaung27s713rc

vendor: 'Tuya',
description: '2-Gang switch with backlight, countdown and inching',
extend: [
tuya.modernExtend.tuyaOnOff({powerOnBehavior2: true, backlightModeOffOn: true, onOffCountdown: true, endpoints: ['l1', 'l2']}),
Copy link
Owner

Choose a reason for hiding this comment

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

Since it's tightly coupled the on/off, could you add it as an option of the tuyaOnOff modern extend?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, will do it.

@@ -8441,6 +8441,27 @@ const definitions: Definition[] = [
tuya.whitelabel('RoomsAI', 'RoomsAI_37022454', '1 Gang switch with backlight', ['_TZ3000_w1tcofu8']),
],
},
{
fingerprint: [{modelID: 'TS0002', manufacturerName: '_TZ3000_ywubfuvt'}],
Copy link
Owner

Choose a reason for hiding this comment

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

I would say, let's not at a different definition but add it to the standard TS0002, worst case it only works for some

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any suggestion on how to unify entries for models TS0002_switch_module_3, TS0002_switch_module_1, TS0002, TS0002_switch_module, TS0002_switch_module_2, TS0002_switch_2_gang, TS0002_switch_module_4? I believe all these models could converge on few entries as TS0002 (all features), TS0002_basic (on/off), TS0002_limited (switch type, indicatormode, backlightmodeoffon)
Reasoning: any non-mapped device TS0002 would inherit all features. Some features do not impact the device like, on my device, although it does not have an indicator led, indicatormode has no effect (it does not break it).
I have a 4 and 6 gang device that do not implement the more advanced features, so similar 2 gang devices could use TS0002_limited. If the device is so basic that does not even have features like poweronbehavior, then they can use the TS0002_basic.

  on/off poweronbehavior2 indicatormode backlightmodeoffon onOffCountdown SwitchType
TS0002 X          
TS0002_switch_2_gang X X   X    
TS0002_switch_module X         X
TS0002_switch_module_1 X   X X    
TS0002_switch_module_2 X   X     X
TS0002_switch_module_4 X X X X    
TS0002_switch_module_3 X X X      

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds good!

@Koenkk Koenkk merged commit a26bb89 into Koenkk:master Sep 2, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Sep 2, 2024

Thanks!

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.

2 participants