working on HA with MPJ camera device
Switch from soft AP mode to WiFi station mode so the ESP32-S3 joins the home network and exposes the MJPEG stream at http://<IP>:81/stream for use with Home Assistant's MJPEG camera integration.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "esp_camera.h"
|
#include "esp_camera.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiAP.h>
|
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Select camera model in board_config.h
|
// Select camera model in board_config.h
|
||||||
@@ -11,8 +10,8 @@
|
|||||||
// ===========================
|
// ===========================
|
||||||
// Enter your WiFi credentials
|
// Enter your WiFi credentials
|
||||||
// ===========================
|
// ===========================
|
||||||
const char *ssid = "42";
|
const char *ssid = "TT";
|
||||||
const char *password = "python2.7";
|
const char *password = "Python2.7";
|
||||||
|
|
||||||
void startCameraServer();
|
void startCameraServer();
|
||||||
void setupLedFlash();
|
void setupLedFlash();
|
||||||
@@ -109,31 +108,22 @@ void setup() {
|
|||||||
setupLedFlash();
|
setupLedFlash();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
//WiFi.setSleep(false);
|
WiFi.setSleep(false);
|
||||||
|
|
||||||
//Serial.print("WiFi connecting");
|
Serial.print("WiFi connecting");
|
||||||
//while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
// delay(500);
|
delay(500);
|
||||||
// Serial.print(".");
|
Serial.print(".");
|
||||||
//}
|
|
||||||
//Serial.println("");
|
|
||||||
//Serial.println("WiFi connected");
|
|
||||||
|
|
||||||
// You can remove the password parameter if you want the AP to be open.
|
|
||||||
// a valid password must have more than 7 characters
|
|
||||||
if (!WiFi.softAP(ssid, password)) {
|
|
||||||
log_e("Soft AP creation failed.");
|
|
||||||
while (1);
|
|
||||||
}
|
}
|
||||||
IPAddress myIP = WiFi.softAPIP();
|
Serial.println("");
|
||||||
Serial.print("AP IP address: ");
|
Serial.println("WiFi connected");
|
||||||
Serial.println(myIP);
|
|
||||||
startCameraServer();
|
startCameraServer();
|
||||||
|
|
||||||
Serial.print("Camera Ready! Use 'http://");
|
Serial.print("Camera Ready! Stream at 'http://");
|
||||||
Serial.print(WiFi.softAPIP());
|
Serial.print(WiFi.localIP());
|
||||||
Serial.println("' to connect");
|
Serial.println(":81/stream'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user