Skip to content

Commit 36ebfdb

Browse files
author
Hayden Dunnicliffe
committed
Build for tuya smart knob
1 parent aaabaa8 commit 36ebfdb

11 files changed

Lines changed: 40607 additions & 391 deletions

File tree

bin/end_device/REMOTE_TUYA_SMART_KNOB_END_DEVICE/tlc_switch-1.1.2-aaabaa8f.s37

Lines changed: 18494 additions & 0 deletions
Large diffs are not rendered by default.

bin/router/REMOTE_TUYA_SMART_KNOB/tlc_switch-1.1.2-aaabaa8f.s37

Lines changed: 19600 additions & 0 deletions
Large diffs are not rendered by default.

docs/supported_devices.md

Lines changed: 14 additions & 4 deletions
Large diffs are not rendered by default.

homed/tuya-custom.json

Lines changed: 2414 additions & 372 deletions
Large diffs are not rendered by default.

make_scripts/make_debug_single.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
set -e # Exit on error.
1818
cd "$(dirname "$(dirname "$(realpath "$0")")")" # Go to project root.
1919

20-
DEVICE=MODULE_IHSENO_TS0004 # Change this to your device
20+
DEVICE=REMOTE_TUYA_SMART_KNOB # Change this to your device
2121

2222
# Check if device exists in database
2323
if ! yq -e ".${DEVICE}" device_db.yaml >/dev/null 2>&1; then
@@ -42,17 +42,17 @@ echo "Checking if files were created for board: $DEVICE ($TYPE)"
4242
ls -l bin/$TYPE/$DEVICE/ 2>/dev/null || echo "No router files found"
4343

4444
# Build end_device version with debug enabled
45-
# echo "=== Building end_device version with debug ==="
46-
# TYPE=end_device
47-
# BOARD=$DEVICE DEVICE_TYPE=$TYPE DEBUG=1 make board/build-firmware
48-
# echo "Checking if files were created for board: $DEVICE ($TYPE)"
49-
# ls -l bin/$TYPE/${DEVICE}_END_DEVICE/ 2>/dev/null || echo "No end_device files found"
50-
51-
# echo "=== Updating integration files ==="
52-
# make tools/update_converters
53-
# make tools/update_zha_quirk
54-
# make tools/update_homed_extension
55-
# make tools/update_supported_devices
45+
echo "=== Building end_device version with debug ==="
46+
TYPE=end_device
47+
BOARD=$DEVICE DEVICE_TYPE=$TYPE DEBUG=1 make board/build-firmware
48+
echo "Checking if files were created for board: $DEVICE ($TYPE)"
49+
ls -l bin/$TYPE/${DEVICE}_END_DEVICE/ 2>/dev/null || echo "No end_device files found"
50+
51+
echo "=== Updating integration files ==="
52+
make tools/update_converters
53+
make tools/update_zha_quirk
54+
make tools/update_homed_extension
55+
make tools/update_supported_devices
5656

5757
echo "=== Build complete ==="
5858
echo "Debug firmware built for $DEVICE"

src/silabs/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "base_components/led.h"
2020
#include "base_components/network_indicator.h"
2121
#include "base_components/relay.h"
22+
#include "base_components/encoder.h"
2223
#include "device_config/config_nv.h"
2324
#include "device_config/config_parser.h"
2425
#include "hal/gpio.h"
@@ -29,6 +30,8 @@
2930
#include "zigbee/general_commands.h"
3031
#include "zigbee/relay_cluster.h"
3132
#include "zigbee/switch_cluster.h"
33+
#include "zigbee/step_command_handler.h"
34+
#include "zigbee/encoder_cluster.h"
3235

3336
// TODO: make configurable via ZCL
3437
#define POLLING_INTERVAL_MS 100

