Septic pump monitoring success!

I was delighted to discover that the Smartsense Multi acceleration sensor mounted on my septic pump switch will activate each time the septic switch engages. The jolt from the switch thump is enough for the sensor to report pump on/off (acceleration = active) changes.

Anyone who knows much about septic pump preventative monitoring will tell you that graphing septic pump activity over time is a great way identify a wide variety of problems before backup or leak problems become too severe.

Right now I have a modified “Gun cabinet” smartapp sending me a notification each time the pump acceleration sensor becomes active. Notifications seem to be consistent and reliable and match the one hour and 45 minute pump timer schedule.

I am going to create an app to:

  1. Log an entry each time the sensor activates so that historical data can be evaluated.

  2. Send me a notification or text when septic pump has not engaged in say 24 hours and mode != away. This part looks easy to do.

After only a bit of research, it appears thingspeak is a solution to log sensor activations and create csv files for graphing and evaluating possible changes to septic pump activity over time. Before I start this smartapp work, anyone have a better idea on how to log and view this data reliably?

Any other ideas to add to the app?

1 Like

How about connecting up the septic alarm to send a notification.

As far as historical data, SmartThings saves all the activity on the cloud, so in theory you could query that data for your reports. I’ve seen @wackware do this in a windows app.

I was originally thinking about connecting the alarm to ST. I never got past looking at contact sensors for that. Maybe you have a suggestion. I think the historical data could identify problems even before the alarm would sound.

Turns out the thingspeak logging is super simple thanks to florianz’s thingspeak logger. All I had to do was remove the other sensor capabilities from his code. It worked instantly. I also discovered a few other IoT APIs. After evaluating thingspeak data and charting, I will probably compare data management and viewing options to Xively and GroveStreams later. Seems like ST could offer similar logging services with minimal effort.

@Dlee

Many have had success with FortrezZ MIMOlite:

http://www.amazon.com/FortrezZ-MIMOliteUS-Z-Wave-Multi-input-Contact/dp/B00B6RZ7MM

It is more than you need, but you might find what you really need is not what you originally thought and it has so many options it should foot the bill so to speak. SmartThings is coming out with new a MIMOlite device type which exposes all its features including power loss alert which you may want for the sump pump.

Very cool! Thanks for sharing. Also, very jealous of your weather station. I really want one, but can’t afford it.

I have the rough initial smartapps setup. If these work reliably I will enhance when I find time.

To notify of pump inactivity for xx hours, using a very basic runIn for now until I find a better but simple solution. I had an “only in these modes” input but realized that could cause notifications to be skipped if we are coming and going and pump is not activating. Later I may figure out some kind of vacation silence method since the pump won’t run for days when we are not home to add contents to the tank. For now I can just remove the phone number in the app to avoid a daily text during vacations.

preferences {
	section("When . . .") {
	    input "accSensor", "capability.accelerationSensor", title: "Pump sensor inactive"
        input "numHours", "number", title: "For how many hours"
        input "messageText", "text", title: "Send notification that says"
        input "phoneNumber", "phone", title: "Send SMS message to"
	}
}

def installed() {
	subscribe(accSensor, "acceleration", onAccelerationChange);
}

def updated() {
	unsubscribe()
   	subscribe(accSensor, "acceleration", onAccelerationChange);
}

def onAccelerationChange(evt) {
	log.debug "onAccelerationChange";
	if (evt.value == "inactive") {
    	runIn(numHours * 3600, onAccelerationInactiveHandler);
    } else {
    	unschedule(onAccelerationInactiveHandler);
    }
}

def onAccelerationInactiveHandler() {
	log.debug "onAccelerationInactiveHandler";
	sendPush(messageText);
    sendSms(phoneNumber, messageText);
}    

For sending data to thingspeak.com I am using florianz’s code, reduced to watch acceleration events. Thingspeak charting looks very basic at first glance, but I can also export the data for more analysis.

preferences {
    section("Log devices...") {
        input "accelerations", "capability.accelerationSensor", title: "Accelerations", required: false, multiple: true
    }

    section ("ThinkSpeak channel id...") {
        input "channelId", "number", title: "Channel id"
    }

    section ("ThinkSpeak write key...") {
        input "channelKey", "text", title: "Channel key"
    }
}

def installed() {
    initialize()
}

def updated() {
    unsubscribe()
    initialize()
}

def initialize() {
    subscribe(accelerations, "acceleration", handleAccelerationEvent)

    updateChannelInfo()
    log.debug state.fieldMap
}

def handleAccelerationEvent(evt) {
    logField(evt) { it == "active" ? "1" : "0" }
}

private getFieldMap(channelInfo) {
    def fieldMap = [:]
    channelInfo?.findAll { it.key?.startsWith("field") }.each { fieldMap[it.value?.trim()] = it.key }
    return fieldMap
}

private updateChannelInfo() {
    log.debug "Retrieving channel info for ${channelId}"

    def url = "http://api.thingspeak.com/channels/${channelId}/feed.json?key=${channelKey}&results=0"
    httpGet(url) {
        response ->
        if (response.status != 200 ) {
            log.debug "ThingSpeak data retrieval failed, status = ${response.status}"
        } else {
            state.channelInfo = response.data?.channel
        }
    }

    state.fieldMap = getFieldMap(state.channelInfo)
}

private logField(evt, Closure c) {
    def deviceName = evt.displayName.trim()
    def fieldNum = state.fieldMap[deviceName]
    if (!fieldNum) {
        log.debug "Device '${deviceName}' has no field"
        return
    }

    def value = c(evt.value)
    log.debug "Logging to channel ${channelId}, ${fieldNum}, value ${value}"

    def url = "http://api.thingspeak.com/update?key=${channelKey}&${fieldNum}=${value}"
    httpGet(url) { 
        response -> 
        if (response.status != 200 ) {
            log.debug "ThingSpeak logging failed, status = ${response.status}"
        }
    }
}

Not using anymore, but this provides notification each time pump activates for testing initial setup. It seemed to reliably notify on each event. Shortened deltaSeconds to capture both pump on and off events.

preferences {
	section("When Septic Pump Runs..."){
		input "accelerationSensor", "capability.accelerationSensor", title: "Where?"
	}
	section("Text me at..."){
		input "phone1", "phone", title: "Phone number?"
	}
}

def installed() {
	subscribe(accelerationSensor, "acceleration.active", accelerationActiveHandler)
}

def updated() {
	unsubscribe()
	subscribe(accelerationSensor, "acceleration.active", accelerationActiveHandler)
}

def accelerationActiveHandler(evt) {
	// Don't send a continuous stream of text messages
	def deltaSeconds = 1
	def timeAgo = new Date(now() - (1 * deltaSeconds))
	def recentEvents = accelerationSensor.eventsSince(timeAgo)
	log.trace "Found ${recentEvents?.size() ?: 0} events in the last $deltaSeconds seconds"
	def alreadySentSms = recentEvents.count { it.value && it.value == "active" } > 1

	if (alreadySentSms) {
		log.debug "SMS already sent to $phone1 within the last $deltaSeconds seconds"
	} else {
		log.debug "$accelerationSensor has moved, texting $phone1"
		sendSms(phone1, "Septic pump just activated!")
	}
}

I will look it over when the new device type releases since full support in ST would be an added bonus. Thanks for the advice!

Will the MIMOlite device work on an auxiliary contact like the one listed in the link. I don’t know much about this kind of stuff. I had posted an earlier thread about the being able to get an alert with ST when my septic alarm goes off and then ran across this thread. Hopefully it never goes off, knock on wood. Any help you be greatly appreciated. Thanks!

https://www.rcworst.com/content/docs/sjerhombus/SJETankAlertABAuxConWiringIns.pdf

MIMOlite should work well. I use it to get doorbell notifications and I have my Ubi say “Ding Dong” when someone rings. It’s pretty funny. I think it comes with a tiny manual to help explain wiring. Simple to setup. You can see some of the wiring layout in this thread.

After I became more comfortable with groovy I never did go back and clean up the septic monitoring and alerting smartapp code I posted in this thread. It’s all still working and alerting as it should with the smartsense multi sensor.

omg, I just read this today.

monday, after several weeks of trying to figure out where a bad odor was coming from in the house, I finally figured out it was the ejection pump in my basement that appeared to be clogged and the pump motor was running nonstop for days. I reluctantly opened the lid on it and will save you from the details, but it was a steaming pot of mess. i unclogged it (you dont want to know how), and told myself i never want to have this problem again. after sitting there thinking about it for a few minutes, i decided to take my smartsense multi sensor that wasnt being used and tape it to the pipe going up to the sewer line because i knew the pipe had a slight jolt when it came on. watched the activity for the sensor and it worked.

I have been trying to think of a way to export the activity data to google drive so i could look at it every day and not have to watch the activity of the switch from the web since I cant have my phone with me at work. this is great since IFTTT doesnt give an option for acceleration on a switch.

im new to the smart apps, and honestly they have scared me, but I just published my 1st one to tie my nest in. so now maybe i can use more of these to do what i want rather than try to piece something together with multiple apps.

I ended up not going with SmartThings to monitor my septic tank alarm, but I do address possible SmartThings septic monitoring in my blog post:

1 Like

I’m looking for a solution to get notifications remotely when the septic alarm is triggered.

I came across this post, but the link seems to be dead. From the snippet of the post that is viewable, it seems that Steve Jenkins may have found a solution.

Anyone familiar with this?

@Geewiz,
I don’t know if here you can find something that works for you