(EDGE Driver-Mc): Zigbee Drivers for Motion, Open/Close, Moisture, Smoke-Co Sensors and others Devices

Here is the device handler:

/**

  • Copyright 2017 SmartThings original - shamlessly borrowed by the netsheriff and modded.
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
  •          Nue ZigBee Double Points
    
  •        Author: Kevin 3A Smart Home
    
  •        Date: 04/06/2020
    

*/
metadata {
// Automatically generated. Make future change here.
// flipped the on/off detection
definition (name: “Nue ZigBee Double GPO”, namespace: “3A”, author: “kevinx”) {
capability “Switch”
capability “Configuration”
capability “Refresh”

	//fingerprint profileId: "0104", inClusters: "0000 0004 0005 0006 0003 0B05 0702", outClusters: "0003  000A  0019",  manufacturer: "Feibit Inc co.", model: "FB56+ZSW1IKJ1.7", deviceJoinName: "Nue Double GPO"
	//fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B05,0702", outClusters: "000A,0019",  manufacturer: "Feibit Inc co.", model: "FB56+ZSW1IKJ1.7", deviceJoinName: "Nue Double GPO"
	fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B05,0702", outClusters: "000A,0019",  manufacturer: "3A Smart Home DE", model: "LXN56-TS27LX1.2", deviceJoinName: "Nue Double GPO"


    
    attribute "lastCheckin", "string"
    attribute "switch", "string"
    attribute "switch1", "string"
	attribute "switch2", "string"
	command "on0"
	command "off0"
	command "on1"
	command "off1"

	command "on2"
	command "off2"

    
    attribute "switch1","ENUM",["on","off"]
    attribute "switch2","ENUM",["on","off"]

    attribute "switchstate","ENUM",["on","off"] 

}

// simulator metadata
simulator {
    // status messages
    status "on": "on/off: 1"
    status "off": "on/off: 0"
    
    
    status "switch1 on": "on/off: 1"
	status "switch1 off": "on/off: 0"
    status "switch2 on": "on/off: 1"
	status "switch2 off": "on/off: 0"

    // reply messages
    reply "zcl on-off on": "on/off: 1"
    reply "zcl on-off off": "on/off: 0"
    
  
}

tiles(scale: 1) {
 multiAttributeTile(name:"switch", type: "device.switch", width: 1, height: 1, canChangeIcon: true){
        tileAttribute ("device.switch", key: "PRIMARY_CONTROL") { 

        }
       	tileAttribute("device.lastCheckin", key: "SECONDARY_CONTROL") {
			attributeState("default", label:'Last Update: ${currentValue}',icon: "st.Health & Wellness.health9")
	   	}
    }
    multiAttributeTile(name:"switch1", type: "device.switch", width: 1, height: 1, canChangeIcon: true){
        tileAttribute ("device.switch1", key: "PRIMARY_CONTROL") { 
            attributeState "on", label:'SW1 On', action:"off1", icon:"st.switches.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
            attributeState "off", label:'SW1 Off', action:"on1", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOn", label:'Turning On', action:"off1", icon:"st.switches.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
           attributeState "turningOff", label:'Turning Off', action:"on1", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
        }
       	tileAttribute("device.lastCheckin", key: "SECONDARY_CONTROL") {
			attributeState("default", label:'Last Update: ${currentValue}',icon: "st.Health & Wellness.health9")
	   	}
    }
    
   
    multiAttributeTile(name:"switch2", type: "device.switch", width: 1, height: 1, canChangeIcon: true){
        tileAttribute ("device.switch2", key: "PRIMARY_CONTROL") { 
            attributeState "on", label:'SW2 On', action:"off2", icon:"st.switches.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
            attributeState "off", label:'SW2 Off', action:"on2", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOn", label:'Turning On', action:"off2", icon:"st.switches.light.on", backgroundColor:"#00a0dc", nextState:"turningOff"
            attributeState "turningOff", label:'Turning Off', action:"on2", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
        }
       	tileAttribute("device.lastCheckin", key: "SECONDARY_CONTROL") {
			attributeState("default", label:'Last Update: ${currentValue}',icon: "st.Health & Wellness.health9")
	   	}
    }

    standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
        state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
   main(["switch"])
      details(["switch1","switch2", "refresh"])
}

}

// Parse incoming device messages to generate events

def parse(String description) {
log.debug “Parsing ‘${description}’”

def value = zigbee.parse(description)?.text
log.debug “Parse: $value”
Map map = [:]

if (description?.startsWith(‘catchall:’)) {
map = parseCatchAllMessage(description)
}
else if (description?.startsWith(‘read attr -’)) {
map = parseReportAttributeMessage(description)
}
else if (description?.startsWith('on/off: ')){
log.debug “onoff”
def refreshCmds = zigbee.readAttribute(0x0006, 0x0000, [destEndpoint: 0x02]) +
zigbee.readAttribute(0x0006, 0x0000, [destEndpoint: 0x01]) //+

return refreshCmds.collect { new physicalgraph.device.HubAction(it) }
def resultMap = zigbee.getKnownDescription(description)
log.debug “${resultMap}”

    map = parseCustomMessage(description) 
}

log.debug "Parse returned $map"
//  send event for heartbeat    
def now = new Date()

sendEvent(name: "lastCheckin", value: now)

def results = map ? createEvent(map) : null
return results;

}

