GroveStreams SmartApp

I finally made the smartthings & grovestreams integration work (which is awesome) so thanks to you all.
I am a little stuck on 2 items.
I tried to add some line to create additional preferences like suggested above. Not working for me.
I tried to get the CO2 level for the netatmo station and the Tstat status for the Nest. For nest I think it is hvac_ac_state instead of thermostatoperating state I see in my items from the device type logging. No luck (I first copied the lines above and modified…)
For CO2 on the log I get :
[time_utc:1444490185, AbsolutePressure:1008.2, Temperature:19.8, Noise:56, min_temp:19.1, CO2:613, Humidity:68, date_min_temp:1444476282, Pressure:1012, max_temp:20.1, date_max_temp:1444449745]
Any suggestions?
Thanks a lot

1 Like

I too, am trying to plot my thermostat status on my grove streams. I’ve tried all the above suggestions. I looked at Yves Racine’s smart app and I’ve added the relevant Thermostat code to my smart app…I can now see Thermostats listed in my SmartApp on my phone and I can select my z-wave thermostat. But I don’t see any components available for data streaming in Grovestreams. Any ideas?

NathalieA, how did you determine your thermostat used hvac_ac_state instate of thermostatoperating state?
Thanks everybody.

Ok. I answered part of my question. I looked in the Device list on my graph.smarthings page and found temperature: 76.0 F
heatingSetpoint: 72 F
coolingSetpoint: 76 F
thermostatSetpoint: 72 F
thermostatMode: auto
thermostatFanMode: fanAuto
thermostatOperatingState: idle
thermostatFanState: idle
for my thermostat. And instead of idle the other two options are heating and cooling.

I’m still not getting any streams available for the thermostat other than temperature. Any ideas?

here is my code so far;

