Particle IO Bridge OpenClose

Trying to get the Particle IO Bridge feature to be able to open or close my garage door with Alexa. I put the light-on-off on Photon and Alexa, but want to be able to say “Open” or “Close” in the command to Alexa, but get error when compiling, it worked fine with the OnOff, here is the error.

light_on_off.ino:21:9: ‘class EchoPhotonBridge’ has no member named ‘addEchoDeviceV2OpenClose’

Here is my code, I just commented out the OnOff ones and changed to OpenClose.


// This #include statement was automatically added by the Particle IDE.
#include <EchoPhotonBridge.h>


EchoPhotonBridge epb;

//function OnOff - this turns a device on or off
//int functionOnOff(int device, bool onOff, String rawParameters)
int functionOpenClose(int device, bool OpenClose, String rawParameters)
{   
    //digitalWrite(D7, (onOff) ? HIGH : LOW);
    digitalWrite(D7, (OpenClose) ? HIGH : LOW);
}

//  REMINDER: Tell your echo, "Alexa, Discover Devices" after you program your photon so Amazon picks it up.

void setup()
{
    pinMode(D7, OUTPUT);
    //epb.addEchoDeviceV2OnOff("Photon Light", &functionOnOff);
    epb.addEchoDeviceV2OpenClose("Garage door", &functionOpenClose);
}

void loop() 
{
  
}

I have the garage door working with ifttt, but have to say “trigger garage door”, would like to be able to say open or close, and for Alexa to know if the door is open or closed.

Does anyone see what I have wrong?

Hi @dhall419

I fixed the code formatting in your post. Just use three back-quotes on a line by themselves to get “code” formatting.

```
code here
```

As to your question: how are you compiling? Using the CLI or the Atom-based Dev? I ask because it seems like maybe you are missing the included library. Did you copy the file to a new project? Is your Particle Dev pointed to the right directory?

2 Likes

Obviously this version of the library doesn’t support the OpenClose skill.
These seem to be the only V2 functions it supports

        void addEchoDeviceV2OnOff(String deviceName, functionOnOff fOnOff);
        void addEchoDeviceV2Percent(String deviceName, functionPercent fPercent);
        void addEchoDeviceV2Color(String deviceName, functionColor fColor);
        void addEchoDeviceV2Lock(String deviceName, functionLock fLock);
        void addEchoDeviceV2Temp(String deviceName, functionTemp fTemp);
        void addEchoDeviceV2LightTemp(String deviceName, functionLightTemp fLightTemp);
1 Like

I am compiling in Particle Build, maybe is not the correct term.

Thanks ScruffR, how did you pull up the library to be able to see it?

When you are using Particle Build (Web IDE) you need to select the library in the library flyout (bookmark icon).
When you click on the library you see the respective files listed and selecting one of them shows the contents of that file in the code view pane.

You can also click on the GitHub icon bellow the library name to get to the GitHub repo for it and file issues or feature requests there.

2 Likes