Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.17k stars 1.68k forks source link

Support for "Parkside Smart Watering Timer" #7695

Closed DerElch87 closed 1 year ago

DerElch87 commented 3 years ago

Dear all, I tried to create support for the Parkside Smart Watering Timer, but failed catastrophically :)

I created a .js file for Tuya like explained in the tutorial - but then Z2M will not start anymore. I copied the content on the bottom of the message. If anyone is willing to help, I'd highly appreciate.

Thanks and best regards

Information about the device + link

Parkside Smart Watering Timer https://www.lidl.de/de/parkside-smarter-bewaesserungscomputer-zigbee-smart-home/p375570

Failure message when starting Z2M

[08:04:41] INFO: Handing over control to Zigbee2mqtt Core ...

zigbee2mqtt@1.19.0 start /app node index.js (node:398) UnhandledPromiseRejectionWarning: ReferenceError: tuya is not defined (Use node --trace-warnings ... to show where the warning was created) (node:398) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:398) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

PSBZS.js

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 e = exposes.presets; const ea = exposes.access;_

const definition = { fingerprint: [ { modelID: 'TS0601', manufacturerName: '_TZE200_c88teujp' }, ], model: 'PSBZS A1', vendor: 'Lidl', description: 'Smart Watering Timer', supports: 'thermostat, temperature', fromZigbee: [ fz.ignore_basic_report, // Add this if you are getting no converter for 'genBasic' fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part ], toZigbee: [ tz.tuya_data_point_test, // Another debug converter ], onEvent: tuya.setTime, // Add this if you are getting no converter for 'commandSetTimeRequest' configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']); }, exposes: [ // Here you should put all functionality that your device exposes ], };

module.exports = definition;

Edit: Link to Zigbee Alliance https://zigbeealliance.org/zigbee_products/smarter-water-computer/

Smanar commented 3 years ago

Harf, we are not using the same sniff. On this one https://github.com/Koenkk/zigbee2mqtt/issues/7695#issuecomment-864570013

After the gateway ask for the attribute 0xffde and before the first tuya request, you have the device that ask for gateway node descriptor (and not the reverse)

mgrom commented 3 years ago

I'm going to reflash dongle and start over :) Maybe it's something wrong with mine configuration

EDIT: No luck after clean start...

EDIT2: Finaly I've managed to open and close valve, but the device still doesn't report back...

mgrom commented 3 years ago

Its looks like its setting up the device with one command for using tuya commands:

ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 1
    Frame Control Field: Data (0x00)
    Destination Endpoint: 1
    Cluster: Basic (0x0000)
    Profile: Home Automation (0x0104)
    Source Endpoint: 1
    Counter: 1
ZigBee Cluster Library Frame, Command: Write Attributes, Seq: 1
    Frame Control Field: Profile-wide (0x10)
    Sequence Number: 1
    Command: Write Attributes (0x02)
    Attribute Field, Uint8: 13
        Attribute: Unknown (0xffde)
        Data Type: 8-Bit Unsigned Integer (0x20)
        Uint8: 13 (0x0d)

All the rest is "normal tuya commands" and no Zigbee standard commands more then the handshaking with default response for the no ZCL commands.

I have the same feeling that this command is important. But I'm not able to crack it. Value of the attribute in my case was 19 - sure I tried to replicate it but with no luck... I've tried to use different values, no luck either.

Smanar commented 3 years ago

On my sniff it s 13 (0x0D). Time based ? No answer yet for tests using the conbee on my side. But I realy think it can come from answer from the gateway to the node descriptor request. There is too some device that stop reporting if the gateway don't answer with good manufacture code at this request.

mgrom commented 3 years ago

I don't think it's time based. No matter how many times I'm pairing the device with GW, every time this attribute is equal to 19.

mgrom commented 3 years ago

@Koenkk is there any simple way to change Frame Control Field when sending Command to the device?

mgrom commented 3 years ago

OK, I can confirm two things: DP: 0x01 - value:0 => OFF, value:1 => ON DP: 0x05 - with raw data [0,0,0,1] sets auto off timer to 1min, [0,0,02] to two minutes etc.

Still no luck with device reporting it's own status...

Big4SMK commented 3 years ago

That's very encouraging news. Being able to set the timer would be really helpful over sending continues "on" commands like w do right now. Great work!

divemasterjm commented 3 years ago

Today I will receive mine, can someone help me to add it to z2m?

liselotte111 commented 3 years ago

Sorry, I know this is not the right place to ask. But I would love to try it out. If run supervised HA and I've added a .js file to the /share/zigbee2mqtt folder with the converter suggested by @cru8602. When I add it to the config.yaml I get an error saying: Cannot find module 'zigbee-herdsman-converters/lib/extend

Could someone point me in the right direction?

VictorvandenHoven commented 3 years ago

Did you add the extension as well? You have to use the "extension" button in the zigbee2mqtt to add the .js file as an extension.

image

liselotte111 commented 3 years ago

Thank you Victor, but I tried that. It appears that I was running the add-on from the old repo. I will first try to switch to the new one.

mgrom commented 3 years ago

Ok, I'm running out of ideas. There is still one last thing that is worth to try, but I don't know how to send proper command. Tuya GW: image Command that I've tried to send to device: image

All other messeges I managed to replicate with the same values in other fields of frame, but the one above is tricky. I think this is the key, because if not then there has to be something to deep to be seen by me.

EDIT: My command is opening the valve, Tuya command doesn't

mgrom commented 3 years ago

One more decoded command. This time for schedule: DP: 0x6b data: 0x00 0x70 means -> 0x00 weekly schedule and 0x70 <=> 1110000 (sunday, saturday, friday, .... monday) so it's ON on sun, sat, and fri. data: 0x01 0x05 means -> 0x01 cycle schedule and 0x05 means every 5th day.

still no luck with getting messages from the device :(

liselotte111 commented 3 years ago

Thank you Victor, but I tried that. It appears that I was running the add-on from the old repo. I will first try to switch to the new one.

In case anyone runs into the same problem. After changing to the new repo I can add external converters

(now running zigbee2mqtt add-on 1.19.1-1 from https://github.com/zigbee2mqtt/hassio-zigbee2mqtt)

lvefferen commented 3 years ago

I tried the extension from @cru8602, Somehow I cannot save the extension. saving the extension reports

Request 'zigbee2mqtt/bridge/request/extension/save' failed with error: '[object Object] is not a constructor'

Any directions on how to save the extension? like @liselotte111 I'm using the HASS addon version 1.19.1-1

liselotte111 commented 3 years ago

Via the GUI didn't work for me either. I saved it as a .js file in my /share/zigbee2mqtt folder. Next I added it to the configuration.yaml

mgrom commented 3 years ago

I think I'm gonna pass on forcing the device to report it's own state. As long I can't replicate exactly the same messages I can't go further.

My needs are simple, and I think I'll be able to live with current state of integration. So this is my setup:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [],
    configure: async (device, coordinatorEndpoint, logger) => {},
};

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: (entity, key, value, meta) => {
            tuya.sendDataPointRaw(
                entity,
                5,
                tuya.convertDecimalValueTo4ByteHexArray(value));
        },
    },
};

module.exports = definition;
divemasterjm commented 3 years ago

I think I'm gonna pass on forcing the device to report it's own state. As long I can't replicate exactly the same messages I can't go further.

My needs are simple, and I think I'll be able to live with current state of integration. So this is my setup:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [],
    configure: async (device, coordinatorEndpoint, logger) => {},
};

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: (entity, key, value, meta) => {
            tuya.sendDataPointRaw(
                entity,
                5,
                tuya.convertDecimalValueTo4ByteHexArray(value));
        },
    },
};

