Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
899 stars 3k forks source link

Problem with integration of Parkside irrigation controller #2700

Closed jhron closed 3 years ago

jhron commented 3 years ago

I am trying to add support for Parkside irrigation controller. I followed documentation however I was not able to create tuya.dump.txt file. I am using version 1.18.3

This is my converter:

{
   fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_htnnfasr'
        },
    ],
    model: 'PSBZS',
    vendor: 'Lidl',
    description: 'Parkside Smart garden irrigation control (switch)',
    meta: {configureKey: 1},
    fromZigbee: [
        fz.ignore_tuya_set_time,
        //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.onEventSetTime,
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [e.battery(), e.battery_low()],
}

Here is output of pairing this device:

zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:45:45: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"modelId":"TS0601"}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:45:45: Skipping message, definition is undefined and still interviewing
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:45:50: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"manufacturerName":"_TZE200_htnnfasr"}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:45:55: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"powerSource":3}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:00: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"zclVersion":3}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:05: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"stackVersion":0}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:10: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"hwVersion":1}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:15: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"dateCode":""}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:20: Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{}' from endpoint 1 with groupID 0
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:20: Successfully interviewed '0x847127fffecfd294', device has successfully been paired
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:20: Device '0x847127fffecfd294' is supported, identified as: Lidl Parkside Smart garden irrigation control (switch) (PSBZS)
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:20: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Parkside Smart garden irrigation control (switch)","exposes":[{"access":1,"description":"Remaining battery in %","name":"battery","property":"battery","type":"numeric","unit":"%","value_max":100,"value_min":0},{"access":1,"description":"Indicates if the battery of this device is almost empty","name":"battery_low","property":"battery_low","type":"binary","value_off":false,"value_on":true},{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"PSBZS","supports_ota":false,"vendor":"Lidl"},"friendly_name":"0x847127fffecfd294","ieee_address":"0x847127fffecfd294","status":"successful","supported":true},"type":"device_interview"}'
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:21: Configuring '0x847127fffecfd294'
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:21: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"interview_successful","meta":{"description":"Parkside Smart garden irrigation control (switch)","friendly_name":"0x847127fffecfd294","model":"PSBZS","supported":true,"vendor":"Lidl"},"type":"pairing"}'
zigbee2mqtt    | Zigbee2MQTT:debug 2021-06-19 16:46:21: Received MQTT message on 'zigbee2mqtt/bridge/config/device_options' with data '{"friendly_name":"0x847127fffecfd294","options":{"retain":true}}'
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:21: Changed device specific options of '0x847127fffecfd294' ({"retain":true})
zigbee2mqtt    | Zigbee2MQTT:info  2021-06-19 16:46:25: Successfully configured '0x847127fffecfd294'

The device it self has only one button and there is no output in debug log file when I pressed the button. In additional it does not create tuya.dump.txt file at all. I tried to change relative path of tuya.dump.txt file from data/tuya.dump.txt to /data... but with same result - file remains empty.

This is only message I receive from the device:

Debug Received Zigbee message from '0x847127fffecfd294', type 'attributeReport', cluster 'genBasic', data '{"appVersion":86}' from endpoint 1 with groupID 0

What I am doing wrong?

MattWestb commented 3 years ago

The device is not sending tuya commands its receiving "normal" zigbee on / off commands.

jhron commented 3 years ago

The device is not sending tuya commands its receiving "normal" zigbee on / off commands.

I originally started normal converter like this:

{
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0601',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZE200_htnnfasr'
        },
    ],
    model: 'PSBZS',
    vendor: 'Lidl',
    description: 'Parkside Smart garden irrigation control (switch)',
    meta: {configureKey: 1},
    fromZigbee: [
        fz.battery
    ],
    toZigbee: [
    ],
    exposes: [e.battery(), e.battery_low()],
}

but then I received this (and no reaction to button press too):

Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"modelId":"TS0601"}' from endpoint 1 with groupID 0
Debug Skipping message, definition is undefined and still interviewing
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"manufacturerName":"_TZE200_htnnfasr"}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"powerSource":3}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"zclVersion":3}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"appVersion":86}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"stackVersion":0}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"hwVersion":1}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{"dateCode":""}' from endpoint 1 with groupID 0
Debug Received Zigbee message from '0x847127fffecfd294', type 'readResponse', cluster 'genBasic', data '{}' from endpoint 1 with groupID 0
Info Successfully interviewed '0x847127fffecfd294', device has successfully been paired
Info Device '0x847127fffecfd294' is supported, identified as: Lidl Parkside Smart garden irrigation control (switch) (PSBZS)
Info MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Parkside Smart garden irrigation control (switch)","exposes":[{"access":1,"description":"Remaining battery in %","name":"battery","property":"battery","type":"numeric","unit":"%","value_max":100,"value_min":0},{"access":1,"description":"Indicates if the battery of this device is almost empty","name":"battery_low","property":"battery_low","type":"binary","value_off":false,"value_on":true},{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"PSBZS","supports_ota":false,"vendor":"Lidl"},"friendly_name":"0x847127fffecfd294","ieee_address":"0x847127fffecfd294","status":"successful","supported":true},"type":"device_interview"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"interview_successful","meta":{"description":"Parkside Smart garden irrigation control (switch)","friendly_name":"0x847127fffecfd294","model":"PSBZS","supported":true,"vendor":"Lidl"},"type":"pairing"}'
Debug Received MQTT message on 'zigbee2mqtt/bridge/config/device_options' with data '{"friendly_name":"0x847127fffecfd294","options":{"retain":true}}'
Info Changed device specific options of '0x847127fffecfd294' ({"retain":true})
Debug Received Zigbee message from '0x847127fffecfd294', type 'commandSetTimeRequest', cluster 'manuSpecificTuya', data '{"payloadSize":0}' from endpoint 1 with groupID 0
Debug No converter available for 'PSBZS' with cluster 'manuSpecificTuya' and type 'commandSetTimeRequest' and data '{"payloadSize":0}'

