Feed Pet Reminder

I am trying to adjust the “Has Barkely been Fed?” app to account for two feedings a day. I’m also using the ZooZ mini Sensor versus a contact sensor, as the app I’m using (updated by Jack Burgy). However, the alerts are firing off regardless of if I’ve fed my dog or not. Below is the code I’m using. If anyone can determine where I’m going wrong, I would greatly appreciate it!

definition(
name: “Feed That Dog!”,
namespace: “qJake”,
author: “Jake Burgy”,
description: “Reminds you to feed your pets between two times in a certain day if a motion sensor has not moved within that timeframe.”,
category: “Pets”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Pets/App-FeedMyPet.png”,
iconX2Url: “hhttps://s3.amazonaws.com/smartapp-icons/Pets/App-FeedMyPet@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Pets/App-FeedMyPet@2x.png”)

preferences {
section(“1. Choose your pet feeder sensor.”) {
input “feeder1”, “capability.motionSensor”, title: “Which sensor?”
// ************changed capability contact.sensor to capability.motionSensor
}
section(“2. Specify when you feed your pets.”) {
input “timefrom”, “time”, title: "Between…"
input “timeto”, “time”, title: “And…”
}
section(“3. If I forget by the ending time, text me.”) {
input “msg”, “text”, title: “Message? (Optional)”, description: “Oops! Don’t forget to feed Bella!”, required: false
input “phone1”, “phone”, title: "Phone number?"
input “phone2”, “phone”, title: “Secondary number? (Optional)”, required: false
input “phone3”, “phone”, title: “Secondary number? (Optional)”, required: false
}
}

def installed()
{
schedule(timeto, “scheduleCheck”)
}

def updated()
{
unschedule()
schedule(timeto, “scheduleCheck”)
}

def scheduleCheck()
{
def now = new Date()
def from = Date.parse(“yyyy-MM-dd’T’HH:mm:ss.SSSZ”, timefrom)

// Reset date to current date
from.date = now.date
from.month = now.month
from.year = now.year

def feederEvents = feeder1.eventsBetween(from, now)
def feederOpened = feederEvents.count { it.value && it.value == "active" } > 0
// ************Changed "open" to "active" - still not working


def textMsg = msg ? msg : "Oops! Don't forget to feed the pets!"

if (!feederOpened)
{
	sendSms(phone1, textMsg)
    if(phone2)
    {
		sendSms(phone2, textMsg)
    }
    if(phone3)
    {
    	sendSms(phone3, textMsg)
        }
}

}

1 Like

Didn’t look too closely but surely the contact sensor announces ‘Open’ & Closed’
‘Active’ is for motion sensing