Foobot, BlueAir air purifier integration scripts & rules

As there isn’t (yet) a Binding for foobot or Blue Air air purifiers, I’ve tweaked some JS code and implemented some Exec Things and related Items / Rules to implement a few features using the REST API.

Using this method, I’m now cranking up the fan speed of the purifier when no-one is home or in the room and then bringing it down when people are around (I have some motion sensors to detect this).

Sharing it here in case anyone else has an interest or similar need. Enjoy.



Trying this with openHAB 2.5 running on Synology NAS (that does not support Docker), and troubleshooting gives me the following results:

root@synology:/volume1/public/openHAB/conf/scripts/node_modules/openhab-blueair# /usr/local/bin/node index.js <mac removed> info
Polled API:<email removed>/homehost/
Got home
Polled API:<email removed>/login/
Logged in to API
Got token: undefined
Polled API:<email removed>/device/
Total number of devices found: undefined
Trying to identify using Mac address: <mac removed>
                            var device = json.filter(function(item) {

TypeError: json.filter is not a function
    at BlueAirDevice.<anonymous> (/volume1/public/openHAB/conf/scripts/node_modules/openhab-blueair/blueair.js:173:47)
    at BlueAirDevice.<anonymous> (/volume1/public/openHAB/conf/scripts/node_modules/openhab-blueair/blueair.js:68:17)
    at Request.self.callback (/volume1/public/openHAB/conf/scripts/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/volume1/public/openHAB/conf/scripts/node_modules/request/request.js:1154:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/volume1/public/openHAB/conf/scripts/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:313:30)

I replied in your DM as well, but for others… it appears that at some stage Blueair divorced themselves from the foobot infrastructure, which foobot confirmed when I emailed them. Probably something related to their move into AWS.

When they did so, the URL for the API changed. I’ve been able to work out what the change was and now have this working again. In short, the API that was reachable on is now (for Blueair devices) available at

One small change to my node script will fix this to be functional again. I’ll update the repo in the coming days with this change.

Thanks for the info! Nowadays I’m running openHAB 3.2 on Docker, so the first question would be if your binding works in 3.2? E.g. there’s no scripts-directory (if the exact location matters)

I’m running 3.2 and have a scripts directory? We’re currently renovating so I don’t have everything currently running - but I’m certain this was still running correctly when I upgraded.

Installed the binding successfully, but some issues remain. I’m able to get valid status information when I run “index.js 0 info” from the command line (debug on), but in the UI there are only null values?

Have to admit that I’m not very familiar with openHAB “native” usage, as I’ve only used REST API in the past, querying values outside openHAB.

Make sure you turn OFF debug again in the script. It’ll mess up functioning from OpenHAB.

You should be seeing something like this:

Here’s what my Thing settings look like:

Hope that helps

Debug is off, but still not seeing the same info on UI, my config below:

Btw, about your installation instructions where you point to Items, there’s e.g. “…exec:command:f0ad9cd4…” string that I assume should reflect the identifier shown on openHAB UI. Just something you could clarify on those instructions.