module.exports = definition;

hi, i copied your integration and after restart i've got the following error, previous version was running ok, do i have to make something different than put file on directiory as it was the previous one?

(node:4390) UnhandledPromiseRejectionWarning: ReferenceError: devConv is not defined (Use node --trace-warnings ... to show where the warning was created) (node:4390) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:4390) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

mgrom commented 3 years ago

@divemasterjm I think it's just a matter of order. Just move second "const" block before the first one.

divemasterjm commented 3 years ago

@divemasterjm I think it's just a matter of order. Just move second "const" block before the first one.

yes, now it works, do i have to repair? cause i have only the following and ha do nothing i only have linkquality sensor, no switch

exposes linkquality Link quality (signal strength) N/Alqi

state { "state": "OFF" }

mgrom commented 3 years ago

The device is not reporting anything. You can switch it on/off and change auto off timer settings using mqtt , but you'll never know if your command was received by the device or not. This is sort of one way communication for now :)

divemasterjm commented 3 years ago

@divemasterjm I think it's just a matter of order. Just move second "const" block before the first one.

yes, now it works, do i have to repair? cause i have only the following

{ "state": "OFF" }

The device is not reporting anything. You can switch it on/off and change auto off timer settings using mqtt , but you'll never know if your command was received by the device or not. This is sort of one way communication for now :)

and the topics for timer and switch on/off?

mgrom commented 3 years ago

on/off is standard one and for timer is .../set/timer with number of minutes as payload

divemasterjm commented 3 years ago

on/off is standard one and for timer is .../set/timer with number of minutes as payload

