Open nespotts opened 5 years ago
I happen to have a Hero5 and 7 and also do have issues sending commands on ESP8266HTTPClient, try switching to HTTPClient.
Okay, I will try. Did it work for you using HTTPClient? Thanks
Also, which HTTPClient Library are you referring to?
I tried the HttpClient Library by Adrian McEwen, but could not get the code to work, then I tried the ArduinoHttpClient Library and did not have any better luck getting it to work.
https://techtutorialsx.com/2017/05/19/esp32-http-get-requests/
I used an adapted version from that example which worked with my Hero5.
Also just as a heads up there's a C++ library for ESP8266/ESP32: https://github.com/aster94/GoProControl
Hey, thanks for all the help, I'm struggling to get that library to work for an ESP8266 as opposed to the ESP32. Is there any way you could send me the adapted library that worked for you? Thanks.
On a separate note, I have not experimented with your Python API yet. Have you tried using micropython on an esp8266 with your python library to control the cameras (specifically the hero 5)?
Hmm, I did look at MicroPython and even have some source code which should work on my ESP32. I'll see if I can port the gopro-py-api to micropython and make it async when I'm free.
Awesome! Per my first question, do you have a copy of the adapted HttpClient Library that you used? I'm guessing you used it on your ESP32 not an ESP8266 though...
Hi, I still have not figured this out and have been working on this quite a lot. I've been talking with a few developers on the ESP8266 for Arduino Github page #5552, but I haven't reached a solution. The key details that it comes down to is this:
Does that provide any useful insight? I've been working at this for a long time. Any help is greatly appreciated! Thanks
Interesting observation, could it be due to User Agent?
I don’t think that is the issue, originally, I didn’t even specify a user agent. The issue I believe is before the http GET request, in the tcp client or WiFi connection. Unless somehow the user agent specified in the first connection affects future connections to the GoPro.
Hi all, somebody find any solution about this problem. i have the exact problem. But not resolved yet.
I have worked around this issue by changing the MAC address of the ESP8266 to a random one in setup.
Here is the full code that takes a picture every 5 seconds:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include "ChangeMac.hpp"
// Replace these with your WiFi network settings
const char* ssid = "SSID"; //replace this with your WiFi network name
const char* password = "Password"; //replace this with your WiFi network password
void setup()
{
delay(1000);
Serial.begin(115200);
Serial.println(WiFi.macAddress());
WiFi.mode(WIFI_STA);
uint8_t mac[6];
makeRandomMac(mac);
changeMac(mac);
//WiFi.hostname("random1");
WiFi.begin(ssid, password);
Serial.println();
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("success!");
Serial.print("IP Address is: ");
Serial.println(WiFi.localIP());
Serial.print("MAC Address is: ");
Serial.println(WiFi.macAddress());
}
void loop() {
HTTPClient http; //Declare an object of class HTTPClient
WiFiClient wificlient;
http.begin(wificlient, "http://10.5.5.9/gp/gpControl/command/shutter?p=1&c1=restart"); //Specify request destination
int httpCode = http.GET(); //Send the request
if (httpCode > 0) { //Check the returning code
Serial.println(httpCode);
String payload = http.getString(); //Get the request response payload
Serial.println(payload); //Print the response payload
} else {
Serial.println("Error");
Serial.println(http.errorToString(httpCode));
}
http.end(); //Close connection
delay(5000);
}
The ChangeMac.hpp library used is from https://yoursunny.com/t/2017/change-ESP8266-MAC/
Problem:
I having been working with your list of http commands for a GoPro Hero 3+, Hero 4 Session, Hero+ LCD, and now for the Hero 5 Black using an ESP8266 to send the commands. I have had no major problems with the commands for the first 3 cameras, but I am having issues with the GoPro Hero 5 Black. It is probably something simple, but the client connection works and the commands work right after the connections have been reset on the camera, but if the ESP8266 is reset after a first connection, it connects to the WiFi fine, but all http requests return a -1 HTTP Code and fail to connect.
I've tried calling client.flush() and just about anything else I can think of. The only way to make the commands work again is to reset the connections on the camera. If I connect using my computer, I have not problem sending the commands from Chrome. Any help would be appreciated! Thanks
Details:
Here is the simplest code I wrote to replicate the problem (using Visual Studio Code and Platformio):