Binding Request: Particle Photon API

I have been putting together a garage control setup using the Particle Photon wifi enabled programmable board ($19us).

Particle Photon

I have this connected to my Chamberlain MYQ push button control (not via MYQ) and have setup a switch to monitor Open and Closed state of the door. For the most part, everything is working well. However, I had to use some workarounds such as using executeCommandLine and a .bat file to send the curl command to the particle api to operate the garage button function. I was not able to get the syntax to work properly for the http or exec functions (may just be my ignorance here).

Also, for monitoring the switch state variable, the response on the http request was coming back with invalid responses (assuming a parsing issue with the response structure from the particle api). I am currently attempting to use IFTTT with the particle api and openhab. Unfortunately, IFTTT is firing both my rules (one for switch state of 0 and one for switch state of 1) at the same time. I currently have a support request in with IFTTT.

With all of that said, I would like to request a binding be developed for the Particle API. The Photon is a great little device with the functionality of an arduino type board with wifi access. Having a direct Particle api interface in openhab would be wunderbar!

Here is a link to the Particle Cloud API documentation:
Particle Cloud API


A Particle binding would be nice.

I have a Particle Core (the Photons predecessor) and I use it as a doorbell sensor. And I use the MQTT protocol to push the status change to OpenHAB. Works pretty well, I can post the code if you want.

Yes please, i have mosquitto running, so should be able integrate easily.


The code in

I’ve included the DHT (sounddetector) and MQTT libraries.

// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"

// This #include statement was automatically added by the Spark IDE.
#include "MQTT/MQTT.h"

// Read LM393 sound detector on port A0
// Rest call on sound detected

#define DHTTYPE DHT11		// DHT 11 

//register callback
void callback(char* topic, byte* payload, unsigned int length);

// variable to store the result of sound detected
bool sound = false;
double tempC = 0;

// connectionstring for mqtt
byte server[] = { 192,168,1,9 };
MQTT client(server, 1883, callback);

void setup() {
    //the module is connected to A0
    pinMode(A0, INPUT);
    // connect to the mqtt server

void loop() {
    int reading = analogRead(A0);
    if (client.isConnected()) {
    else {

    if(reading < 4000) 
        if (client.isConnected()) {
            //mqtt publish

// recieve message but do nothing, the only use publish, not subscribe
void callback(char* topic, byte* payload, unsigned int length) {

In my .items
Switch Doorbell_Event “Doorbell” (gGroundFloor) { mqtt="<[local:/home/doorbell:command:ON]" }

And a rule

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
rule "NotifyOnDoorbell"
	Item Doorbell_Event changed from OFF to ON
	sendNotification("", "Doorbell has rung")
	sendNotification("", "Doorbell has rung")
	//turn doorbell off a bit later to prevent duplicate notifications
	timer = createTimer(now.plusSeconds(4)) [|
                sendCommand(Doorbell_Event, OFF)
1 Like

Thanks, i was able to use a modified version of this approach to update the status correctly via mqtt. I did notice that the runtime busevents spews out the state from the mqtt multiple times a second. I am assuming this is a non-issue.

I have not received a response from IFTTT, so it is nice to have a solution that is not dependent on IFTTT.

Still would be nice to have a direct binding for the Particle API.


The OAuth2 part of their API is similar to what the Ecobee API does, and there are probably other similarities to that or the Nest binding. I would try to build a Particle Cloud binding if I had the hardware. But is using MQTT instead on the local network a simpler solution with the same potential benefits? (I.e., which is “better” integration?)

I think for status updates, yes, i would agree that MQTT locally works well. To your point, the particle api has some limitations on the number of “cloud” variables, so locally managing is better. For the function calls, I am currently using a curl command to the particle api initiated from a .bat file. I would like local control here as well. There are particle libraries for a rest server, but have not dedicated the time yet to try and get that working.

For out of the box, a direct api would be helpful. I might take a look at the Ecobee API and see if it may be a good opportunity to try my hand at building a binding.