/**

  • 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
input “powers”, “capability.powerMeter”, title: “Power Meters”, required:false, multiple: true
input “energys”, “capability.energyMeter”, title: “Energy Meters”, required:false, multiple: true
input “thermostats”, “capability.thermostatOperatingState”, title: “Thermostat Operating States”, required:false, multiple: true
input “thermostats”, “capability.thermostat”, title: “Thermostats”, required: false, multiple: true
}

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

}

def installed() {
initialize()
}

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

def initialize() {
subscribe(temperatures, “temperature”, handleTemperatureEvent)
subscribe(contacts, “contact”, handleContactEvent)
subscribe(accelerations, “acceleration”, handleAccelerationEvent)
subscribe(motions, “motion”, handleMotionEvent)
subscribe(presence, “presence”, handlePresenceEvent)
subscribe(switches, “switch”, handleSwitchEvent)
subscribe(powers, “power”, handlePowerEvent)
subscribe(energys, “energy”, handleEnergyEvent)
subscribe(thermostats, “thermostatOperatingState”, handleThermostatOperatingStateEvent)
subscribe(thermostats, “heatingSetpoint”, handleHeatingSetpointEvent)
subscribe(thermostats, “coolingSetpoint”, handleCoolingSetpointEvent)
subscribe(thermostats, “thermostatMode”, handleThermostatModeEvent)
subscribe(thermostats, “fanMode”, handleFanModeEvent)

}

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

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

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

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

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

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

def handlePowerEvent(evt) {
sendValue(evt) { it.toString() }
}

def handleEnergyEvent(evt) {
sendValue(evt) { it.toString() }
}

def handleHeatingSetpointEvent(evt) {
queueValue(evt) {
it.toString()}
}
def handleCoolingSetpointEvent(evt) {
queueValue(evt) {
it.toString()
}
}

def handleThermostatModeEvent(evt) {
queueValue(evt) {
it.toString()
}
}
def handleFanModeEvent(evt) {
queueValue(evt) {
it.toString()
}
}
def handleThermostatOperatingStateEvent(evt) {
queueValue(evt) {
it == “idle” ? 0 : (it == ‘cooling’) ? 1 : (it == ‘heating’) ? 2 : 3
}
}
private sendValue(evt, Closure convert) {
def compId = URLEncoder.encode(evt.displayName.trim())
def streamId = evt.name
def value = convert(evt.value)

log.debug "Logging to GroveStreams ${compId}, ${streamId} = ${value}"

def url = "https://grovestreams.com/api/feed?api_key=${channelKey}&compId=${compId}&${streamId}=${value}"

def putParams = [
    uri: url,
    body: []
]

httpPut(putParams) { 
    response -> 
    if (response.status != 200 ) {
        log.debug "GroveStreams logging failed, status = ${response.status}"
    }
}

}

@ehaseltine My schedule has stopped working too. Any ideas on how to keep in going?

Hi, I added new features to my groveStream smartapp:

  1. You just need to press the ‘arrow’ (appTouch) to reschedule the smartapp (under My Home/smartapps in the ST app)

  2. Added an additional check to queueValue() method as the ST backend has started to
    throw StateCharacterLimitExceededException when the queue size is greater than 100000 characters.

See the smartapp at the github:

Regards.

1 Like

Thanks much! Just signed up for grovestreams, using your code and things are, so far, working!

Started using grove streams recently and really like it. I’ve started making my dashboards and I’m trying to figure out how to get a cost per month widget. I found the example to calculate cost using current. I thought I could follow the example and create my own version using power, but I seem to be failing.

Has anyone here created a cost widget using data from a HEM from ST? If so, can you share some instructions?

Or monthly averages?

Anyone else reporting issue with it not logging humidity level? I am not getting humidity with your version of the smartapp. I get the temperature data from the same device just fine.

I think minollo resolved similar issue with humidity in this thread on Jun-12-2015.

but I don’t see the problem in yvesracine app.

Yikes, after just a few days of using this I exceeded the free limits. I’m only sending in one stream of my HEM power use.

seems that even if I went to the personal pricing tier I would exceed their limits.

I end up paying them about 5 bucks a month. Looking to see if i can host my own server to do the logging.

I’m not opposed to paying a reasonable fee, but if one HEM exceeded 5MB in 5 days, that would land me in the business essentials tier before even adding a second device.

$1140 annually seems counter productive to what I’m trying to accomplish. saving money by understanding my electricity use and using it in smarter ways

Hi,

Please grab the latest version at my github.

And, please support the developer with a donation!:grinning:

One HEM data value at once a minute should be well within grovestrems free account limits. Check your transaction management section and see if you have widget polling turned on. That can eat up your data, It is under the top right “Admin” -> “Organization” -> “General Settings” -> “Transaction Management”. Sounds like you are already looking at your usage reports but if not check them and see if your data problem is coming in or out.

Thanks for the tip Jason. It looks like it is the inbound that is the issue.

But I went ahead and stopped all widget polling. the good news is that they unblocked me. I’m not sure why, but they did.

32k transactions is way too high. For example, since Feb 1st I have 3200 transactions. Check that you are queuing up the data in the smartapp before sending it over to grovestreams, by looking in your logging. I recommend queuing up at least 5 minutes worth of data.
As for getting a cost per month stream… I send both power and energy to grovestreams from my HEM. The energy numbers are much easier to use for calculations since the HEM is already keeping a running total of the total energy usage. Once you have energy in grovestreams, add a new stream to your energy meter then in the derivation add max and min on a monthly cycle to get your total usage for the month.

Any chance you would share your app? I’m using the @JasonBSteele app found on their instruction guide.

I am using @yvesracine app that is posted up above… Although it appears to be deleted from github now. I will try to send what I have to you.

All my smartapps are here (except those that I sell at my store):

My store:

http://www.maisonsecomatiq.com/#!store/tc3yr

Regards.

1 Like

I exceeded the monthly allowance of 5MB for a free account… in quite an alarming way. If I wasn’t lucky, I would owe them $80 right now!

I’m using Yves’ SmartApp because it implements the queuing. This is to avoid overhead of individual requests from eating into that monthly allowance.

Sometime in the middle of the night I started getting errors thrown from Grovestreams, such that none of the queue was being uploaded. Everything backed up, and each request kept getting bigger and bigger. Eventually their system noticed and it stopped the uploads. I got a system message:

API Exception: Your GroveStreams account has exceeded the free limits.
Stream data I/O will be blocked until the next billing cycle or a new
pricing plan is selected.

You can configure your payment…

However, it took them a long time to notice. The view from their ‘usage’ page:


It’s a damn good thing I don’t have a payment method on file with them, because this is an overage of 160MB, which would turn into a $80 bill.

Instead, my free account has no ability to upload or graph the data I have for 2 weeks (until the next billing cycle). That’s ok as I was still just playing around with Grovestreams and nothing there was important.

I also did the math; the free plan means the you can only upload about 7000 bytes/hour. You’ll notice I was already exceeding that before this incident. But even if you limit your input to 7000 bytes/hour, you will have no ability to view any graphs of your data, because web site access counts against the 5MB limit.

Since I’m locked out anyway, I’ll spent the next 2 weeks investigating other statistics and visualization tools… without such limits.

Someone at GroveStreams was nice enough to reset my data usage.

Meanwhile, I’ve modified my copy of @yvesracine’s SmartApp to drop the queue even on a PUT error. This will avoid the massive data usage if there is a problem sending an update to GroveStreams.