thanks for all, i've made a mqtt switch on HA, it works, also timer. for the moment is all i need, thanks for your cooperation

sandervandegeijn commented 3 years ago

Cool! Is this going to be merged into Zigbee2mqtt?

mgrom commented 3 years ago

Yes it'll be 😊 I just need to find some spare time

senguendk commented 3 years ago

Sorry if I seem impatient, but how long will it take to get merged and released as a docker image?

@mgrom thank you very much for your time and effort!

stailus commented 3 years ago

@mgrom

Hi,

I manually patch zigbee-herdsman-converters but I can't switch valve on or off. In Exposes I see only linkquality

image

I must do anythink else?

mgrom commented 3 years ago

Hi,

I manually patch zigbee-herdsman-converters but I can't switch valve on or off. In Exposes I see only linkquality

image

I must do anythink else?

HI @stailus , You can switch valve and set timer via mqtt. I haven't set exposed entities because the device is not reporting state yet. So there will be inconsistency between real state and the state kept by zigbee2mqtt, and this will lead to confusion. So I gave you possibility to talk to the device but without anything more.

To open the valve just use standard switch mqtt topic, and to set auto off timer use .../set/timer with number of minutes as number in payload.

stailus commented 3 years ago

Hi @mgrom

Thank's for you answer and for your work. I try to publish in mqtt, but without result :( Can you post a config for mqtt switch?

Thank you

jchmielniak commented 3 years ago

@stailus set timer to 15 minutes mosquitto_pub -h <mqtt-server> -t 'zigbee2mqtt/<friendly-name>/set' -m '{"timer":"15"}' switch it on mosquitto_pub -h <mqtt-server> -t 'zigbee2mqtt/<friendly-name>/set' -m '{"state":"on"}'

stailus commented 3 years ago

@jchmielniak

Thank you very much, work now.

mgrom commented 3 years ago

@stailus I've just added exposes to PR, so take a look at it :)

dgomes commented 3 years ago

Just linking the PR from here for future reference:

https://github.com/Koenkk/zigbee-herdsman-converters/pull/2740

divemasterjm commented 3 years ago

@stailus I've just added exposes to PR, so take a look at it :)

how will be the new integration? just to test till new version is out with PR

skatehouse commented 3 years ago

@Smanar maybe also sth for deconz

stailus commented 3 years ago

@stailus I've just added exposes to PR, so take a look at it :)

HI @mgrom

Is ok, but I can't set time from Exposes, only from mqtt.

benoegen commented 3 years ago

on/off is standard one and for timer is .../set/timer with number of minutes as payload

thanks for all, i've made a mqtt switch on HA, it works, also timer. for the moment is all i need, thanks for your cooperation

@divemasterjm Hi could you please let me know, how to make the converter work on Zigbee2Mqtt Homeassistant? I cannot create it as an extension and if I copy it as an .js into share/zigbee2mqtt file and try to use the frontend to implement it, zigbee2mqtt stops starting up. Thank you

EDIT: Nevermind, I had an old repo and missed the update for 1.19, Now it works, .js inside data folder and linked it as external converter

VentiloFred commented 3 years ago

@Smanar maybe also sth for deconz

Hi @skatehouse, for this moment i use Node Red through Home Assistance to use this "Watering Timer". I send every 30s "true" to open during the time i want and false to close. I thing it's possible to do somthing similar in Home Assistant, take a look https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4958#issuecomment-854139810

mgrom commented 3 years ago

@stailus what are the symptoms of your problem? Why do you think you can't set timer via exposes?

divemasterjm commented 3 years ago

@stailus what are the symptoms of your problem? Why do you think you can't set timer via exposes?

@mgrom how can i add exposes to the .js?

mgrom commented 3 years ago

@divemasterjm it's already there, just check the PR:

        exposes: [e.switch(), exposes.numeric('timer', ea.SET).withValueMin(1)
            .withUnit('min').withDescription('Auto off after specific time.')],
divemasterjm commented 3 years ago

@divemasterjm it's already there, just check the PR:

        exposes: [e.switch(), exposes.numeric('timer', ea.SET).withValueMin(1)
            .withUnit('min').withDescription('Auto off after specific time.')],

just add it and nothing else?

i've got

zigbee2mqtt@1.19.1 start /app node index.js (node:329) UnhandledPromiseRejectionWarning: ReferenceError: e is not defined (Use node --trace-warnings ... to show where the warning was created) (node:329) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:329) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. [10:06:54] INFO: Handing over control to Zigbee2mqtt Core ...

mgrom commented 3 years ago

Sorry mate, but I'm short on time currently, and I'm not able to help

RDJ441 commented 3 years ago