private Map parseCatchAllMessage(String description) {
Map resultMap = [:]
def cluster = zigbee.parse(description)
log.debug cluster

if (cluster.clusterId == 0x0006 && cluster.command == 0x01){
	if (cluster.sourceEndpoint == 0x01)
    {
    log.debug "Its Switch one"
	def onoff = cluster.data[-1]
    if (onoff == 1)
    	resultMap = createEvent(name: "switch1", value: "on")
    else if (onoff == 0)
        resultMap = createEvent(name: "switch1", value: "off")
        }
        else if (cluster.sourceEndpoint == 0x02)
        {
        log.debug "Its Switch two"
	def onoff = cluster.data[-1]
    if (onoff == 1)
    	resultMap = createEvent(name: "switch2", value: "on")
    else if (onoff == 0)
        resultMap = createEvent(name: "switch2", value: "off")
        }
                 
}

return resultMap

}

def off1() {
log.debug “off1()”
sendEvent(name: “switch1”, value: “off”)
“st cmd 0x${device.deviceNetworkId} 0x01 0x0006 0x0 {}”
}

def on1() {
log.debug “on1()”
sendEvent(name: “switch1”, value: “on”)
“st cmd 0x${device.deviceNetworkId} 0x01 0x0006 0x1 {}”
}
def off2() {
log.debug “off2()”
sendEvent(name: “switch2”, value: “off”)
“st cmd 0x${device.deviceNetworkId} 0x02 0x0006 0x0 {}”
}

def on2() {
log.debug “on2()”
sendEvent(name: “switch2”, value: “on”)
“st cmd 0x${device.deviceNetworkId} 0x02 0x0006 0x1 {}”
}

def refresh() {
log.debug “refreshing”
[
“st rattr 0x${device.deviceNetworkId} 0x01 0x0006 0x0”, “delay 1000”,

    "st rattr 0x${device.deviceNetworkId} 0x02 0x0006 0x0", "delay 1000",

]

}

private Map parseCustomMessage(String description) {
def result
if (description?.startsWith('on/off: ')) {
if (description == ‘on/off: 0’)
result = createEvent(name: “switch”, value: “off”)
else if (description == ‘on/off: 1’)
result = createEvent(name: “switch”, value: “on”)
}

return result

}

Only has switch.
Has not power and energy.

That’s exactly how they are in my diver

Thanks Mariano. Is it the same Multiswitch driver or a different driver?

Is the same Zigbee Multi Switch and Child Mc

I just bought myself a couple of Aqara vibration sensors. Now, they are picked up by Smartthings perfectly. Only thing is: i cannot set the sensitivity level and it’s not too insensitive. The driver it is working on now is the one froM @ygerlovin (Yakovs smartthings edge drivers 1.8.16).

Is this something new, am I missing something or can it be fixed?

@Mariano_Colmenarejo

5 posts were split to a new topic: Cannot use custom driver on my Ecosmart devices

@Mariano_Colmenarejo Thank you for this driver and it’s been working great for me! I have two questions that I’m wondering if you could answer:

1 - I’m using the “Temp Sensor and child thermostat mc” driver. Is there a way to get the humidity to show on the tile instead of the temperature?
2 - What are the fields called “humidity condition” and “temp condition1” used for? I don’t see that mentioned anywhere in this thread and the previous driver that I was using didn’t have those options.

Thank you!

sorry, I don’t know how @ygerlovin driver works

I understand. Thanks for your reply. I thought that maybe you knew something to resolve this. No worries, thanks again

1 Like

You can use the multiple tile option and it shows temperature, humidity and battery.

In this post of the temperature sensor is the operación

Thank you for your quick response!! I understand the conditions now, thank you.

On the tile - I understand that I can use the large tile to see all of the values, but I was wondering if there was a way to have the option on the small tile to display humidity instead of the temperature?

Each presentation change, a new profile must be added for each existing profile and the code to change from one profile to another

Sorry, I don’t understand what that means. If you’re saying that it requires you doing a lot of work and duplicating code and you’re not interested, I get it and that’s totally fine. I wasn’t sure how difficult it would be.

In case you care, my use case is that I have one of these sensors in a cigar humidor and I mostly care to see the humidity when I look at the device because I know the temperature is around the same temperature that my house is. So, seeing the temperature isn’t of much value to me and anytime I want to see the humidity level of the humidor I need to open the device up to see it.

Again, if it’s a ton of work and not worth your time/effort, I completely understand.

Thanks again!

1 Like

It’s not that I don’t want to do it, I try to add all the feasible functions that I can and they can be utilities that they ask me for.
If there was an easier way to add a change tile for each existing profile I would

Understood. Thanks for everything that you’ve done with these drivers!

Hi @SivaG
Were you able to figure out naming the switches/creating child switches separetely so you can use with Google Assistant?

Hello @salman_ghazanfar, I was able to detect the 2/3/4 gang switches. Added new tiles for each of the child switches. I am not able to change the name for child switches but can only change the name of the Main switch.
Mariano confirmed that we cannot change the names for the child ones. This is not an ideal situation for me because I have a 4 Gang switch which operate for (living room lights, Kitchen Lights, Island bench light and dining lights. I used to call google and say “Turn on kitchen lights” and it used to work perfectly. Now I dont have that option. I have to create a new automation in google home “When i say turn on kitchen lights” use Living room 4 Gang and turn on Child 2. Like that I need to add a lot of them.
Let me know if you have a solution for this.

Thanks again

Hi, We have zigbee 4 gang switches as following. Can you help to add it into the Zigbee Multi Switch and Child Mc fingerprint file?

  • manufacturer: Feibit Inc. Co.
  • model: FB56+ZSW1JK2.5

I think you are confused. You are correct that you can not change the names of switch 2, 3 or 4 on the main device page.

Both you can change the names on the individual child switches that you create.

Mine is a 3 gang.

Main > Office Lights
Switch 2 > Office Light 2
Switch 3 > Office Light 3

I can use Alexa or Google to control all 3 switch.

Good to know you were able to connect the switches. I have not been able to figure out how to rename the child switches and have the same issue. Google assistant only works with main switch and not the child ones.