-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Zigbee smart dimmer reported "Received unexpected Tuya DataPoint" #13800
Comments
Same here with the devices from this seller, hoping they are the same? @shanelord01 @madmax1970 https://www.ozsmartthings.com.au/products/zigbee-dimmer-switch-white |
Yes these are the ones I use. |
Shouldn’t we be submitting a whole new device here, I mean the picture is currently a square device and these are rectangular? |
I don’t believe so. They are the same underlying technology/product just in different form factors. |
@shanelord01 i know this isn’t the right place to ask this but I can’t PM you. Do your dimmers always turn on at their brightest and then ramp down to the last remembered level when using the physical button? Surely there must be a setting to turn on to the last remembered level directly? |
Yes mine do that too. Hoping it’s related to the Z2M issues and all of these issues can get looked at by the devs soon. |
Let's first try to fix the brightness part, could you check if the issue is fixed with the following external converter: const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const utils = require('zigbee-herdsman-converters/lib/utils');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const tzLocal = {
tuya_dimmer_level: {
key: ['brightness_min', 'min_brightness', 'max_brightness', 'brightness', 'brightness_percent', 'level'],
convertSet: async (entity, key, value, meta) => {
// upscale to 1000
let newValue;
let dp = tuya.dataPoints.dimmerLevel;
if (['_TZE200_3p5ydos3', '_TZE200_9i9dt8is', '_TZE200_dfxkcots', '_TZE200_w4cryh2i', '_TZE200_1agwnems'].includes(meta.device.manufacturerName)) {
dp = tuya.dataPoints.eardaDimmerLevel;
}
if (key === 'brightness_min') {
if (value >= 0 && value <= 100) {
newValue = utils.mapNumberRange(value, 0, 100, 0, 1000);
dp = tuya.dataPoints.dimmerLevel;
} else {
throw new Error('Dimmer brightness_min is out of range 0..100');
}
} else if (key === 'min_brightness') {
if (value >= 1 && value <= 255) {
newValue = utils.mapNumberRange(value, 1, 255, 0, 1000);
dp = tuya.dataPoints.dimmerMinLevel;
} else {
throw new Error('Dimmer min_brightness is out of range 1..255');
}
} else if (key === 'max_brightness') {
if (value >= 1 && value <= 255) {
newValue = utils.mapNumberRange(value, 1, 255, 0, 1000);
dp = tuya.dataPoints.dimmerMaxLevel;
} else {
throw new Error('Dimmer min_brightness is out of range 1..255');
}
} else if (key === 'level') {
if (value >= 0 && value <= 1000) {
newValue = Math.round(Number(value));
} else {
throw new Error('Dimmer level is out of range 0..1000');
}
} else if (key === 'brightness_percent') {
if (value >= 0 && value <= 100) {
newValue = utils.mapNumberRange(value, 0, 100, 0, 1000);
} else {
throw new Error('Dimmer brightness_percent is out of range 0..100');
}
} else { // brightness
if (value >= 0 && value <= 254) {
newValue = utils.mapNumberRange(value, 0, 254, 0, 1000);
} else {
throw new Error('Dimmer brightness is out of range 0..254');
}
}
// Always use same transid as tuya_dimmer_state (https://github.com/Koenkk/zigbee2mqtt/issues/6366)
await tuya.sendDataPointValue(entity, dp, newValue, 'dataRequest', 1);
},
}
}
const definition = {
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_1agwnems'},
],
model: 'TS0601_dimmer',
vendor: 'TuYa',
description: 'Zigbee smart dimmer',
fromZigbee: [fz.tuya_dimmer, fz.ignore_basic_report],
toZigbee: [tz.tuya_dimmer_state, tzLocal.tuya_dimmer_level],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
},
exposes: [e.light_brightness().withMinBrightness().withMaxBrightness().setAccess(
'state', ea.STATE_SET).setAccess('brightness', ea.STATE_SET).setAccess(
'min_brightness', ea.STATE_SET).setAccess('max_brightness', ea.STATE_SET)],
whiteLabel: [
{vendor: 'Larkkey', model: 'ZSTY-SM-1DMZG-EU'},
{vendor: 'Earda', model: 'EDM-1ZAA-EU'},
{vendor: 'Earda', model: 'EDM-1ZAB-EU'},
{vendor: 'Earda', model: 'EDM-1ZBA-EU'},
{vendor: 'Mercator Ikuü', model: 'SSWD01'},
{vendor: 'Moes', model: 'ZS-USD'},
],
};
module.exports = definition;
external_converters:
- ext_converter.js
|
No luck at the moment:
|
The converter is definitely loaded as I changed description: 'Zigbee smart dimmer', to description: 'Zigbee smart dimmer ext', and it is showing in the device in Z2M. |
I made an error, updated #13800 (comment) |
No luck... brightness won't change anything (in fact it jumps up and down about 3 steps over and over again). On/Off works. Lots of red errors on join and usage though.
|
So it seems this device uses a different data point, to find out you need a TuYa bridge and follow: https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#requirements-and-caveats |
I'm happy to go buy a bridge if nobody else has one... |
I just bought one. Will be here in 2 days. |
Here you go!
|
Thanks, can you try with this external converter? const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const utils = require('zigbee-herdsman-converters/lib/utils');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const tzLocal = {
tuya_dimmer_level: {
key: ['brightness_min', 'min_brightness', 'max_brightness', 'brightness', 'brightness_percent', 'level'],
convertSet: async (entity, key, value, meta) => {
// upscale to 1000
let newValue;
let dp = tuya.dataPoints.dimmerLevel;
if (['_TZE200_3p5ydos3', '_TZE200_9i9dt8is', '_TZE200_dfxkcots', '_TZE200_w4cryh2i', '_TZE200_1agwnems'].includes(meta.device.manufacturerName)) {
dp = tuya.dataPoints.eardaDimmerLevel;
}
if (key === 'brightness_min') {
if (value >= 0 && value <= 100) {
newValue = utils.mapNumberRange(value, 0, 100, 0, 1000);
dp = tuya.dataPoints.dimmerLevel;
} else {
throw new Error('Dimmer brightness_min is out of range 0..100');
}
} else if (key === 'min_brightness') {
if (value >= 1 && value <= 255) {
newValue = utils.mapNumberRange(value, 1, 255, 0, 1000);
dp = tuya.dataPoints.dimmerMinLevel;
} else {
throw new Error('Dimmer min_brightness is out of range 1..255');
}
} else if (key === 'max_brightness') {
if (value >= 1 && value <= 255) {
newValue = utils.mapNumberRange(value, 1, 255, 0, 1000);
dp = tuya.dataPoints.dimmerMaxLevel;
} else {
throw new Error('Dimmer min_brightness is out of range 1..255');
}
} else if (key === 'level') {
if (value >= 0 && value <= 1000) {
newValue = Math.round(Number(value));
} else {
throw new Error('Dimmer level is out of range 0..1000');
}
} else if (key === 'brightness_percent') {
if (value >= 0 && value <= 100) {
newValue = utils.mapNumberRange(value, 0, 100, 0, 1000);
} else {
throw new Error('Dimmer brightness_percent is out of range 0..100');
}
} else { // brightness
if (value >= 0 && value <= 254) {
newValue = utils.mapNumberRange(value, 0, 254, 0, 1000);
} else {
throw new Error('Dimmer brightness is out of range 0..254');
}
}
// Always use same transid as tuya_dimmer_state (https://github.com/Koenkk/zigbee2mqtt/issues/6366)
await tuya.sendDataPointValue(entity, dp, newValue, 'dataRequest', 1);
},
}
}
const fzLocal = {
tuya_dimmer: {
cluster: 'manuSpecificTuya',
type: ['commandDataResponse', 'commandDataReport'],
convert: (model, msg, publish, options, meta) => {
const dpValue = tuya.firstDpValue(msg, meta, 'tuya_dimmer');
const value = tuya.getDataValue(dpValue);
if (dpValue.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 (dpValue.dp === 2) {
if (value < 10) {
tuya.logUnexpectedDataValue('tuya_dimmer', msg, dpValue, meta, 'brightness', 10, 1000);
}
return {brightness: utils.mapNumberRange(value, 10, 1000, 0, 254)};
}
} else if (['_TZE200_3p5ydos3', '_TZE200_9i9dt8is', '_TZE200_dfxkcots', '_TZE200_w4cryh2i', '_TZE200_1agwnems']
.includes(meta.device.manufacturerName)) {
if (dpValue.dp === tuya.dataPoints.eardaDimmerLevel) {
return {brightness: utils.mapNumberRange(value, 0, 1000, 0, 254)};
} else if (dpValue.dp === tuya.dataPoints.dimmerMinLevel) {
return {min_brightness: utils.mapNumberRange(value, 0, 1000, 1, 255)};
} else if (dpValue.dp === tuya.dataPoints.dimmerMaxLevel) {
return {max_brightness: utils.mapNumberRange(value, 0, 1000, 1, 255)};
} else {
tuya.logUnexpectedDataPoint('tuya_dimmer', msg, dpValue, meta);
}
} else {
if (dpValue.dp !== tuya.dataPoints.dimmerLevel) {
tuya.logUnexpectedDataPoint('tuya_dimmer', msg, dpValue, meta);
}
if (dpValue.datatype !== tuya.dataTypes.value) {
tuya.logUnexpectedDataType('tuya_dimmer', msg, dpValue, meta);
} else {
if (value < 10) {
tuya.logUnexpectedDataValue('tuya_dimmer', msg, dpValue, meta, 'brightness', 10, 1000);
}
return {brightness: utils.mapNumberRange(value, 10, 1000, 0, 254), level: value};
}
}
},
}
}
const definition = {
fingerprint: [
{modelID: 'TS0601', manufacturerName: '_TZE200_1agwnems'},
],
model: 'TS0601_dimmer',
vendor: 'TuYa',
description: 'Zigbee smart dimmer',
fromZigbee: [fzLocal.tuya_dimmer, fz.ignore_basic_report],
toZigbee: [tz.tuya_dimmer_state, tzLocal.tuya_dimmer_level],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
},
exposes: [e.light_brightness().withMinBrightness().withMaxBrightness().setAccess(
'state', ea.STATE_SET).setAccess('brightness', ea.STATE_SET).setAccess(
'min_brightness', ea.STATE_SET).setAccess('max_brightness', ea.STATE_SET)],
whiteLabel: [
{vendor: 'Larkkey', model: 'ZSTY-SM-1DMZG-EU'},
{vendor: 'Earda', model: 'EDM-1ZAA-EU'},
{vendor: 'Earda', model: 'EDM-1ZAB-EU'},
{vendor: 'Earda', model: 'EDM-1ZBA-EU'},
{vendor: 'Mercator Ikuü', model: 'SSWD01'},
{vendor: 'Moes', model: 'ZS-USD'},
],
};
module.exports = definition; |
Seems like more green popups than red, but still errors and no dimming.
|
Updated #13800 (comment) |
Lot's less red this time...
and
|
Removed from Z2M and re-joined it. Then tried to change brightness and max min brightness settings:
|
Does the dimming work now? |
Update: Yes it does. Within Z2M: Brightness works fine. Setting min-brightness and max-brightness don't work. Red error overlay popups "unexpected Tuya Datapoint" for 4, 6 and 14. Within HA entity created by Z2M: Jumps to full brightness then moves to brightness requested every time you make a brightness adjustment. |
@shanelord01 can you check if with this converter the brightness and state works correctly? |
No errors on loading now, but I get this error when I try and change state in Z2M (off to on, brightness etc):
|
Made a mistake, updated https://gist.github.com/Koenkk/9c36da807c3768a85aaed9a352c74e96 please try agian. |
Now getting these errors:
|
|
Top from Mosquitto logs, bottom from Z2M logs (which I can't see anything in when I publish the payload).
|
Whoops, instead of |
Hah... OK that works... Now. Changed the brightness to 30 to be more noticeable.
So option 1 is preferable, but the light would not turn on from only setting the brightness level - only from on/off (which I'm OK with but not sure if this is normal). Any way to only send the {"state": "ON"} along with brightness if the light is OFF? Hope this helps. |
|
Yes - goes to 100% then drops to 30%
Goes to 30%. Turns off. [publish on] then goes to 100% then drops to 30% |
Seems like {"state": "ON"} for this switch is ON/100%, then adjust to brightness setting, rather than start at previous brightness level. If this can't be fixed due to a switch limitation, any chance a "Setting (specific)" can be provided for this to not send "{"state": "ON"}" with brightness change? Or is that not possible? |
|
Brilliant! This is all working perfectly. Thankyou! |
Great, I've integrated the changes which will be included in the next z2m release (1 hour from now) Please do a final check if everything works without using an external converter then. |
I have been following this thread, as I have the same problems as @shanelord01 debug 2022-10-02 15:52:27Received Zigbee message from 'Toyroom Light', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,1,202],"type":"Buffer"},"datatype":2,"dp":2}],"seq":4609}' from endpoint 1 with groupID 0 |
I also saw this in the log from @shanelord01 , seems the device is constantly sending the light type for some reason. Not sure why but this looks to be an issue on the device side. |
So excited to test. Thank you both of you.
…On 1 Oct 2022 at 15:18 +0800, Koen Kanters ***@***.***>, wrote:
Great, I've integrated the changes which will be included in the next z2m release (1 hour from now)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Just updated to latest Z2M dev release. Now getting this error: Can't tell if it's related to these switches or something new. |
@shanelord01 did you remove your external converter? It is supported out-of-the box in the latest z2m dev. |
I had removed it and still getting the error. I've just moved to the latest release version 1.28.1 and getting the same error. No external converter in use: "Exception while calling fromZigbee converter: dpEntry[2].from is not a function}" |
@shanelord01 can you provide the debug log of this? See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging. |
Here you go. Sorry for the delay.
|
Fixed! Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) |
Thankyou! No more errors and all seems to be working with preliminary tests. |
Great, I assume this issue can be closed now. |
Any chance this can be released? |
@benflux it will be included in the next release on 1 December. |
Link
https://smartguys.com.au/makegood-zigbee-dimmer-smart-light-switch.html
Database entry
0x588e81fffed0d59d (0xA21F)
Comments
Zigbee Model : TS0601
Zigbee Manufacturer : _TZE200_1agwnems
On/Off - working
Dimmer - not working
brightness - reverts back to 0
min_brightness - reverts back to 0
max_brightness - reverts back to 0
Any help on how to fix this please.
State
{
"brightness": -3,
"level": 0,
"linkquality": 255,
"state": "ON"
}
Warning (plenty of this)
Zigbee2MQTT:warn 2022-09-01 20:32:00: zigbee-herdsman-converters:tuya_dimmer: Received unexpected Tuya DataPoint #14 from 0x588e81fffed0d59d with raw data '{"dp":14,"datatype":4,"data":{"type":"Buffer","data":[0]}}': type='commandDataResponse', datatype='enum', value='0', known DP# usage: ["runningState","moesSbattery","wooxBattery","haozeeFaultAlarm","nousTempAlarm","moesSwitchPowerOnBehavior","alectoBatteryState"]
Zigbee2MQTT:warn 2022-09-01 20:32:00: zigbee-herdsman-converters:tuya_dimmer: Received Tuya DataPoint #14 with unexpected datatype from 0x588e81fffed0d59d with raw data '{"dp":14,"datatype":4,"data":{"type":"Buffer","data":[0]}}': type='commandDataResponse', datatype='enum' (instead of 'undefined'), value='0', known DP# usage: ["runningState","moesSbattery","wooxBattery","haozeeFaultAlarm","nousTempAlarm","moesSwitchPowerOnBehavior","alectoBatteryState"]
External converter
No response
Supported color modes
No response
Color temperature range
No response
The text was updated successfully, but these errors were encountered: