itavero / homebridge-z2m

Expose your Zigbee devices to HomeKit with ease, by integrating 🐝 Zigbee2MQTT with 🏠 Homebridge.
https://z2m.dev
Apache License 2.0
323 stars 49 forks source link

Zemismart ZM25TQ Curtain Not responding via HomeKit #129

Closed EddieDSuza closed 3 years ago

EddieDSuza commented 3 years ago

Please use the template and fill in all the data requested below!

Describe the bug Successfully added the device to Z2M frontend. The device does respond using the frontend but any changes to the state of the device provides an error in the log which is below

Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":41,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":41,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Info Setting motor speed to 0
Warning TuYa_cover_control: Unhandled DP #12 for _TZE200_fzo2pocs: {"status":0,"transid":1,"dp":12,"datatype":5,"fn":0,"data":{"type":"Buffer","data":[1]}}
Warning TuYa_cover_control: Unhandled DP #103 for _TZE200_fzo2pocs: {"status":0,"transid":1,"dp":103,"datatype":1,"fn":0,"data":{"type":"Buffer","data":[0]}}
Warning TuYa_cover_control: Unhandled DP #104 for _TZE200_fzo2pocs: {"status":0,"transid":1,"dp":104,"datatype":1,"fn":0,"data":{"type":"Buffer","data":[0]}}
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":41,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Warning TuYa_cover_control: Unhandled DP #106 for _TZE200_fzo2pocs: {"status":0,"transid":1,"dp":106,"datatype":4,"fn":0,"data":{"type":"Buffer","data":[0]}}

Related devices Are you experiencing this behavior with a particular device? Zemismart ZM25TQ Curtain Expected behavior No device response when accessing the device from the Home App

MQTT messages

Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":40,"motor_speed":false,"position":77,"running":true,"state":"OPEN"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":40,"motor_speed":false,"position":100,"running":true,"state":"OPEN"}'
Error No converter available for 'get' 'position' (0)
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":40,"motor_speed":false,"position":16,"running":true,"state":"OPEN"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":40,"motor_speed":false,"position":0,"running":true,"state":"CLOSE"}'
Error No converter available for 'get' 'position' (0)
itavero commented 3 years ago

Can you also add the entry for the device, from the zigbee2mqtt/bridge/devices topic?

EddieDSuza commented 3 years ago
{
    "date_code": "",
    "definition": {
        "description": "Curtain motor/roller blind motor/window pusher/tubular motor",
        "exposes": [{
            "features": [{
                "access": 3,
                "name": "state",
                "property": "state",
                "type": "binary",
                "value_off": "CLOSE",
                "value_on": "OPEN"
            }, {
                "access": 3,
                "description": "Position of this cover",
                "name": "position",
                "property": "position",
                "type": "numeric",
                "value_max": 100,
                "value_min": 0
            }],
            "type": "cover"
        }, {
            "features": [{
                "access": 3,
                "description": "Motor speed",
                "name": "motor_speed",
                "property": "motor_speed",
                "type": "numeric",
                "value_max": 255,
                "value_min": 0
            }],
            "name": "options",
            "property": "options",
            "type": "composite"
        }, {
            "access": 1,
            "description": "Link quality (signal strength)",
            "name": "linkquality",
            "property": "linkquality",
            "type": "numeric",
            "unit": "lqi",
            "value_max": 255,
            "value_min": 0
        }],
        "model": "TS0601_cover",
        "supports_ota": false,
        "vendor": "TuYa"
    },
    "endpoints": {
        "1": {
            "bindings": [],
            "clusters": {
                "input": ["genBasic", "genTime", "genGroups", "genScenes", "manuSpecificTuya"],
                "output": ["genOta"]
            },
            "configured_reportings": []
        }
    },
    "friendly_name": "Curtain ",
    "ieee_address": "0x5c0272fffea4d0b2",
    "interview_completed": true,
    "interviewing": false,
    "model_id": "TS0601",
    "network_address": 26183,
    "power_source": "Mains (single phase)",
    "supported": true,
    "type": "Router"
}
itavero commented 3 years ago

Looking at the product information, it appears that my implementation currently does not check the access property for the position. For the IKEA blinds, I actively poll the position, as it does not broadcast it frequently (which looks weird in HomeKit, as it will say that it is still moving until it receives the same position twice or something like that).

I can get rid of this automatic polling stuff, but I'm not sure if the behavior itself will improve or if I even can improve it.

EddieDSuza commented 3 years ago

Is there a way of getting rid of it and testing if it works. I don't mind doing it. 😇

itavero commented 3 years ago

