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 "esp_camera.h"
|
||||
#include <WiFi.h>
|
||||
#include <WiFiAP.h>
|
||||
|
||||
// ===========================
|
||||
// Select camera model in board_config.h
|
||||
@@ -11,8 +10,8 @@
|
||||
// ===========================
|
||||
// Enter your WiFi credentials
|
||||
// ===========================
|
||||
const char *ssid = "42";
|
||||
const char *password = "python2.7";
|
||||
const char *ssid = "TT";
|
||||
const char *password = "Python2.7";
|
||||
|
||||
void startCameraServer();
|
||||
void setupLedFlash();
|
||||
@@ -109,31 +108,22 @@ void setup() {
|
||||
setupLedFlash();
|
||||
#endif
|
||||
|
||||
//WiFi.begin(ssid, password);
|
||||
//WiFi.setSleep(false);
|
||||
WiFi.begin(ssid, password);
|
||||
WiFi.setSleep(false);
|
||||
|
||||
//Serial.print("WiFi connecting");
|
||||
//while (WiFi.status() != WL_CONNECTED) {
|
||||
// delay(500);
|
||||
// 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);
|
||||
Serial.print("WiFi connecting");
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
IPAddress myIP = WiFi.softAPIP();
|
||||
Serial.print("AP IP address: ");
|
||||
Serial.println(myIP);
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
|
||||
startCameraServer();
|
||||
|
||||
Serial.print("Camera Ready! Use 'http://");
|
||||
Serial.print(WiFi.softAPIP());
|
||||
Serial.println("' to connect");
|
||||
Serial.print("Camera Ready! Stream at 'http://");
|
||||
Serial.print(WiFi.localIP());
|
||||
Serial.println(":81/stream'");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in New Issue
Block a user