You are able to 'get' the state via 'zigbee2mqtt//get/' with payload: { "state": "", "timer": "" }


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: async (entity, key, value, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            meta.logger.debug(JSON.stringify(value));
            // input in minutes with maximum of 600 minutes (equals 10 hours)
            const timer = 60 * Math.abs(Math.min(value, 600));
            // sendTuyaDataPoint* functions take care of converting the data to proper format
            await tuya.sendDataPointValue(entity, tuya.dataPoints.frankEverTimer, timer, 'setData', 1);
            return {state: {timer: value}};
        },
        convertGet: async (entity, key, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            return {state: {timer: key}};
        }
    },
};
const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report, fz.on_off, devConv.lidl_valve, devConv.smart_watering_timer],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [],
    configure: async (device, coordinatorEndpoint, logger) => {},
};

module.exports = definition;
stailus commented 3 years ago

@stailus what are the symptoms of your problem? Why do you think you can't set timer via exposes?

I set timer to 5 minutes, but not publish in mqtt topic.

hdlange commented 3 years ago

You are able to 'get' the state via 'zigbee2mqtt//get/' with payload: { "state": "", "timer": "" }


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: async (entity, key, value, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            meta.logger.debug(JSON.stringify(value));
            // input in minutes with maximum of 600 minutes (equals 10 hours)
            const timer = 60 * Math.abs(Math.min(value, 600));
            // sendTuyaDataPoint* functions take care of converting the data to proper format
            await tuya.sendDataPointValue(entity, tuya.dataPoints.frankEverTimer, timer, 'setData', 1);
            return {state: {timer: value}};
        },
        convertGet: async (entity, key, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            return {state: {timer: key}};
        }
    },
};
const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report, fz.on_off, devConv.lidl_valve, devConv.smart_watering_timer],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [],
    configure: async (device, coordinatorEndpoint, logger) => {},
};

module.exports = definition;

Thanks @RDJ441 , this configuration let me set the timer of the device and it seem to work. However, the On/Off switch in the zigbee2mqtt-dashboard is now gone. This was working very good with one of the first suggestions here. Any idea how to combine both features?

RDJ441 commented 3 years ago

Yes, this is the updated version. Missed something :)


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
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 e = exposes.presets;
const ea = exposes.access;

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: async (entity, key, value, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            meta.logger.debug(JSON.stringify(value));
            // input in minutes with maximum of 600 minutes (equals 10 hours)
            const timer = 60 * Math.abs(Math.min(value, 600));
            // sendTuyaDataPoint* functions take care of converting the data to proper format
            await tuya.sendDataPointValue(entity, tuya.dataPoints.frankEverTimer, timer, 'setData', 1);
            return {state: {timer: value}};
        },
        convertGet: async (entity, key, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            return {state: {timer: key}};
        },
    }
    },
};
const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report, fz.on_off, devConv.smart_watering_timer],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [e.switch(), exposes.numeric('timer', ea.SET).withValueMin(1).withUnit('min').withDescription('Auto off after specific time.')],
    configure: async (device, coordinatorEndpoint, logger) => {},
};
lvefferen commented 3 years ago

@RDJ441 I took the liberty to fix a minor typo, this version of the external converter is working for me like a charm.


const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
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 e = exposes.presets;
const ea = exposes.access;

// you can add this converter to toZigbee.js
const devConv = {
    smart_watering_timer: {
        key: ['timer'],
        convertSet: async (entity, key, value, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            meta.logger.debug(JSON.stringify(value));
            // input in minutes with maximum of 600 minutes (equals 10 hours)
            const timer = 60 * Math.abs(Math.min(value, 600));
            // sendTuyaDataPoint* functions take care of converting the data to proper format
            await tuya.sendDataPointValue(entity, tuya.dataPoints.frankEverTimer, timer, 'setData', 1);
            return {state: {timer: value}};
        },
        convertGet: async (entity, key, meta) => {
            meta.logger.debug(JSON.stringify(entity));
            meta.logger.debug(JSON.stringify(key));
            return {state: {timer: key}};
        },
    },
};
const definition = {
    fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_htnnfasr'}],
    model: 'PSBZS A1',
    vendor: 'Parkside',
    description: 'Smart Watering Timer',
    supports: 'switch, timer',
    fromZigbee: [fz.ignore_basic_report, fz.on_off, devConv.smart_watering_timer],
    toZigbee: [tz.on_off, devConv.smart_watering_timer],
    onEvent: tuya.onEventSetTime,
    exposes: [e.switch(), exposes.numeric('timer', ea.SET).withValueMin(1).withUnit('min').withDescription('Auto off after specific time.')],
    configure: async (device, coordinatorEndpoint, logger) => {},
};

module.exports = definition;