src/silabs/slcp_files/zigbee.slcp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ source:
3333
- {path: ../../base_components/led.c}
3434
- {path: ../../base_components/network_indicator.c}
3535
- {path: ../../base_components/relay.c}
36+
- {path: ../../base_components/encoder.c}
3637
- {path: ../../base_components/battery.h}
3738
- {path: ../../base_components/button.h}
3839
- {path: ../../base_components/led.h}
3940
- {path: ../../base_components/network_indicator.h}
4041
- {path: ../../base_components/relay.h}
42+
- {path: ../../base_components/encoder.h}
4143
- {path: ../../device_config/config_nv.c}
4244
- {path: ../../device_config/config_nv.h}
4345
- {path: ../../device_config/config_parser.c}
@@ -56,6 +58,8 @@ source:
5658
- {path: ../../zigbee/switch_cluster.c}
5759
- {path: ../../zigbee/cover_switch_cluster.c}
5860
- {path: ../../zigbee/cover_cluster.c}
61+
- {path: ../../zigbee/encoder_cluster.c}
62+
- {path: ../../zigbee/step_command_handler.c}
5963
- {path: ../../zigbee/battery_cluster.h}
6064
- {path: ../../zigbee/basic_cluster.h}
6165
- {path: ../../zigbee/cluster_common.h}
@@ -68,6 +72,8 @@ source:
6872
- {path: ../../zigbee/zigbee_commands.h}
6973
- {path: ../../zigbee/general_commands.h}
7074
- {path: ../../zigbee/group_cluster.h}
75+
- {path: ../../zigbee/encoder_cluster.h}
76+
- {path: ../../zigbee/step_command_handler.h}
7177
include:
7278
- {path: ../../.}
7379
sdk: {id: gecko_sdk, version: 4.4.6}

src/silabs/slcp_files/zigbee_end_device.slcp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ source:
3333
- {path: ../../base_components/led.c}
3434
- {path: ../../base_components/network_indicator.c}
3535
- {path: ../../base_components/relay.c}
36+
- {path: ../../base_components/encoder.c}
3637
- {path: ../../base_components/battery.h}
3738
- {path: ../../base_components/button.h}
3839
- {path: ../../base_components/led.h}
3940
- {path: ../../base_components/network_indicator.h}
4041
- {path: ../../base_components/relay.h}
42+
- {path: ../../base_components/encoder.h}
4143
- {path: ../../device_config/config_nv.c}
4244
- {path: ../../device_config/config_nv.h}
4345
- {path: ../../device_config/config_parser.c}
@@ -56,6 +58,8 @@ source:
5658
- {path: ../../zigbee/switch_cluster.c}
5759
- {path: ../../zigbee/cover_switch_cluster.c}
5860
- {path: ../../zigbee/cover_cluster.c}
61+
- {path: ../../zigbee/encoder_cluster.c}
62+
- {path: ../../zigbee/step_command_handler.c}
5963
- {path: ../../zigbee/battery_cluster.h}
6064
- {path: ../../zigbee/basic_cluster.h}
6165
- {path: ../../zigbee/cluster_common.h}
@@ -68,6 +72,8 @@ source:
6872
- {path: ../../zigbee/zigbee_commands.h}
6973
- {path: ../../zigbee/general_commands.h}
7074
- {path: ../../zigbee/group_cluster.h}
75+
- {path: ../../zigbee/encoder_cluster.h}
76+
- {path: ../../zigbee/step_command_handler.h}
7177
include:
7278
- {path: ../../.}
7379
sdk: {id: gecko_sdk, version: 4.4.6}

zha/switch_quirk.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class AttributeDefs(WindowCovering.AttributeDefs):
389389
"30jqysvd;NovatoZNR01;BB7u;LB1;SC2u;RB5;",
390390
"c4muk4ys;TS0012-QS;BB4u;LC2;SD2u;RA0B6;SC3u;RC0D7;SLP;",
391391
"ol1uhvza;TS130F-NOV;BC3u;LC4;XC2B4f;CB5D2;",
392+
"aksyshpw;TS0003-C;BB1u;LD7;SC2u;RC0;SC3u;RB4;SD2u;RB5;",
392393
"tqlv4ug4;TS0001-custom;BD2u;LC0;SB4u;RC2;",
393394
"Tuya-TS0001-custom;TS0001-custom;BD2u;LC0;SB4u;RC2;",
394395
"bvrlqyj7;TS0002-OXT-CUS;BD2u;LC0;SB4u;RC2;SB5u;RC3;",
@@ -402,24 +403,31 @@ class AttributeDefs(WindowCovering.AttributeDefs):
402403
"TS0004-Avv;TS0004-Avv;BB5u;LC1;SB4u;RC0;SD2u;RC4;SC3u;RD4;SC2u;RD7;",
403404
"ruxexjfz;TS0002-NS1;BD2u;LD3i;SA0u;SD7u;RB5;RB4;",
404405
"Zbeacon2;TS0002-ZB;BD2u;LD3i;SB4u;RA0;SB5u;RD7;",
406+
"zifx0xoj;TS011F-BD-PM;LC3i;SB7u;RC2;M;",
407+
"zifx0xoj;TS011F-BORUIDAPLS-PM;LC3i;SB7u;RC2;M;",
405408
"b28wrpvx;TS011F-BS-PM;LC3;SB5u;RD2;IB4;M;",
406409
"ko6v90pg;TS011F-BS-PM-1;LC4i;SB4u;RB5;IB1i;M;",
410+
"4ux0ondb;TS011F-BS-PM-2;LB4;SB5u;RD2;IC3;M;",
407411
"o1jzcxou;TS011F-BS;LC2;SB4u;RC3;ID2;M;",
408412
"gvn91tmx;TS011F-AB-PM;SC4u;RB5;ID2i;M;",
413+
"LELLKI;TS0001-LK;SB7u;RC2;IC3i;M;",
409414
"bgtzm4ny;TS0044-HOB;SC4u;IC3i;SD3u;ID4i;SB5u;IB6i;SD7u;IA0i;BTC5;M;",
415+
"ZG-101ZL;TS0001-HB;IC4i;SC2u;BTB5;M;",
410416
"mh9px7cq;TS0044-CUS;LC0;SD2u;SC2u;SC3u;SB4u;BTD2;M;",
411417
"rco1yzb1;TS004F-LIDL;BA0u;SB0u;ID0;BTC1;M;",
412418
"5e235jpa;TS0042-MA;SA0u;ID0i;SA4u;IC1i;BTA0;M;",
413419
"gbm10jnj;TS0043-MA;SA0u;ID0i;SA4u;IC1i;SA3u;IC0i;BTA0;M;",
414420
"a4xycprs;TS0044-MA;SA0u;ID0i;SA4u;IC1i;SA3u;IC0i;SB0u;ID1i;BTA0;M;",
415421
"zgyzgdua;TS0044-MOES;SD2d;IC4i;SC3d;IA0i;SC2d;ID7i;SB4d;ID4i;BTC5;M;",
416422
"mrpevh8p;TS0041-TB;BB4d;SB5u;ID2;BTB5;M;",
423+
"yj6k7vfo;TS0041-TB2;SC3u;IB4;BTB5;M;",
417424
"itb0omhv;TS0041-MOES;SC2u;IC4;BTC2;M;",
418425
"tzvbimpq;TS0042-MOES;SD2u;ID4;SC3u;ID7;BTD2;M;",
419426
"pkeqinnt;TS0043-MOES;SD2u;ID4;SC2u;IC4;SC3u;ID7;BTD4;M;",
427+
"sj7jbgks;TS0043-MB;SD2u;ID4;SC2u;IC4;SC3u;ID7;BTD4;M;",
420428
"wkai4ga5;TS0044-TUYA;SA0d;IC1i;SA3d;IC2i;SA4d;IC0i;SB0d;ID0i;BTA0;M;",
421429
"TELINK;TLSR82xx-2G;SC0u;IB4;SD7u;IB4;BTB5;M;",
422-
"ja5osu5g;TS004F-Loginovo;IC4i;SC2u;BTB5;M;",
430+
"ja5osu5g;TS004F-Loginovo;BB6u;SC2u;IC4i;BTB5;M;",
423431
"xabckq1v;TS004F-TUYA;SA0d;IC1i;SA3d;IC2i;SA4d;IC0i;SB0d;ID0i;BTA0;M;",
424432
"w1tcofu8;TS0001-AVT;LB5;SD7u;RC3;M;",
425433
"ogpla3lh;TS0002-AVT;LB5;SD3u;RC2;SD4u;RD2;M;",
@@ -503,12 +511,15 @@ class AttributeDefs(WindowCovering.AttributeDefs):
503511
"lsunm46z;TS0003-PS;LC2;SA3u;RA4;IC0;SA6u;RB0;IA0;SB1u;RD1;IC1;M;",
504512
"u6ocpapf;TS0001-CUS;LB1;SC3u;RD2;M;",
505513
"gbdxbmwz;TS0004-CUS;LB1;SC3u;RD2;SD7u;RB5;SC2u;RB4;SB7u;RC0;M;",
514+
"ehgouyvu;TS0001-LS;SC2u;RC3;IB1;",
506515
"zmlunnhy;Zemi-2-gang;SC3u;RC2D4;IB7;SD2u;RB5C4;ID7;M;",
507516
"zmlunnhy;Zemi-2-gang-ED;SC3u;RC2D4;IB7;SD2u;RB5C4;ID7;M;",
508517
"Zemi-2-gang;Zemi-2-gang;SC3u;RC2D4;IB7;SD2u;RB5C4;ID7;M;",
509518
"Zemi-2-gang;Zemi-2-gang-ED;SC3u;RC2D4;IB7;SD2u;RB5C4;ID7;M;",
510519
"ilauzyjm;TS0011-ZS;SB0u;RD1A4;IA6;M;",
511520
"rbl8c85w;TS0012-ZS;SA0u;RD1A4;IC1;SB1u;RC0C2;IA5;M;",
521+
"Zabby;E1;BC3u;LC2i;RD2;EB4uD7uD4u;",
522+
"qja6nq5z;TS004F;LD0i;EB0uA0uA4u;",
512523
]
513524