The code has to be edited for that.

In src/converters/cover.ts, the polling done via the updateTimer should only be done if exposesCanBeGet(positionExpose) === true.

However, HomeKit expects to see the same position twice (or some magic like that), before it considers the cover to have stopped moving.

By the way, the warnings about the Unhandled DP can probably ignored (that's also a Zigbee2MQTT log, not a log from homebridge-z2m).

Just to confirm: you don't see the cover move physically when controlling it via HomeKit? If you send the MQTT messages manually to change the position, does it work then?

EddieDSuza commented 3 years ago

To confirm - I Don't see the cover move physically when controlling it via HomeKit

When sending manual MQTT messages to OPEN or CLOSE or STOP - it does react with the messages and the motor turns. Here are the LOGS from the frontend.

Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":193,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":193,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":193,"motor_speed":false,"position":0,"running":false,"state":"CLOSE"}'
Info MQTT publish: topic 'zigbee2mqtt/Curtain ', payload '{"linkquality":193,"motor_speed":false,"position":12,"running":false,"state":"OPEN"}'

Here are the messages when trying to control the device via the Homebridge UI but the device does not respond.

[05/04/2021, 17:42:14] [zigbee2mqtt] Publish to 'zigbee2mqtt/0x5c0272fffea4d0b2/set': '{"position":100}'
[05/04/2021, 17:42:15] [zigbee2mqtt] Publish to 'zigbee2mqtt/0x5c0272fffea4d0b2/set': '{"position":0}'
[05/04/2021, 17:42:16] [zigbee2mqtt] Publish to 'zigbee2mqtt/0x5c0272fffea4d0b2/get': '{"position":0}'
itavero commented 3 years ago

This plugin uses the position attribute. According to the exposes information, this can be set.

If I understand you correctly, this doesn't actually work. In that case, there's probably a bug in Zigbee2MQTT (either position should work or it shouldn't be in the exposes information).

An implementation that only fully opens and closes using the other property, might also be possible. However, at this point there's no way for the plugin to distinguish if it should/can use the position attribute or not.

EddieDSuza commented 3 years ago

Is there a work around or fix ? If not - will need to return the device and look for an alternative to blinds.

Out of curiosity - what would be the command to set a position in MQTT manually ?

itavero commented 3 years ago

what would be the command to set a position in MQTT manually ?

As shown in the logs: publish to zigbee2mqtt/0x5c0272fffea4d0b2/set: {"position":100}

EddieDSuza commented 3 years ago

Didn't work.

Well to wrap up this issue - can the device be functional in HomeKit or no via a plugin update ?

If not will need to look for another similar solution that will work 😇

Your thoughts and as always appreciate your time on this.

itavero commented 3 years ago

If the position can't be set properly via Zigbee2MQTT, then I don't think it will work. Perhaps also report a bug in the Zigbee2MQTT project that the position cannot be set for this particular device.

Of course an implementation for just fully opened/closed using the state might still be possible, but then Zigbee2MQTT should also be updated so that it does not show the position as "settable" for this device (as it apparently does not work).

EddieDSuza commented 3 years ago

Awesome Thanks for the info - will go ahead an open issue in the Zigbee2MQTT project

EddieDSuza commented 3 years ago

So I have been doing some research on this and it looks like in the default device.js there is no mention about the support syntax for this

supports: 'open, close, stop, position',

Any idea on how to add this for HomeBridge - may be its a try cause most of the issues for Z2M are related to HA.

Thanks

itavero commented 3 years ago

This information is generated from the exposes information: https://github.com/Koenkk/zigbee-herdsman-converters/blob/e3902f144238fa5a00027c02db33c75e5ad92c12/devices.js#L1670-L1677

EddieDSuza commented 3 years ago

I just seen this issue and in his configuration there is this support values added.

Any idea on how I can update the device.js within terminal for Homebridge ?

stale[bot] commented 3 years ago

It appears that this issue did not have an update in quite some time. Please check if you can provide any additional information to help resolve this issue. If there isn't any activity in the next two weeks, this issue will be closed automatically. Thank you for your contributions!

itavero commented 3 years ago

I just seen this issue and in his configuration there is this support values added.

Any idea on how I can update the device.js within terminal for Homebridge ?

@EddieDSuza Somehow I missed your comment. Is this still an issue you are facing or has it been resolved with newer versions of Zigbee2MQTT?

stale[bot] commented 3 years ago

It appears that this issue did not have an update in quite some time. Please check if you can provide any additional information to help resolve this issue. If there isn't any activity in the next two weeks, this issue will be closed automatically. Thank you for your contributions!