MOES Zigbee Dimmer Switch

That works really well. I don't need the duration anyway as I just want it to change level as fast as possible.

May I ask how your dimmer switch works when turned on but set to a lower dim level than 100%, say 50%. With my one, it will always come on at 100% brightness and then over a few seconds dim down to the set level. That is quite annoying at night when the lights come on a full brightness and then dim down to 5%. Does your one do the same?

I do not have this behaviour with my dimmer.
Does this happen when you switch it on from the device or when you send the 'On' command from HE?

Both. According to the manufacturer, this is expected :slightly_frowning_face:

Hi how did you get there 3 gang to work

I used the 'Generic Zigbee Multi-Endpoint Switch' driver

but can't get it to work :pensive:

This is not the one I have. Yours seems to be a 'tuya' device.
What I suggest is to try my dimmer driver which is for tuya devices. With that driver, one of the buttons might work (probably the center one).
If this is the case, then you will need to adjust the driver to handle the different buttons as different end-points

thanks tried your drive yip right switch works i will try figure it out sorry very new to hubitat. thanks for your help so far.

I have same switches. It seems Tuya devices work in different way. What I found - all buttons used same end-point = 01 but different data. I was sniffing communication between this switches and tuya hub. See attached


I expected 3rd button will be used this data for (ON) 00 01 03 01 00 01 01 and (OFF) 00 01 03 01 00 01 00.
I need help with driver for this switches too. If someone can help I can sniffing more if needed. It seems like most of all switches with cluster 0xef00 will work with this schema.

A bit close thanks to @CPS driver has got me alot closer I can at least operate one switch I am just trying to figure out how to add the others

Hi please could you share some info how to adjust driver to handle different end-points still very new to this and drivers still very confusing.

It is difficult to help without having the same device to test locally.
Moreover, if you want to do a proper multi-switch implementation, then you need to make a parent-child driver configuration (i.e. similar to the generic Zigbee Switch implementation) in order to be able to create automation rules for each of the 3 switches of the main switch.

If you want to make a simple implementation for testing, then you can just add the additional tiles/actions to the driver, by doing the following:

  1. Add the following lines at the end of the 'definition' segment of the 'metadata' section of the driver
    command "on1"
    command "off1"
    command "on2"
    command "off2"
    command "on3"
    command "off3"

  2. Then add the following methods to implement the new commands. You can remove the existing implementations of the 'on' and off', since they are supposed to turn on/off all the lights. I marked with 'TODO' the lines that you will need to 'play' with until you figure out the proper command structure. I added some command values based on the data provided by @martinkura, but I am sure you will need to do some adjustments

def off() {
log.debug "called off"
zigbee.command(0xEF00, 0x0, "000101010001000201000100") //TODO
}

def off1() {
log.debug "called off1"
zigbee.command(0xEF00, 0x0, "00010101000100")
}

def off2() {
log.debug "called off2"
zigbee.command(0xEF00, 0x0, "00010201000100") //TODO
}

def off3() {
log.debug "called off3"
zigbee.command(0xEF00, 0x0, "00010301000100") //TODO
}

def on() {
log.debug "called on"
zigbee.command(0xEF00, 0x0, "000101010001010201000101") //TODO
}

def on1() {
log.debug "called on1"
zigbee.command(0xEF00, 0x0, "00010101000101")
}

def on2() {
log.debug "called on2"
zigbee.command(0xEF00, 0x0, "00010201000101") //TODO
}

def on3() {
log.debug "called on3"
zigbee.command(0xEF00, 0x0, "00010301000101") //TODO
}

Thank you so much will give it a try

I got all 3 to switch on and off :grinning: thank you so much

metadata {
definition (name: "MOES ZigBee V.1.5", namespace: "CPS Smart Home", author: "Christos Psaroudis") {

    command "on1"
    command "off1"
    command "on2"
    command "off2"
    command "on3"
    command "off3"
    capability "Configuration"

fingerprint profileId: "0104", deviceId: "808F", inClusters: "0000,0004,0005,EF00", outClusters: "0019,000A", manufacturer: "_TZE200_9i9dt8is", model: "TS0601", deviceJoinName: "WorksWith Dimmer"
}

tiles(scale: 2) {
    multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true) {
        tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
            attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
            attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
            attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
       
        }
    }
    standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
        state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
    }
    
    main "switch"
    details(["switch", "refresh"])
}

}

