[EDGE] PurpleAir Air Quality Edge Driver

Yes - have the same, that is after the recent update to the app, only two lines visible + no html I guess.

Thanks for confirming this also @nullsoul !

@TAustin would you be able to please look into this bug?

There was a purposeful change to the SmartThings app that, for security purposes, disallowed the use of HTML in fields of that nature. It does not change the app functionality, only the display in the device presentation. You can see the complete HTML for that field by clicking on the device on my.smartthings.com

Also, @TAustin hasn’t posted here since April, so you’re unlikely to get a direct response.

3 Likes

@bthrock Thanks for this explanation! No other devs have taken over this project right?

I verified in SmartThings web UI and it shows this for the site field where ā€œSITE_NAMEā€ is the correct name of the sensor site.

<!DOCTYPE html>
<HTML>
<HEAD>
<style>
table, td {
  border: 1px solid black;
  border-collapse: collapse;
  font-size: 14px;
  padding: 3px;
}
</style>
</HEAD>
<BODY>
<table>
<tr><td>SITE_NAME</td></tr>
</table>
</BODY>
</HTML>

Not to the best of my knowledge.

Note that if you’re polling and averaging multiple sensors (as I do), it’s unlikely all the sensor names would fit in the device presentation anyway because of the character limit. Fortunately, I look at that information infrequently, so my.smartthings.com suits my purposes fine.

1 Like

I installed the PurpleAir AQ Edge driver and I am disappointed because it requires cloud/API access to get data from my own local PurpleAir-II device on my own local network. Is there a way you can advise to get this data into SmartThings to perform actions locally? I suspect it probably requires scraping the webpage of the local PurpleAir web server on a polled basis.

Home Assistant integration is cloud-based too, but apparently (some models?) have a local JSON API.

Hello Sean. It’s been a while since I’ve done anything with this driver, but I seem to remember that someone actually did get it to work in a local-only setup. Can you run the Edgebridge server or is that a no-go? If not, I’d have to see what kind of changes to the driver would be needed to directly address your local device.

1 Like

Hello - If you are still around, let me know. I could make a change to the driver to display the site name in that field as simple text instead of an HTML table. As someone had pointed out earlier, HTML tables are no longer displayed in the SmartThings app, although you can sometimes see them in device History, or use the SmartThings Advanced web tool.

The tradeoff we need to consider is that the simple text field in the device controls tab only displays a limited number of characters, so if you are using the search option and getting back several site names, only the first x number of characters will be visible. But it should be ok for simple one-site cases, and you could still inspect device history or through the Advanced web tool to see the full text.

2 Likes

I’m still around, yes. I would like this if possible.

Do you have a pointer to documentation for your local device API? Is it identical to the cloud API - just at a local address?

Hooray, there is a documented way!

OK, Give me a couple days to look at this and get back to you.

OK, so I’ve had a look at this and since the return json data appears to be in a different format, it will require a different parser. In the current driver, the key value used is pm2.5 aqi. I see this local data returns a number of other values, so I’d want to confirm that, or if you’d need the option (in device preferences) to select different values. Also, since your local device has temperature, humidity, dewpoint, and pressure data available, would you want that displayed as well? I think this will warrant a separate driver since much of the code and devices will be different.

All this info would be nice and cool locally. However, I guess I ought to question the need for me personally. What tangible benefits does one get my showing air quality data inside SmartThings? All I can think of, is that if air quality metrics get too high (too much PM2.5 for example), you can have a routine that turns on a light in red color, or sends a message to a user. I guess you could also turn on a fan but in this case my PurpleAir-II is on my roof so air quality outside has little bearing on what is going on inside.

I also want to ask how taxing is it on the SmartThings Hub computing power and available space? Will the device fill up my SmartThings History with a bunch of data that I won’t be able to do much with?

I can’t address the value this would or wouldn’t provided you; depends on your needs!

Regarding being taxing on the hub, this would be a polling driver, so I’d have a device setting to let you adjust how frequent you’d want it to poll. I don’t think there’s any real concern with anything over every few seconds. For purposes of this driver, I would think once every 30 minutes might even be sufficient.

I seem to remember there may be a way to suppress history for a device’s attributes, so that would minimize that concern. I can confirm that.

Let me know what you decide.

@TAustin I’m sorry I missed the notification about your reply. I am still very much interested in this fix if it is possible! I confirmed the bug is still there today. I’m going to be away from home for some time but I can still verify in my SmartThings app to see if it changes. If you make the fix, no change or explicit pull is needed from our side right? The sensor site names are generally short simple text fields.

I have a driver ready for you to try. Can I put it out on a separate channel for you to test before I push to everyone? Wasn’t sure if that was do-able while you are away…

Did you decide you didn’t need this? I had one other person asking for it via github, so please let me know….

@TAustin I can try using a separate channel. Please share the link to the channel and name of the driver as needed.