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

Add support for Zemismart ZM-L01E-Z (1 Gang) #810

Closed
thedutchrockstar opened this issue Dec 11, 2019 · 20 comments
Closed

Add support for Zemismart ZM-L01E-Z (1 Gang) #810

thedutchrockstar opened this issue Dec 11, 2019 · 20 comments
Labels

Comments

@thedutchrockstar
Copy link

thedutchrockstar commented Dec 11, 2019

{
    zigbeeModel: ['TS0001'],
    model: 'ZM-L01E-Z',
    vendor: 'Zemismart',
    description: '1 gang switch',
    supports: 'on/off',
    fromZigbee: [fz.generic_state_multi_ep, fz.generic_power],
    toZigbee: [tz.on_off, tz.ignore_transition],
    endpoint: (device) => {
        return {'l1': 1};
    },	
},
@thedutchrockstar
Copy link
Author

Let me know if this was supposed to be posted elsewhere, I'm pretty new to all of this :)

@Koenkk
Copy link
Owner

Koenkk commented Dec 12, 2019

Does it also work with the following configuration, this removes the l1 thing which is not needed as it only exposes one endpoint.

{
    zigbeeModel: ['TS0001'],
    model: 'ZM-L01E-Z',
    vendor: 'Zemismart',
    description: '1 gang switch',
    supports: 'on/off, power',
    fromZigbee: [fz.on_off, fz.generic_power],
    toZigbee: [tz.on_off, tz.ignore_transition],
},

@thedutchrockstar
Copy link
Author

I thought the same thing however I get these error messages if I remove the endpoint:

zigbee2mqtt:error 2019-12-12T19:34:40: Failed to call 'DeviceReceive' 'onZigbeeEvent' (TypeError: model.endpoint is not a function
    at Object.convert (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman-converters/converters/fromZigbee.js:1843:47)
    at converters.forEach (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:144:41)
    at Array.forEach (<anonymous>)
    at DeviceReceive.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:142:20)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.7.1/lib/controller.js:320:44)
    at Controller.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/controller.js:228:14)
    at Zigbee.emit (events.js:198:13)
    at Controller.herdsman.on (/zigbee2mqtt-1.7.1/lib/zigbee.js:57:52)
    at Controller.emit (events.js:198:13)
    at Controller.<anonymous> (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman/dist/controller/controller.js:415:22))

zigbee2mqtt:error 2019-12-12T19:34:53: Failed to call 'DeviceReceive' 'onZigbeeEvent' (TypeError: model.endpoint is not a function
    at Object.convert (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman-converters/converters/fromZigbee.js:1843:47)
    at converters.forEach (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:144:41)
    at Array.forEach (<anonymous>)
    at DeviceReceive.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:142:20)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.7.1/lib/controller.js:320:44)
    at Controller.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/controller.js:228:14)
    at Zigbee.emit (events.js:198:13)
    at Controller.herdsman.on (/zigbee2mqtt-1.7.1/lib/zigbee.js:57:52)
    at Controller.emit (events.js:198:13)
    at Controller.<anonymous> (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman/dist/controller/controller.js:415:22))
	
zigbee2mqtt:error 2019-12-12T19:40:47: Failed to call 'EntityPublish' 'onMQTTMessage' (AssertionError [ERR_ASSERTION]: Postfix 'l1' is given but device defines no endpoints
    at Zigbee.resolveEntity (/zigbee2mqtt-1.7.1/lib/zigbee.js:173:25)
    at EntityPublish.onMQTTMessage (/zigbee2mqtt-1.7.1/lib/extension/entityPublish.js:55:36)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.7.1/lib/controller.js:320:44)
    at Controller.onMQTTMessage (/zigbee2mqtt-1.7.1/lib/controller.js:239:14)
    at MQTT.emit (events.js:198:13)
    at MQTT.onMessage (/zigbee2mqtt-1.7.1/lib/mqtt.js:86:14)
    at MqttClient.emit (events.js:198:13)
    at MqttClient._handlePublish (/zigbee2mqtt-1.7.1/node_modules/mqtt/lib/client.js:1162:12)
    at MqttClient._handlePacket (/zigbee2mqtt-1.7.1/node_modules/mqtt/lib/client.js:351:12)
    at work (/zigbee2mqtt-1.7.1/node_modules/mqtt/lib/client.js:283:12))

