-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix support for SSWD01 device #3004
Conversation
Added data points for SSWD01
Some questions.
|
|
devices/tuya.js
Outdated
model: 'SSWD01', | ||
vendor: 'Mercator ikuü', | ||
description: 'Zigbee smart dimmer', | ||
fromZigbee: [fz.ikuu_dimmer, fz.ignore_basic_report], |
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'm wondering if a new definition is really needed, the only difference is fz. ikuu_dimmer
vs fz.tuya_dimmer
, I think it is better to just fix the fz.tuya_dimmer
(add the datapoint for the brightness)
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 simply don't know how the other Tuya dimmer devices work, if they all have the same data points or not. I don't know if the others devices have those count down timers and minimum brightness settings that I have yet to figure out.
If they are all the same, then yeah that makes more sense. I didn't want to take the risk of breaking other people's stuff, but we can do that if it's best.
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.
Can you try just changing:
tuya_dimmer: {
cluster: 'manuSpecificTuya',
type: ['commandGetData', 'commandSetDataResponse'],
convert: (model, msg, publish, options, meta) => {
const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
if (msg.data.dp === tuya.dataPoints.state) {
return {state: value ? 'ON': 'OFF'};
} else if (meta.device.manufacturerName === '_TZE200_swaamsoy' && msg.data.dp === 3) {
return {brightness: mapNumberRange(value, 10, 1000, 0, 254), level: value};
} else { // TODO: Unknown dp, assumed value type
return {brightness: mapNumberRange(value, 10, 1000, 0, 254), level: value};
}
},
},
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.
Maybe I didn't explain the issue too well.
Data point 2 is the actual dimmer brightness level.
Data point 3 is a minimum brightness level that is set. This is because the dimming switch has no neutral wire, going lower than the minimum setting in brightness results in the load LED turning off (this value can differ depending on the LED connected to the switch and that LED minimum wattage). I don't know if the other Tuya dimmers have this "minimum brightness" as they likely are not "non-neutral" versions?
So when we see data point 2, we get brightness ok. But when we see data point 3, that else
assumes it's brightness and sets incorrect values. So that proposed change will result in the same issue if I am not mistaken?
Would need a couple more ifs there to say:
if ikuu and dp is 2 then set brightness
elif ikuu and dp is 3 then set min-brightness
elif ikuu and dp is 6 set timer
else assume brightness
Want me to do that? But seems super hacky.
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.
You are right, what about:
tuya_dimmer: {
cluster: 'manuSpecificTuya',
type: ['commandGetData', 'commandSetDataResponse'],
convert: (model, msg, publish, options, meta) => {
const value = tuya.getDataValue(msg.data.datatype, msg.data.data);
if (msg.data.dp === tuya.dataPoints.state) {
return {state: value ? 'ON': 'OFF'};
} else {
if (meta.device.manufacturerName === '_TZE200_swaamsoy') {
// https://github.com/Koenkk/zigbee-herdsman-converters/pull/3004
if (msg.data.dp === 3) {
return {brightness: mapNumberRange(value, 10, 1000, 0, 254), level: value};
}
} else { // TODO: Unknown dp, assumed value type
return {brightness: mapNumberRange(value, 10, 1000, 0, 254), level: value};
}
}
},
},
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.
Ok, I have made that change with a minor adjustment. Does work in my testing.
Those other data points (3 and 6) I can't figure out yet, I will get to them when ever I can.
Thanks! |
I would like to preface this by stating that I have almost no clue what I am doing, I don't normally code and/or use git (I did most of this in vi and bash but it all seems to work). I essentially Benny Hill'd my way through everything here, so please double check.
I am attempting to fix this issue here:
Koenkk/zigbee2mqtt#8556
The issue appears that the original lumping in of the device with a bunch of other tuya dimmers was causing issues with the unique data points this device uses. The set zigbee is fine but not the read. This device also has two new data points (minimum brightness and countdown off timers) that I have no idea how to code for but could identify. I plan to learn this over time and make the change. At this time I just want to get the devices working correctly.
I plan to submit a jpeg for this device too in the documentation.
Any feedback would be appreciated, I am a network security person in way over my head here...