Closed KonradIT closed 2 years ago
konrad I am able to connect to my camera even if it is turned off this is why i didn't put the _connected = false;
in the turnOff()
function and for the same reason there is the checkConnection()
at the beginning of the turnOn()
Is it possible that newer camera can't connect if they are turned off?
About the WoL did this function worked before? or has stopped working recently? You are using the ESP32 right? because the ESP8266 can't get the BSSID of the gopro camera!
About the mac address I am not sure if the array had to be read from the last item to the first or vice versa, I mean is possible that the library output your gopro mac to be 01:02:03:04:05:06
while really it is 06:05:04:03:02:01
?
Is it possible that newer camera can't connect if they are turned off?
Exactly, HERO3 and HERO3+ respond to requests even if it's off. Not the same for HERO4 and newer, no response from server.
About the WoL did this function worked before? or has stopped working recently?
It worked before but with the correct MAC address from the camera
ESP8266 can't get the BSSID of the gopro camera!
I'm using the ESP32 and also tried this with the ESP8266.
I mean is possible that the library output your gopro mac to be 01:02:03:04:05:06 while really it is 06:05:04:03:02:01?
I'll investigate this afternoon but after a byte-to-byte comparison the bytes are way off.
Exactly, HERO3 and HERO3+ respond to requests even if it's off. Not the same for HERO4 and newer, no response from server.
ohhh that is a pity from gopro it was a nice feature! 😢
I'll investigate this afternoon
first of all try to pass your mac address to the constructor this way the BSSID() function won't be called and we can directly test the sendWoL if the problem is in the BSSID() function that is a problem because we can't do nothing to fix it 😅
printMacAddress
did flip the order lol, corrected.
I can get the camera to wake up with:
byte my_gopro_mac[] = { 0x06, 0x41, 0x69, 0x91, 0x08, 0xBA };
_debug_port->println("Waking up...");
uint8_t preamble[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
IPAddress addr(255, 255, 255, 255);
_udp_client.begin(_udp_port);
_udp_client.beginPacket(addr, _udp_port);
_udp_client.write(preamble, LEN(preamble));
printMacAddress(_gopro_mac);
for (uint8_t i = 0; i < 16; i++)
{
_udp_client.write(my_gopro_mac, LEN(my_gopro_mac));
}
_udp_client.endPacket();
_udp_client.stop();
With my latest fix printMacAddress
prints: 06:41:69:91:08:BA
I need to find a way to convert each unsigned integer into a byte and then add that to a byte array in the correct order.
printMacAddress did flip the order lol, corrected.
loooool ahahhahah this is actually worste that i could immagine because the function that i used cames from Arduino so i guess in arduino boards the bssid is from 5 to 0, but see here what the esp32 folk did, as you can see it is from 0 to 5 😂
For now i would suggest just to revert the order but if what i wrote above is correct I would make a simple function to invert the array when the library is used on arduino boards
I can get the camera to wake up with:
in the code snippet I see that you added your gopro mac, does it work even if you don't declare it? The point would be to get it working without the user writing it and make the library manage this
That's the problem, if I don't declare my_gopro_mac and use _gopro_mac instead it will stop working.
That's the problem, if I don't declare my_gopro_mac and use _gopro_mac instead it will stop working.
well, at this point the problem is not in the function. Does it work if you do:
byte my_gopro_mac[] = { 0x06, 0x41, 0x69, 0x91, 0x08, 0xBA };
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, my_gopro_mac);
with this constructor if you print the debug message (with 'p') after connection it prints your mac?
Do you know how to make WiFi.BSSID()
return a hex array of type byte? So it can be used with the wake on lan function.
That function should already return what we need https://github.com/espressif/arduino-esp32/blob/f8eebb5c3907928d100b3b9d7d0fb0256e1dffa7/libraries/WiFi/src/WiFiSTA.cpp#L521 and it should work because i see the debug message printing a Mac (even if i don t know if that is the correct one because i didn t found an easy way to see it in the hero3)
Edit: remember that in the esp8266 that function won t work as expected
Would this work for the ESP32? Cannot test till Monday.
...
for (uint8_t i = 0; i < 16; i++)
{
_udp_client.write(WiFi.BSSID(), LEN(my_gopro_mac));
}
_udp_client.endPacket();
_udp_client.stop();
No, if it wasn t working before, this version would be the same but slower
konrad I just run a few test and the constructor, macAddress() and BSSID() function work as expected:
SSID: Aster-gopro3
Password: password
Camera: HERO3
IP Address: 0.0.0.0
RSSI: 0 dBm
Attempting to connect to SSID: Aster-gopro3
using password: password
..........
Connected to GoPro
SSID: Aster-gopro3
Password: password
Camera: HERO3
IP Address: 10.5.5.109
RSSI: -12 dBm
Board MAC: B4:E6:2D:89:1A:1D
GoPro MAC: D8:96:85:A1:35:5B
then i tried to pass the gopro mac to the constructor, this way:
byte test [] = {1,2,3,4,5,6};
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, test);
and it was setted correctly:
Board MAC: B4:E6:2D:89:1A:1D
GoPro MAC: 01:02:03:04:05:06
also from the arduino forum confirmed that the mac in arduino are from 5 to 0 (weeeeeird) so i added a function to invert it when the user is using a arduino board
so if you do:
byte my_gopro_mac[] = { 0x06, 0x41, 0x69, 0x91, 0x08, 0xBA };
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, my_gopro_mac);
the library should work.
Then if you don't pass your gopro mac and it doesn't work the possibility are three: the bssid() function return a different mac, it is inverted or I made some error somewhere
Given how printMacAddress
return 06:41:69:91:08:BA
we just need to figure out how to add 0x
to every byte. Weird.
mmm i don't think that this is the problem, the 0x
is only a formatter, see here, same for 0b
so this byte 0xBA is the same to 186 and 0b10111010
I guess that in your python module you wrote the wake on lan, could you give me a link to it?
okkk I was curios about the preamble and the gopro mac repeated 16 times, I definitely need to read more about UDP requests 😅
at this point if this works:
byte my_gopro_mac[] = { 0x06, 0x41, 0x69, 0x91, 0x08, 0xBA };
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, my_gopro_mac);
the problem is outside the sendWoL() but i don't understand where
@KonradIT where you able to turn on HERO4 and later camera with this library? 🤔 I was able to turn on/off my hero3 withou any problem but now i am unable to do the same on the MAX
I am not sure if the problem in sendWol()
or before, actually i think is something related with the esp, because when i turn off the camera i receive this error message
[E][WiFiClient.cpp:232] connect(): connect on fd 60, errno: 118, "Host is unreachable"
so looks like that somehow the esp and the gopro lost connection when the camera is turned off
Also the begin of the connection with the hero3 was far away simpler! I just turned on the wifi and the esp was able to connect immediatly! now it takes a lot more, actually i have the same problem with my mobile phone, not sure if my camera is a little broken 🤔
Weird, I'll try it when I get a chance. Yes, on the MAX you need to send a Bluetooth command that turns WiFi On (https://github.com/KonradIT/goprowifihack/blob/master/Bluetooth/Platforms/ArchLinux.md) to turn on the WiFi AP signal, it's not just turning on Wireless connection.
Ohhhhh finally i understood! This explains why the esp32 can't start the connection directly but I have to use the mobile phone at the same time Unfortunately the Bluetooth is still lacking on stability on the esp platform 😔
Also the max need to get paired? I did it but doesn't seem to improve
The MAX does need to be paired. I'm using a Pi zero and Pi4 to test all the Bluetooth stuff. I also want to try and send commands over the Bluetooth Device Mode (https://www.hackster.io/konraditurbe/using-an-esp32-and-ble-magic-to-avoid-losing-your-gopro-aef0ef), but don't think it's possible to send server to client messages.
Couple of fixes, LMK what you think. Seems that the board ESP32 is reporting the GoPro Mac address wrong since it doesn't match with what I have and also WoL fails.