And because I saw manuSpecificTuya in Input clusters I thought that it must be configured as tuya device.

0x847127fffecfd294
Endpoint 1
    Output clusters
        genOta
        genTime
    Input clusters
        genBasic
        genGroups
        genScenes
        genOnOff
        genIdentify
        manuSpecificTuya

So how can I get some more debug output from this device?

MattWestb commented 3 years ago

Wot i have seen is sending one normal "on" commands to cluster 0x0006 working ala normal Zigbe standard.

Its one valve with secure function so its opening for one minute and then closing if not getting one new on commands.

If you have one tua ZBGW and can sniffing the setting up and sending commands to the device it can being possible getting more functions that tuya is doing but for the moment its wot i found around the net.

jhron commented 3 years ago

Unfortunately I have no tuya gateway (or original Lidl which should be used with this device).

Yes, only functionality of this device without gateway is that after pressing the button it will open valve for 1 minute (without any feedback to Zigbee2mqtt log file) :(

RDJ441 commented 3 years ago

@MattWestb where did you see the commands? The ones from the log are present because of the exposes: [e.battery(), e.battery_low()], config option. Those aren't really working .

@jhron i'm working on it as well. But I am getting the same errors. And no file as well.

What I know is this: Parkside uses a TUYA chip (https://developer.tuya.com/en/docs/iot/zigbeetyzs4module?id=K989rhycrz23f). But it is not compatible with the TUYA platform.

RDJ441 commented 3 years ago

I've got some progress:

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 = {
    zigbeeModel: ['TS0601'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'HG06875', // Vendor model number, look on the device for a model number
    vendor: 'Parkside', // Vendor of the device (only used for documentation and startup logging)
    description: 'Watervalve', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    supports: 'on/off',
    fromZigbee: [fz.ignore_onoff_change, fz.generic_state],
    toZigbee: [tz.on_off],
    exposes: [e.battery()], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
};

module.exports = definition;

It works using 'normal' zigbee commands. When I publish a message to the topic 'zigbee2mqtt//set' with payload 'on' or 'off', it will switch 😄

MattWestb commented 3 years ago

I have only looking in the sniffing that is posted and not looking on the "normal" zigbee commands and only the tuya commands sent / received for the ZBGW in the post https://github.com/Koenkk/zigbee2mqtt/issues/7695#issuecomment-865867667

MattWestb commented 3 years ago

@RDJ441 The Zigbee module is being used in may products like the ZBGW that we have hacked very well and running as coordinator with Ethernet connection in ZHA and also Z2M.

Zigbee modules is only user as one "comport" and tunneling commands to the tuya MCU that is doing the actual work and sending and receiving commands from the tuya MQTT cloud. Tuya is using Data point (DP) that is more or less standard commands in the "tuya MCU world" and is used in most product that is communicating with comport, Bluetooth, WiFi, Zigbee and so on but its being changed little here and there for different products.

One example is tuyas TRVs then most is using the same standard commands but many have changed / extended commands that is making it on pain in the . . .

mgrom commented 3 years ago

@MattWestb where did you see the commands? The ones from the log are present because of the exposes: [e.battery(), e.battery_low()], config option. Those aren't really working .

@jhron i'm working on it as well. But I am getting the same errors. And no file as well.

What I know is this: Parkside uses a TUYA chip (https://developer.tuya.com/en/docs/iot/zigbeetyzs4module?id=K989rhycrz23f). But it is not compatible with the TUYA platform.

Why would you say it's not comaptible with TUYA platform?

MattWestb commented 3 years ago

One more example of tuya magic is one tuya MCU is being used in on product with one WiFi chip and sending the same commands to the tuya clouds. Then they is doing one version with one Zigbee module and still sending the same commands and using the same tuya MCU. Then they is making one second Zigbee version with one other Zigbee module still with the same tuya MCU and is the customer like also one Bluetooth version with the same . . .

One matrix of tuya TRVs fund that is implanted in ZHA https://github.com/zigpy/zigpy/discussions/653#discussioncomment-314395

Tuya is making "normal Zigbee" device (sending ZCL commands) but most is using "tuya cluster" = sending "private" commands that is not standard but OK in the zigbee world (shall being ignored of other devices that dont have the same manufacture number).

Therefor the On / Off command is working then its one normal Zigbee commands but all other commands that is being sent over the tuya cluster is not Zigbee standard and need being "converted" to more understandably commands for our systems. Also the status reporting is not being made with normal zigbee commands (attribute reporting) and is only being made with tuya commands = DPs.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days