Announcing the "ST_Anything" Arduino/ThingShield Project

David,

Yes, you are on the right track. Here is a quick multiplexer example app I just whipped up that includes 2 virtual contact sensors and 2 virtual motion detectors. (Note: I have never tried running this app, so you may need to debug it a little.)

/**
 *  ST_Anything Example Multiplexer - ST_Anything_Example_Multiplexer.smartapp.groovy
 *
 *  Copyright 2016 Daniel Ogorchock
 *
 *  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.
 *
 *  Change History:
 *
 *    Date        Who            What
 *    ----        ---            ----
 *    2016-10-25  Dan Ogorchock  Original Creation
 *
 */
 
definition(
    name: "ST_Anything Example Multiplexer",
    namespace: "ogiewon",
    author: "Daniel Ogorchock",
    description: "Connects single Arduino with multiple similar devices to their virtual device counterparts.",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")

preferences {

	section("Select the Virtual Contact Sensor devices") {
		input "contact1", title: "Virtual Contact Sensor 1", "capability.contactSensor"
		input "contact2", title: "Virtual Contact Sensor 2", "capability.contactSensor"
	}

	section("Select the Virtual Motion Sensor devices") {
		input "motion1", title: "Virtual Motion Sensor 1", "capability.motionSensor"
		input "motion2", title: "Virtual Motion Sensor 2", "capability.motionSensor"
	}

	section("Select the Arduino device") {
		input "arduino", "capability.contactSensor"
    }    
}

def installed() {
	log.debug "Installed with settings: ${settings}"
	subscribe()
}

def updated() {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
	subscribe()
}

def subscribe() {

    subscribe(arduino, "contact1.open", contact1Open)
    subscribe(arduino, "contact1.closed", frontDoorClosed)
    
    subscribe(arduino, "contact2.open", contact2Open)
    subscribe(arduino, "contact2.closed", contact3Closed)

    subscribe(arduino, "motion1.active", motion1Active)
    subscribe(arduino, "motion1.inactive", motion1Inactive)
    
    subscribe(arduino, "motion2.active", motion2Active)
    subscribe(arduino, "motion2.inactive", motion2Inactive)

}


// --- contact1 ------------------------------------------------------ 
def contact1Open(evt)
{
    if (contact1.currentValue("contact") != "open") {
    	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	contact1.openme()
    }
}

def contact1Closed(evt)
{
    if (contact1.currentValue("contact") != "closed") {
	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	contact1.closeme()
    }
}

// --- contact2 ------------------------------------------------------ 
def contact2Open(evt)
{
    if (contact2.currentValue("contact") != "open") {
    	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	contact2.openme()
    }
}

def contact2Closed(evt)
{
    if (contact2.currentValue("contact") != "closed") {
	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	contact2.closeme()
    }
}

// --- motion1 ------------------------------------------------------ 
def motion1Active(evt)
{
    if (motion1.currentValue("motion") != "active") {
    	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	motion1.active()
    }
}

def motion1Inactive(evt)
{
    if (motion1.currentValue("motion") != "inactive") {
	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	motion1.inactive()
    }
}

// --- motion2 ------------------------------------------------------ 
def motion2Active(evt)
{
    if (motion2.currentValue("motion") != "active") {
    	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	motion2.active()
    }
}

def motion2Inactive(evt)
{
    if (motion2.currentValue("motion") != "inactive") {
	log.debug "arduinoevent($evt.name: $evt.value: $evt.deviceId)"
    	motion2.inactive()
    }
}


def initialize() {
	// TODO: subscribe to attributes, devices, locations, etc.
}

Thank you I will try it when I get home this evening. Do you have a PayPal account I can provide you with a donation? You are very helpful and with out your guidance and expertise I would probably be staring at the screen with my head shaking still.

I appreciate the kind words. I have received lots of help here from others, and so I feel good that I can help to pay it forward. All I ask in return is that you help others where possible. It is the ST Community that truly makes it the most fun home automation solution!

Sounds good I have learned a whole lot and in these past few days. Thank you again and I am sure I will have more questions in the future, so your patience is greatly appreciated.

So more questions on the motion portion of things. I got everything up and running seemed to be going good. they were registering motion activity But now the motion sensors seemed to stop working completely. I have checked and they have no adjustment for sensitivity or delay. Any suggestions?

Also I have 2 contact sensors that i believe might be wiring issues (boysWindow,stairsWindow) I hope. But the other 2 (bathroomWindow,kidsWindow) communicate with the shield in the app but do not relay that information to the Virtual Contact Sensor. I have gone over the sketch, device handler and smart app to see if I had any typos but did not see any.
My status of my shield reads as followed:

motion: inactive
motion2: inactive
frontDoor: closed
slidingRdoor: closed
boysWindow: open
stairsWindow: open
loftWindow: closed
bathroomWindow: closed
masterWindow1: closed
masterWindow2: closed
kidsWindow: closed
kitchenWindow: closed

In the Virtual Contact Sensor for both (bathroomWindow,kidsWindow) show no states found.

David,

Send me a private message and maybe we can connect via email. Probably easiest if you can email me a zipped copy of all of your code so I can try to debug it locally.

Dan

need a little hep My LUX value is all on one line and cant read it l

p.

Also I have nothing hooked to motion and it keeps going on and off

As for the LUX reading, not sure what the issue is. I use iOS and the ST App renders it correctly. You may need to make some minor mods in the Device Handler.

The motion detector input needs to be pulled high or low to stop the floating input from alternating. If you attach a PIR motion sensor, it will quiet down as well.

I looked in there and really dont see what I can do other than making the circle bigger or a different color. I cant find where I can change the font to a different sizw. I see what happens when I first open it it is right in the middle and OK. a second later it drops to the bottom and unreadable.

Are you using this with a QID wireless reciver. I have one integrated into my system but not sure how to use it with this system

I have no idea what a QID receiver is.

I created this project to help others get a jump start using an Arduino with ST.

I then applied it to my house’s prewire setup for a future alarm system. Then I installed some inexpensive door sensors to the wiring, and tweaked my sketch to create ST_Anything_Doors as a solution and example for others.

From there, I have helped others with their projects as needed, and loaded those up as further examples of how the ST_Anything library can be used.

www.security.honeywell.com/hsc/products/intruder-detection-systems/wireless/receiver/21231.html

It is a Honeywell sa5882 wireless receiver. I did not have a lot of hardwire accessories mainly they were hooked up to this reciver. It send digital signals but not sure what. Is there a way that I can see what is being received and interpret for this application

I have no idea how that Honeywell device works.

Here is an interesting device that could be used

1 Like

Interesting sensor. Do you have any ideas for use cases around the house?

Motion detection for things that aren’t people? (Doors?)

Typically yes. Something that doesn’t have a heat signature different from ambient room temperature. It’s also used in robotics.

I would note, however, that the blurb says “nonlife object detection” which is usually a bounceback used for things like robot vacuums to keep them from running into walls, not a motion detector. The object being detected might be stationary. :construction:

Not sure which of the two this device does, I haven’t looked at it.