Netatmo Monitor App


(Tim Slagle) #1

Here you go everyone. App to monitor and notify for Netatmo Apps. THis is a “beta” please let me know if you see any issues. Thanks!

https://github.com/tslagle13/SmartThingsPersonal/blob/master/smartapps/tslagle13/netatmo-monitor.groovy


SMS Notification from Netatmo's CO2 and Noise sensors
Capability soundPressureLevel
(Andrew Urman) #2

FYI we released this into Labs today.


(Gianluca Nardin) #3

Hey guys, any plan to integrate data from the additional modules?
Thanks!


(Andrew Urman) #4

Eventually!

Big thanks to @Dianoga for rocking this, even after I broke it like…seriously 5 times. :smile:

I think @Dianoga has plans to add additional functionality, but we’ll let him take a break before we start beating down his door.

Also anyone else is welcome to pull down the code and try themselves then resubmit it. #openplatform


#5

Sales for Netatmos…
And Rain Gauge…


(scooter133) #6

Hey Tim. I’ve installed the Netatmo Monitor App and I don’t seem to be getting CO2 Readings out.

At first I was not getting anything out. I left the Frequency blank defaulting to Every Minute, though nothing ever got triggered. I set it to 1 and that seemed to fix the triggering. (Looks like the if (frequency) was stopping it when there was no frequency defined. Looking the the logger I was seeing:

error java.lang.ClassCastException

and

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Long#minus.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.Number] @ line 284

So then I went to debug the NotifyCO routine.

def notifyCO(evt){
log.debug("in notifyCO")
if (allOk){
log.debug("in notifyCO allOk")
if ( sendPushMessageAll != "On" ) {
log.debug("in notifyCO allOk sendPushMessageAll")
if (frequency) {
log.debug("in notifyCO allOk sendPushMessageAll frequency")
	def lastTimeCO = state[frequencyKeyCO(evt)]
    log.debug("in notifyCO allOk sendPushMessageAll frequency def lastTimeCO")
    
	if (lastTimeCO == null || now() - lastTimeCO >= frequency * 60000) {
    log.debug("in notifyCO allOk sendPushMessageAll frequency lastTimeCO == null")
log.debug("netatmo.latestValue carbonDioxide: ")
log.debug(netatmo.latestValue("carbonDioxide"))

log.debug("netatmoCOHigh: ")
log.debug(netatmoCOHigh)

if (netatmo.latestValue("carbonDioxide") > netatmoCOHigh){
log.debug("in notifyCO allOk sendPushMessageAll frequency netatmoCOHigh")

and this is what I get in the Logging. You can see that the log.debug after the compare is never logged.

b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: error java.lang.ClassCastException
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug 2100
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug netatmoCOHigh:
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug 1084
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug netatmo.latestValue carbonDioxide:
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug in notifyCO allOk sendPushMessageAll frequency lastTimeCO == null
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug in notifyCO allOk sendPushMessageAll frequency def lastTimeCO
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug in notifyCO allOk sendPushMessageAll frequency
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug in notifyCO allOk sendPushMessageAll
b193d482-3211-4a27-a771-6ef4df95c1d5  10:04:19 PM PDT: debug in notifyCO allOk

So It looks like the issue is with the compare. This is my real first look at a SmartApp and the Groovy Code, so Its entirely possible I’m not seeing something correctly.

The ‘Ambiguous method overloading for method’ seems to be this line in the Pressure Routine:

if (lastTimePressure == null || now() - lastTimeTemp >= frequency * 60000) {

Looks like its a copy Past Error, it needs to be lastTimePressure, not lastTimeTemp:

if (lastTimePressure == null || now() - lastTimePressure >= frequency * 60000) {

Thanks!


(scooter133) #7

This seemed to Fix the ‘error java.lang.ClassCastException’ for the CO2 and the Noise, Integer.parseInt() around the netatmo.latestValue

if (Integer.parseInt(netatmo.latestValue("carbonDioxide")) > netatmoCOHigh){

I have not been able to Manually triggers the Events, so I’ve just been breathing on it and making noise. Will have to see about the Pressure and Temperature when they happen.


(Roberto Hortal) #8

I get errors with the app. Every time I install it, the alerts I have selected trigger a message regardless of the Netatmo level. Levels are represented correctly in the device tiles in the app.
For a CO2 alert set up at 800, the alert reads: “I detected a CO2 level over null for Station. Current CO2 level is 375.” Looks like the preferences aren’t being saved/accessed corrently.