// Parse incoming device messages to generate events
def parse(String description) {
Map map = [:]
//def event = zigbee.getEvent(description)

if (description?.startsWith('catchall:')) {
    log.debug description
    // call parseCatchAllMessage to parse the catchall message received
    map = parseCatchAllMessage(description)
    if (map != [:]) {
        log.debug "ok send event: $map.name $map.value"
        sendEvent(name: map.name, value: map.value)
    }
}
else {
    log.warn "DID NOT PARSE MESSAGE for description : $description"
}

}

def off3() {
log.debug "called off1"
zigbee.command(0xEF00, 0x0, "00010101000100")
}

def off2() {
log.debug "called off2"
zigbee.command(0xEF00, 0x0, "00010201000100") //TODO
}

def off1() {
log.debug "called off3"
zigbee.command(0xEF00, 0x0, "00010301000100") //TODO

}

def on3() {
log.debug "called on1"
zigbee.command(0xEF00, 0x0, "00010101000101")
}

def on2() {
log.debug "called on2"
zigbee.command(0xEF00, 0x0, "00010201000101") //TODO
}

def on1() {
log.debug "called on3"
zigbee.command(0xEF00, 0x0, "00010301000101") //TODO
}

def refresh() {
log.debug "called refresh"
zigbee.command(0xEF00, 0x0, "00020100")
//pauseExecution(1000)
//zigbee.command(0xEF00, 0x0, "0002020200")
}

def configure() {
log.debug "Configuring Reporting and Bindings."
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh()
}

private Map parseCatchAllMessage(String description) {
// Create a map from the raw zigbee message to make parsing more intuitive
def msg = zigbee.parse(description)
Map result = [:]
switch(msg.clusterId) {
case 0xEF00:
def attribute = getAttribute(msg.data)
def value = getAttributeValue(msg.data)

        switch (attribute) {
            case "switch": 
                switch(value) {
                    case 0:
                        result = [
                            name: 'switch',
                            value: 'off',
                            data: [buttonNumber: 1],
                            descriptionText: "$device.displayName button was pressed",
                            isStateChange: true
                        ]
                    break;

                    case 1:
                        result = [
                            name: 'switch',
                            value: 'on',
                            data: [buttonNumber: 1],
                            descriptionText: "$device.displayName button was pressed",
                            isStateChange: true
                        ]
                    break;
                }
            
            break;
            
            case "level": 
                int levelValue = value / 10
                result = [
                    name: 'level',
                    value: levelValue + "%",
                    data: [buttonNumber: 1],
                    descriptionText: "$device.displayName level was modified",
                    isStateChange: true
                ]
            break;
        }
    
    break;
}

return result

}

private String getAttribute(ArrayList _data) {
String retValue = ""
if (_data.size() >= 5) {
if (_data[2] == 1 && _data[3] == 1 && _data[4] == 0) {
retValue = "switch"
}
else if (_data[2] == 2 && _data[3] == 2 && _data[4] == 0) {
retValue = "level"
}
}

return retValue

}

private int getAttributeValue(ArrayList _data) {
int retValue = 0

if (_data.size() >= 6) {
    int dataLength = _data[5] as Integer
    int power = 1;
    for (i in dataLength..1) {
        retValue = retValue + power * _data[i+5]
        power = power * 256
    }
}

return retValue

}

Good to hear that is works!
I am curious about the switch all on/off commands. Did those work too?

def off() {
log.debug "called off"
zigbee.command(0xEF00, 0x0, "000101010001000201000100")
}

def on() {
log.debug "called on"
zigbee.command(0xEF00, 0x0, "000101010001010201000101")
}

Regards,

Christos

I expected those work only for 2-gang in case of 3-gang it will be

def off() {
log.debug "called off all"
zigbee.command(0xEF00, 0x0, "0001010100010002010001000301000100")
}

def on() {
log.debug "called on all"
zigbee.command(0xEF00, 0x0, "0001010100010102010001010301000101")
}

I have a similar Tuya one (not MOES brand though), touch glass with 3 buttons.
The built-in Tuya Zigbee Scene Switch driver works right out of the box.

@mcdull you lucky it has not worked for us but @martinkura has done some grate stuff getting a finished driver.

Hi I created Github account for this driver. For now driver is in development. I tweaking it step by step. But there is no documentation about HE drivers and Im not programmator only IT enthusiast.

5 Likes

well done you have done well