[SOLVED] HTTP API Button Switch (control pin on ESP8266)

I’m trying to send the equivalent of a Button/Switch via the HTTP API. I can successfully get the pin to go high, but it immediately returns low. Is there an option to the Set function I am missing? If I read the pin back, it says High even though the actual hardware pin is Low.
Board: LinkSprite LinkNode R4 (using ESP8266 generic)

Sample code for making the pin stay high appreciated.

Something to note here is that I created a Blynk app which works perfectly. Relays stay on until switched off.

Hello. What do you mean by

?

The ESP8266 pin is connected to a relay. The relay turns on and immediately off when sent a /pin/value=1 from the HTTP interface. When sent from a Button/Switch in Blynk app, it stays on. For example… pin=Low, send HTTP value=1, pin=High, pin=Low, HTTP get/pin returns High, yet pin is low and relay is off. I’m wondering if there is a ‘Hold High’ or ‘Switch’ option to the HTTP API that I don’t see. How does the Android app tell the server the difference between Button/Push and Button/Switch?

Please show URL you are using.

http://blynk-cloud.com/(auth-token)/update/d6?value=1
with the auth-token from my email for this project.

Do you have any widget on that pin? Is that pin PWM?

I do have a widget on it, a Button / Switch set to digital / gp12. Is it possible that having an app widget is interfering with the HTTP API calls? The app works perfectly as is, but I need to control from another device (non-Blynk capable(? windows), so I was going to use the http api).

As for PWM, I’m not sure. 8266 is pretty new for me. It is ESP8266-12. I need to control the relays on the board referenced here -> http://linksprite.com/wiki/index.php5?title=LinkNode_R4:_Arduino-compatible_WiFi_relay_controller

Yes. That could be a case. We need to double check that.

The phone app was not running when I was trying. But I went ahead and removed the button widget entirely from my phone app, resent the http call, and it did the same thing. Relay engaged, and immediately disengaged.

This is because gp12 is PWM pin and it is handled differenlty in app.

Is it possible to set/reset them from the HTTP API then?

Have you tried removing the button from the app to see if the problem persists?

Yes, problem persisted.

Is your button has default settings? Or you changed there something? Also you said gp12, but using D6?

Button Widget changes = renamed it, set to gp12, and made it Switch instead of Push.

I used D6 in HTTP API call because it says gp12 is ‘Wrong pin format.’

I got all 4 relays working fine in the app using button widgets on gp12, gp16, gp14, and gp13.

But why not D12?

Can you post your code? Or are you just running the standalone code?

I just tried to use the HTTP API commands to turn on a relay at my house (a first for me). It seems to have worked OK (or so it seems). I am using and NodeMCU DEV Board with one of those single relay boards. The relay is controlling the water spigot for my dogs water bowl (hopefully i dont come home to a flooded backyard). It even updates the status of the button widget in the APP.

Using d12, d16, d14, and d13 fixed it. Not sure why I hadn’t tried that. It works correctly with the app now as well. Buttons in app update when HTTP sets values.
Thank you very much!

Awesome! Glad to hear it is working. Your code is no longer needed.