Open edfrahm opened 4 years ago
@edfrahm, you were pretty much spot on here, the only changes I've made from your suggestions were to update some comments and use subscript for PM₁₀
The only reason I missed this originally is that PM₁₀ data isn't published in my region, so I never saw example data for it. I've committed v1.2, so please go ahead and test. Unfortunately it will only be visible in the SmartThings Classic app which is being sunset very soon, but data should still be visible in WebCore until SmartThings drop support for custom DTHs as well.
James-
Thanks so much for building this DTH. I'm new to SmartThings and deployed this to supplement an in-home sensor I have that only monitors PM2.5 and VOCs. I wanted to pull AirNow data to track PM10 and turn my HVAC fan on under certain conditions using WebCore.
The code you deployed didn't report PM10, but I noticed it was a part of the AirNow API. I'm not a coder, but I copied your syntax and changed the 2.5 references to 10. It appears to be working, but I'd appreciate your more skilled eyes to check it over. Here's the updated code:
/**
*/ metadata { definition (name: "AirNow Virtual Sensor", namespace: "jschlackman", author: "james@schlackman.org") { capability "Sensor" capability "Polling"
}
preferences { input name: "zipCode", type: "text", title: "Zip Code (optional)", required: false input name: "airNowKey", type: "text", title: "AirNow API Key", required: true, description: "Register at airnowapi.org" input name: "distance", type: "number", title: "Max. Observation Distance (miles)", required: false, description: "Default: 25 miles." input name: "about", type: "paragraph", element: "paragraph", title: "AirNow Virtual Sensor 1.1", description: "By James Schlackman james@schlackman.org" }
tiles(scale: 2) {
} }
// Parse events into attributes. This will never be called but needs to be present in the DTH code. def parse(String description) { log.debug("AirNow: Parsing '${description}'") }
def installed() { runEvery1Hour(poll) poll() }
def updated() { poll() }
def uninstalled() { unschedule() }
// handle commands def poll() { log.debug("Polling AirNow for air quality data, location: ${location.name}")
}
def refresh() { poll() }
def configure() { poll() }
private send(map) { //log.debug "AirNow: event: $map" sendEvent(map) }