Maybe I'm missing something silly?
The only other "bug" I'm getting is the following:

zigbee2mqtt:warn  2019-12-12T19:41:10: No converter available for 'ZM-L01E-Z' with cluster 'genBasic' and type 'attributeReport' and data '{"appVersion":66}'

But I get this message regardless of the endpoint

@Koenkk
Copy link
Owner

Koenkk commented Dec 12, 2019

You probably use the wrong topic to control it? Try with zigbee2mqtt/[FRIENDLY_NAME]/set with payload TOGGLE.

@thedutchrockstar
Copy link
Author

Ok so this is what I get now:

zigbee2mqtt:error 2019-12-12T20:20:31: Failed to call 'DeviceReceive' 'onZigbeeEvent' (TypeError: model.endpoint is not a function
    at Object.convert (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman-converters/converters/fromZigbee.js:1843:47)
    at converters.forEach (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:144:41)
    at Array.forEach (<anonymous>)
    at DeviceReceive.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:142:20)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.7.1/lib/controller.js:320:44)
    at Controller.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/controller.js:228:14)
    at Zigbee.emit (events.js:198:13)
    at Controller.herdsman.on (/zigbee2mqtt-1.7.1/lib/zigbee.js:57:52)
    at Controller.emit (events.js:198:13)
    at Controller.<anonymous> (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman/dist/controller/controller.js:415:22))
zigbee2mqtt:info  2019-12-12T20:20:31: MQTT publish: topic 'zigbee2mqtt/slaapkamer_zemismart', payload '{"state_l1":"OFF","linkquality":15,"state":"ON"}'
zigbee2mqtt:error 2019-12-12T20:20:32: Failed to call 'DeviceReceive' 'onZigbeeEvent' (TypeError: model.endpoint is not a function
    at Object.convert (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman-converters/converters/fromZigbee.js:1843:47)
    at converters.forEach (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:144:41)
    at Array.forEach (<anonymous>)
    at DeviceReceive.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/extension/deviceReceive.js:142:20)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.7.1/lib/controller.js:320:44)
    at Controller.onZigbeeEvent (/zigbee2mqtt-1.7.1/lib/controller.js:228:14)
    at Zigbee.emit (events.js:198:13)
    at Controller.herdsman.on (/zigbee2mqtt-1.7.1/lib/zigbee.js:57:52)
    at Controller.emit (events.js:198:13)
    at Controller.<anonymous> (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman/dist/controller/controller.js:415:22))
zigbee2mqtt:info  2019-12-12T20:20:32: MQTT publish: topic 'zigbee2mqtt/slaapkamer_zemismart', payload '{"state_l1":"OFF","linkquality":15,"state":"OFF"}'
zigbee2mqtt:warn  2019-12-12T20:20:53: No converter available for 'ZM-L01E-Z' with cluster 'genBasic' and type 'attributeReport' and data '{"appVersion":66}'

This how I have it set-up in hass.io

switch:
  - platform: "mqtt"
    name: "Slaapkamer Zemismart"
    state_topic: "zigbee2mqtt/slaapkamer_zemismart"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_off: "OFF"
    payload_on: "ON"
    value_template: "{{ value_json.state }}"
    command_topic: "zigbee2mqtt/slaapkamer_zemismart/set"

Probably an extremely simple oversight on my part somewhere...

@thedutchrockstar
Copy link
Author

Ok I found the oversight, I still had the fromZigbee as fz.generic_state_multi_ep instead of fz.on_off...
As I said, I'm still a noob in this field :)

the only message left is:

zigbee2mqtt:warn  2019-12-12T20:53:59: No converter available for 'ZM-L01E-Z' with cluster 'genBasic' and type 'attributeReport' and data '{"appVersion":66}'

For the rest everything is working as it did with the endpoint set

@sjorge
Copy link
Sponsor Contributor

sjorge commented Dec 13, 2019

Adding 'fz.ignore_basic_report' to from_zigbee should solve those I think.

Koenkk added a commit that referenced this issue Dec 13, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 13, 2019

Added, will be supported in zigbee2mqtt dev branch in a few hours.

@Koenkk Koenkk closed this as completed Dec 13, 2019
@Koenkk Koenkk reopened this Dec 13, 2019
@Koenkk
Copy link
Owner

Koenkk commented Dec 13, 2019

