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

BHT-002-GCLZB sensor set and get uses different values ... #1905

Closed
PeterVoronov opened this issue Dec 14, 2020 · 2 comments · Fixed by #1912
Closed

BHT-002-GCLZB sensor set and get uses different values ... #1905

PeterVoronov opened this issue Dec 14, 2020 · 2 comments · Fixed by #1912

Comments

@PeterVoronov
Copy link
Contributor

Hello, colleagues.

Looking in the code, i see, the FromZigbee the sensor values is returned as a string:

    case common.TuyaDataPoints.moesSensor:
        switch (value) {
        case 0:
            return {sensor: 'IN'};
        case 1:
            return {sensor: 'AL'};
        case 2:
            return {sensor: 'OU'};
        default:
            return {sensor: 'Not supported'};
        }

But in ToZigbee it uses a numerik values:

    // send an mqtt message to topic '/sensor' to change the temperature sensor setting - options [0=IN|1=AL|2=OU]
    moes_thermostat_sensor: {
        key: ['sensor'],
        convertSet: async (entity, key, value, meta) => {
            await sendTuyaDataPointEnum(entity, common.TuyaDataPoints.moesSensor, value);
        },
    },

what is version is right?
I'm ready to prepare a PR, but what it better ?
By my understanding - it have to be identical type of values for in and out

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2020

String is preferred here, but to avoid a breaking change allow both numbers and strings in the toZigbee converter.

@PeterVoronov
Copy link
Contributor Author

Done at PR

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 a pull request may close this issue.

2 participants