GroveStreams SmartApp

Is there a way to send energy usage to grove streams?

It is surely possible; you will just need to add that to the code, similarly to how it currently handles temperature, for example.

@thrash99er, I’ve been doing it for a while, see

https://github.com/yracine/device-type.myecobee/blob/master/smartapps/groveStreams.groovy

P.S. I also added a lot of devices that I use, especially anything related to the ecobee thermostats (Smart-SI, Smart, ecobee3, EMS)

Regards.

1 Like

Do have sample code for getting the thermostat operating state capability? I was able to add humidity levels successfully to GroveStream, but I can’t get the thermostat operating state. I’d like to see when my HVAC has been running in comparison to temp levels. I tried to click on the links in your post, but they aren’t working.

In the app version I use, I added a thermostat category, subscribed to “thermostatOperatingState” events:

subscribe(thermostats, "thermostatOperatingState", handleThermostatOperatingStateEvent)

…and processed it this way:

def handleThermostatOperatingStateEvent(evt) {
    sendValue(evt) { it == "idle" ? "false" : "true" }
}
1 Like

I added this to the preferences:

input "thermostats", "capability.thermostatOperatingState", title: "Thermostat Operating States", required:false, multiple: true

Then subscribed as you did:

subscribe(thermostats, "thermostatOperatingState", handleThermostatOperatingStateEvent)

Finally processed as you did:

def handleThermostatOperatingStateEvent(evt) {
    sendValue(evt) { it == "idle" ? "false" : "true" }

When I publish the updated SmartApp to my ST hub, I can see the new thermostat category, but it doesn’t recognize my Nest thermostat as an option. Thoughts?

You want to filter by “thermostat” capability:

input "thermostats", "capability.thermostat", title: "Thermostats", required: false, multiple: true

That worked, thanks!

I just used the smart app and I chose some devices ,less than 20 streams to be in the free limit
but it only logs one.I have it going for the last 3 minutes.

Do you know why or do I have to wait a bit?

Wait…
The app doesn’t poll for changes, so the devices have to change states or report for the data to push.

Yes I have seen that it starts to create components.I don’t know if I can trigger them with Pollster.
The same philosophy app for Xively sends continuous live data.I made it work 20minutes ago.
I want also a plot.ly app for SmartThings and check which is better for historical data.

How did you create that top graph in GroveSteams? That’s awesome! - Derek

Create an org at GroveStreams, create “API key”. Put “API Key” in phone smartapp for GS and select sensors to share, then the selected streams become available for charting at GS within an hour. You drag the streams onto a graph widget, configure axes and colors and linetypes. Repeat until insane and bored. Share the chart with a separate key and link if you want to publish to internet. Be aware of sharing house address and occupancy.

Every now and again/ about 1-2 times a month it stops logging. Then I open the smartapp, check or uncheck a new sensor, click DONE then GS starts receiving all data again. I just configured a way that GS will notify me if it stops receiving data for a couple hours - convenient.

I think the best part is not having to keep my own weather station.

One hangup is that none of my humidities are showing up as streams. It’s a puzzle.

I’ve also added a dashboard to SmartTiles as a web link. Works pretty slick.

Awesome – I actually found a youtube video that goes over a fair amount of what you talked about. Will try to implement these fancy graphs soon! Tks - Derek

1 Like

Hi,

Where can i download the latest code ? I have created my account and have the API key

Want to monitor

  1. Home Enegery using Aeon power module
  2. People presence (currently using our cell phones), will be getting a presence senor soon for the kids and the dog.
  3. Home Temp - Have both a Nest and Ecobee 3 (one on each level)

thanks

im having issues with my version of the app. not sure if its a ST or GS issue. the last 2 weeks, 2 times, my temp feeds have stopped updating into GS. if i go into the smart app and turn off those sensors from logging, and then turn them back on it will start logging again, but then it stopped again last night. its quite possible its something im doing wrong as well.

I really like the visualization, since I have set this up, I have been able to reduce my electric use by around 5 percent by watching trends.

I found another Thread where Netatmo wasnt updating, which are the sensors that are not feeding into GS, so that appears to be the issue.

so many flaky things not reporting consistently are keeping me from getting to the point where I want to be. my kwikset lock will only update as locked once a week maybe, and I still cannot get my nest to work on ST, and I havent been able to log C02 levels in my house to GS.

The issue seems to be that the scheduler stops for some reason. Updating the app like that creates a new scheduler, which runs for another 6 - 24 hours.

The process to transmit readings to GroveStreams is called by that scheduler every few minutes - when that stops, the readings build up in the smart app, but are never transferred.

I’ve come up with a workaround where I added a counter to the event handler - if that counter reaches 11 (high enough that it would never happen when the scheduler is working), I initiate the processQueue event and send the readings.

I may remove the scheduler entirely, since it’s wholy unreliable. Mine has managed to stay running less than 1 day at a time for the last week or so.

Here is my update to the original logging to GroveStreams smart app:

/**
  • GroveStreams
  • Copyright 2014 Jason Steele
  • 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.

*/
definition(
name: “GroveStreams”,
namespace: “JasonBSteele”,
author: “Jason Steele”,
description: “Log to GroveStreams”,
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(“Log devices…”) {
input “temperatures”, “capability.temperatureMeasurement”, title: “Temperatures”, required:false, multiple: true
input “contacts”, “capability.contactSensor”, title: “Doors open/close”, required: false, multiple: true
input “accelerations”, “capability.accelerationSensor”, title: “Accelerations”, required: false, multiple: true
input “motions”, “capability.motionSensor”, title: “Motions”, required: false, multiple: true
input “presence”, “capability.presenceSensor”, title: “Presence”, required: false, multiple: true
input “switches”, “capability.switch”, title: “Switches”, required: false, multiple: true
}

section ("GroveStreams Feed PUT API key...") {
    input "channelKey", "text", title: "API key"
}

}

def installed() {
initialize()
}

def updated() {
unsubscribe()
unschedule()
log.debug "Attempted to Unschedule"
if (canSchedule()) {log.debug “all unscheduled.”}
else {log.debug “still waiting for unschedule.”}

initialize()

}

def initialize() {
subscribe(temperatures, “temperature”, handleTemperatureEvent)
subscribe(humidities, “humidity”, handleHumidityEvent)
subscribe(contacts, “contact”, handleContactEvent)
subscribe(accelerations, “acceleration”, handleAccelerationEvent)
subscribe(motions, “motion”, handleMotionEvent)
subscribe(presence, “presence”, handlePresenceEvent)
subscribe(switches, “switch”, handleSwitchEvent)
subscribe(batteries, “battery”, handleBatteryEvent)
state.queueCount = 0
state.queue = []
runEvery5Minutes(processQueue)
}

def handleTemperatureEvent(evt) {
queueValue(evt) { it.toString() }
}

def handleHumidityEvent(evt) {
queueValue(evt) { it.toString() }
}

def handleBatteryEvent(evt) {
queueValue(evt) { it.toString() }
}

def handleContactEvent(evt) {
queueValue(evt) { it == “open” ? “true” : “false” }
}

def handleAccelerationEvent(evt) {
queueValue(evt) { it == “active” ? “true” : “false” }
}

def handleMotionEvent(evt) {
queueValue(evt) { it == “active” ? “true” : “false” }
}

def handlePresenceEvent(evt) {
queueValue(evt) { it == “present” ? “true” : “false” }
}

def handleSwitchEvent(evt) {
queueValue(evt) { it == “on” ? “true” : “false” }
}

private queueValue(evt, Closure convert) {
def jsonPayload = [compId: evt.displayName, streamId: evt.name, data: convert(evt.value), time: now()]
log.debug “Appending to queue ${jsonPayload}”

state.queue << jsonPayload

state.queueCount = state.queueCount + 1
log.debug "Current queueCount = ${state.queueCount}"
if(state.queueCount > 10){
	processQueue()
	}

}

def processQueue() {
def url = "https://grovestreams.com/api/feed?api_key=${channelKey}"
log.debug "processQueue"
if (state.queue != []) {
log.debug “Events: ${state.queue}”

    try {
        httpPutJson([uri: url, body: state.queue ]) { 
            response -> 
            if (response.status != 200 ) {
                log.debug "GroveStreams logging failed, status = ${response.status}"
            } else {
                log.debug "GroveStreams accepted event(s)"
                state.queue = []
                state.queueCount = 0
            }
        }
    } catch(e) {
        def errorInfo = "Error sending value: ${e}"
        log.error errorInfo
    }
}

}

2 Likes

I see this behavior all over my apps which used time events at regular intervals; from what I see, it looks like an issue with ST backend; I’m working with support about that, but you may want to let them know as well, so that they realize I’m not the (only) one being crazy…

1 Like