It seems that for the first time in zigbee2mqtt history we run into a duplicate zigbee model, can you share your database.db so I can create a fix for this?

Koenkk added a commit that referenced this issue Dec 13, 2019
@thedutchrockstar
Copy link
Author

thedutchrockstar commented Dec 13, 2019

{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b000be89ed4","nwkAddr":0,"manufId":0,"epList":[110,11,8,6,5,4,3,2,1],"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"8":{"profId":260,"epId":8,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]},"11":{"profId":260,"epId":11,"devId":1024,"inClusterList":[],"outClusterList":[1280],"clusters":{},"binds":[]},"110":{"profId":260,"epId":110,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[]}},"interviewCompleted":false,"meta":{}}
{"id":2,"type":"Router","ieeeAddr":"0xec1bbdfffe687fad","nwkAddr":45897,"manufId":0,"manufName":"_TYZB01_3xe7wzpw","powerSource":"Mains (single phase)","modelId":"TS0001","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":256,"inClusterList":[0,3,4,5,6],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"TS0001","manufacturerName":"_TYZB01_3xe7wzpw","powerSource":1,"zclVersion":3,"appVersion":66}}},"binds":[]}},"appVersion":66,"zclVersion":3,"interviewCompleted":true,"meta":{}}

database.zip

Happy to help!

update:

Adding 'fz.ignore_basic_report' to from_zigbee should solve those I think.

So far I'm not receiving the warnings, this seems to have worked!

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2019

@thedutchrockstar
Copy link
Author

Power metering does not work, the aliexpress listing showed it as having power metering and the code for the TS0002 (the 2 gang variant) also had this added, which is the reason I put it in.

I can't find it on the official zemismart listing either:
https://www.zemismart.com/zemismart-tuya-zigbee-light-switch-3-gangs-physical-wall-switches-push-interruptor-110v-220v-p0230-p0230.html

@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2019

I see, the problem is that a different device also uses this zigbeeModel (https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/devices.js#L5983). I need to check if the manufacturerName (from database.db) is different between these devices so we can distinguish both. But as I don't have this device anymore I need to contact someone.

Anyway, as this other device (CR Smart Home Valve control), also support on/off your device should already work fine in the latest zigbee2mqtt dev branch (besides power measurements). I will update you once I know more.

@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2019

Btw for the time being, you can already switch to the latest dev branch and use the following device definition, this should give you access to the power readings:

{
    zigbeeModel: ['TS0001'],
    model: 'ZM-L01E-Z',
    vendor: 'Zemismart',
    description: '1 gang switch',
    supports: 'on/off, power',
    fromZigbee: [fz.on_off, fz.generic_power],
    toZigbee: [tz.on_off, tz.ignore_transition],
    meta: {configureKey: 1},
    configure: async (device, coordinatorEndpoint) => {
        const endpoint = device.getEndpoint(1);
        await bind(endpoint, coordinatorEndpoint, ['genOnOff']);
        await configureReporting.onOff(endpoint);
        await endpoint.read('seMetering', ['multiplier', 'divisor']);
    },
},

@thedutchrockstar
Copy link
Author

I doubt the switch has power metering, with the new line of code I'm getting these error messages:

zigbee2mqtt:error 2019-12-15T14:46:00: Failed to configure 'slaapkamer_zemismart', attempt 1 (Error: Timeout - 45897 - 1 - 2 - 6 - 7 after 10000ms
    at Timeout.object.timer.setTimeout [as _onTimeout] (/zigbee2mqtt-1.7.1/node_modules/zigbee-herdsman/dist/utils/waitress.js:44:24)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10))

Furthermore still no reading on the sensor.

@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2019

Can you try removing the device and re-pairing it? Maybe it configures ok then.

@thedutchrockstar
Copy link
Author

Re-pairing removed the error messages!
No reading on the powermetering sensor though.

@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2019

I guess it doesn't support it then. Which means that in zigbee2mqtt 1.8.0 it should work (besides that it is identified incorrectly but this is just a cosmetic).

@thedutchrockstar
Copy link
Author

Awesome, thank you!

@stale
Copy link

stale bot commented Feb 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 13, 2020
@Koenkk Koenkk closed this as completed Feb 13, 2020
xmow49 pushed a commit to xmow49/zigbee-herdsman-converters that referenced this issue Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants