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

TS0601 4 gang #2137

Merged
merged 3 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -3298,7 +3298,7 @@ const converters = {
const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
const state = value ? 'ON' : 'OFF';
if (multiEndpoint) {
const lookup = {1: 'l1', 2: 'l2', 3: 'l3'};
const lookup = {1: 'l1', 2: 'l2', 3: 'l3', 4: 'l4'};
const endpoint = lookup[dp];
if (endpoint in model.endpoint(msg.device)) {
return {[`state_${endpoint}`]: state};
Expand Down
18 changes: 17 additions & 1 deletion devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,6 @@ const devices = [
{modelID: 'TS0601', manufacturerName: '_TZE200_wunufsil'},
{modelID: 'TS0601', manufacturerName: '_TZE200_vhy3iakz'},
{modelID: 'TS0601', manufacturerName: '_TZE200_oisqyl4o'},
{modelID: 'TS0601', manufacturerName: '_TZE200_aqnazj70'}, // 4 gang
],
model: 'TS0601_switch',
vendor: 'TuYa',
Expand All @@ -1258,6 +1257,23 @@ const devices = [
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_aqnazj70'}],
model: 'TS0601_switch_4_gang',
vendor: 'TuYa',
description: '4 gang switch',
exposes: [e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l3').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l4').setAccess('state', ea.STATE_SET)],
fromZigbee: [fz.ignore_basic_report, fz.tuya_switch_2],
toZigbee: [tz.tuya_switch_state],
meta: {multiEndpoint: true},
endpoint: (device) => {
// Endpoint selection is made in tuya_switch_state
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
},
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_nkjintbl'}],
model: 'TS0601_switch_2_gang',
Expand Down