514525
for config in CONFIGS:

zigbee2mqtt/converters/switch_custom.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13278,8 +13278,8 @@ const definitions = [
1327813278
"E1",
1327913279
],
1328013280
model: "E1",
13281-
vendor: "Zabby",
13282-
description: "Main powered Encoder for Light Control",
13281+
vendor: "Tuya-custom",
13282+
description: "Custom switch (https://github.com/romasku/tuya-zigbee-switch)",
1328313283
extend: [
1328413284
deviceEndpoints({ endpoints: {"relay": 1, "encoder_0": 2, } }),
1328513285
romasku.deviceConfig("device_config", "relay"),
@@ -13299,6 +13299,28 @@ const definitions = [
1329913299

1330013300

1330113301

13302+
},
13303+
ota: true,
13304+
},
13305+
{
13306+
zigbeeModel: [
13307+
"TS004F",
13308+
],
13309+
model: "WXKG02LM_rev2",
13310+
vendor: "Tuya-custom",
13311+
description: "Custom switch (https://github.com/romasku/tuya-zigbee-switch)",
13312+
extend: [
13313+
deviceEndpoints({ endpoints: {"encoder_0": 1, } }),
13314+
romasku.deviceConfig("device_config", ""),
13315+
romasku.multiPressResetCount("multi_press_reset_count", ""),
13316+
romasku.networkIndicator("network_led", ""),
13317+
romasku.encoderAction("encoder_0"),
13318+
],
13319+
meta: { multiEndpoint: true },
13320+
configure: async (device, coordinatorEndpoint, logger) => {
13321+
13322+
13323+
1330213324
},
1330313325
ota: true,
1330413326
},

0 commit comments

Comments
 (0)