Modify Multipurpose Sensor Device Handler?

I’m pretty new to Smartthings, and am not a programmer or coder, just a “tinkerer”. Anyway, I am using 2 Smartthings Multipurpose Sensors for vibration only, and to keep things clean looking I don’t want to mount the magnet next to it. Ultimately what I would like is to remove the contact sensor option completely, and in my list of devices on my mobile app (iOS) I would like it to show in the list Active/Inactive instead of Open or Close.
I have searched the forum and haven’t found anyone who’s modified the device handler yet, and was just wondering if anyone knew of such a modified device handler. I would also be willing to modify it myself if I knew what I was doing :slight_smile:
Or is this even an option?

Definitely an option and pretty easy.

It will no longer execute “locally” though.

I’m OK with it not running locally. Neither one are critical.
If it’s pretty easy, would you mind pointing me in the right direction on what to change?

You can go into the IDE, edit your device handler and change which tile to be the main default. You can probably make vibration the main for your device. Look for something like below in the code.

main “humidity”
details([“humidity”, “temperature”, “battery”, “refresh”])

No luck. The only things I could find remotely like that were the tiles and their attributes, but when trying to rearrange them I got errors after trying to create.

Here’s what I did, maybe this will help:

  1. Log into your IDE
  2. Select Device Handlers
  3. In the top right hand, click on Create New Device Handler
  4. From the tabs, click From Template
  5. Scroll down the long list of device handlers until you find SmartSense Multi
  6. Click on it, then scroll all the way back up to the top, you should see some code
  7. Press Command-F (on a Mac ) Ctrl-F (on Windows) for Find
  8. Type in “main” (without the quotes)
  9. You should see the following:
  main(["contact", "acceleration", "temperature"])
  details(["contact", "acceleration", "temperature", "battery"])

Switch contact with acceleration to make that first. Save this out with a different name, then assign this new DH to your SmartSense Multi.

I hope that works, I didn’t really test it but I have done similar to other devices that I have. This will make acceleration the default listing when you view your device in the mobile app. To see the rest, you will need to click through to the main screen.

6 Likes

Thank you so much! That worked perfectly! Now that you’ve shown me how to tweak this, I might just play with it a little bit more :slight_smile:

I have one of these “in” my washer…(in zip-lock bag, velcro’d and taped to the side of the drum)<—Don’t laugh, it has been working for months!

However, I only use this to gauge how often the kids are doing laundry. I am not interested in the temperature nor open/close.

The above steps were good to get vibration to be default but, how do I get rid of all of the temperature readings that spam my recent activity feed?

Was reading the HUB update notes on the zigbee OTA firmware updates as well…Hopefully that will fix the constant spamming of active/inactive notifications…

I just want to know when the laundry started and stopped, so maybe only updates every five minutes?

Or an App that does just that, log Laundry Start and Stop times?


I’m interested in something similar: I’m using the sensor with the Mood Cube app, so I’d like to see the xyz axis (or something related, like 1 to 6) rather than the contact status (which doesn’t properly work in my sensor, that’s why I repurposed this as a mood cube “remote”).

Any suggestion? I started tried replacing “contact” with “threeAxis”, but it does not work.

OK, I managed to get the xyz position with this:

	valueTile("threeAxis", "device.threeAxis", width: 2, height: 2) {
		state("threeAxis", label: "$currentValue", backgroundColor: "#e86d13"
		)
	}

…but I’d like to rather show the 1-6 “mood cube way” of interpreting that xyz position. I found the relevant function from the Mood Cube app:

private getOrientation(xyz=null) {
final threshold = 250

def value = xyz ?: cube.currentValue("threeAxis")

def x = Math.abs(value.x) > threshold ? (value.x > 0 ? 1 : -1) : 0
def y = Math.abs(value.y) > threshold ? (value.y > 0 ? 1 : -1) : 0
def z = Math.abs(value.z) > threshold ? (value.z > 0 ? 1 : -1) : 0

def orientation = 0
if (z > 0) {
	if (x == 0 && y == 0) {
		orientation = 1
	}
}
else if (z < 0) {
	if (x == 0 && y == 0) {
		orientation = 2
	}
}
else {
	if (x > 0) {
		if (y == 0) {
			orientation = 3
		}
	}
	else if (x < 0) {
		if (y == 0) {
			orientation = 4
		}
	}
	else {
		if (y > 0) {
			orientation = 5
		}
		else if (y < 0) {
			orientation = 6
		}
	}
}

orientation

}

…but I’m new to ST and don’t know how to actually use it within a tile. Any suggestion?

Is there anything new with this process? I’m trying to do the mod so that Temperature shows in the app instead of open/closed. I’m using a Visonic MCT-340 E multi-sensor and only care about temperature.
I’m still using the Classic app but log in to the IDE with a Smartthings Account.
I’m already using apps and device handlers from RBoy with no issues.
I know this is an old thread but it seems the most relevant.

I go in to the IDE then :

  • Create New Device Handler
  • From Example
  • Select ‘SmartSense Multi’
  • Modify as described to put Temperature first

When I click Create I get the error below:
Org.springframework.security.access.AccessDeniedException: Run Locally Permission not allowed for DeviceType: f08a8654-26d0-4935-8d1a-d8758b9d1f48

I also tried changing the name, namespace and author but get the same error.
Are there additional steps required? Am I missing something here?

Thanks
Tony

Change the definition to runLocally: false and then you should be able to publish the DTH

1 Like

Thanks Tom, that was it.

Hi Doesn anyone know how to change report interval for acceleration on this device. I am using primarily to detect failure on a device that I am running 24/7. Battery drains almost 7-9% per day.