mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
Added "cam":1 in the discovery message, so that we can create a home assistant camera (#22818)
* Added "cam":1 in the discovery message, so that we can create a home assistant camera. * Update tasmota/tasmota_xdrv_driver/xdrv_12_discovery.ino Co-authored-by: Erik Kunze <eku@users.noreply.github.com> * Rearrange the newly added field by size, for better packing. --------- Co-authored-by: Erik Kunze <eku@users.noreply.github.com>
This commit is contained in:
parent
866ffc8967
commit
5ac1fdb8fe
@ -314,8 +314,9 @@ struct TasmotaGlobal_t {
|
|||||||
bool pwm_present; // Any PWM channel configured with SetOption15 0
|
bool pwm_present; // Any PWM channel configured with SetOption15 0
|
||||||
bool i2c_enabled[2]; // I2C configured for all possible buses (1 or 2)
|
bool i2c_enabled[2]; // I2C configured for all possible buses (1 or 2)
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
bool camera_initialized; // For esp32-webcam, to be used in discovery
|
||||||
bool ota_factory; // Select safeboot binary
|
bool ota_factory; // Select safeboot binary
|
||||||
#endif
|
#endif // ESP32
|
||||||
bool ntp_force_sync; // Force NTP sync
|
bool ntp_force_sync; // Force NTP sync
|
||||||
bool skip_light_fade; // Temporarily skip light fading
|
bool skip_light_fade; // Temporarily skip light fading
|
||||||
bool restart_halt; // Do not restart but stay in wait loop
|
bool restart_halt; // Do not restart but stay in wait loop
|
||||||
|
@ -69,6 +69,7 @@ void TasDiscoverMessage(void) {
|
|||||||
"\"mac\":\"%s\"," // Full MAC as Device id
|
"\"mac\":\"%s\"," // Full MAC as Device id
|
||||||
"\"md\":\"%s\"," // Module or Template Name
|
"\"md\":\"%s\"," // Module or Template Name
|
||||||
"\"ty\":%d,\"if\":%d," // Flag for TuyaMCU and Ifan devices
|
"\"ty\":%d,\"if\":%d," // Flag for TuyaMCU and Ifan devices
|
||||||
|
"\"cam\":%d," // Flag for ESP32-cam
|
||||||
"\"ofln\":\"" MQTT_LWT_OFFLINE "\"," // Payload Offline
|
"\"ofln\":\"" MQTT_LWT_OFFLINE "\"," // Payload Offline
|
||||||
"\"onln\":\"" MQTT_LWT_ONLINE "\"," // Payload Online
|
"\"onln\":\"" MQTT_LWT_ONLINE "\"," // Payload Online
|
||||||
"\"state\":[\"%s\",\"%s\",\"%s\",\"%s\"]," // State text for "OFF","ON","TOGGLE","HOLD"
|
"\"state\":[\"%s\",\"%s\",\"%s\",\"%s\"]," // State text for "OFF","ON","TOGGLE","HOLD"
|
||||||
@ -81,6 +82,11 @@ void TasDiscoverMessage(void) {
|
|||||||
NetworkUniqueId().c_str(),
|
NetworkUniqueId().c_str(),
|
||||||
ModuleName().c_str(),
|
ModuleName().c_str(),
|
||||||
TuyaMod, iFanMod,
|
TuyaMod, iFanMod,
|
||||||
|
#ifdef ESP32
|
||||||
|
TasmotaGlobal.camera_initialized,
|
||||||
|
#else
|
||||||
|
false,
|
||||||
|
#endif
|
||||||
GetStateText(0), GetStateText(1), GetStateText(2), GetStateText(3),
|
GetStateText(0), GetStateText(1), GetStateText(2), GetStateText(3),
|
||||||
TasmotaGlobal.version,
|
TasmotaGlobal.version,
|
||||||
TasmotaGlobal.mqtt_topic,
|
TasmotaGlobal.mqtt_topic,
|
||||||
|
@ -488,7 +488,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||||||
camera_sensor_info_t *info = esp_camera_sensor_get_info(&wc_s->id);
|
camera_sensor_info_t *info = esp_camera_sensor_get_info(&wc_s->id);
|
||||||
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("CAM: %s Initialized"), info->name);
|
AddLog(LOG_LEVEL_INFO, PSTR("CAM: %s Initialized"), info->name);
|
||||||
|
TasmotaGlobal.camera_initialized = true;
|
||||||
|
|
||||||
Wc.up = 1;
|
Wc.up = 1;
|
||||||
if (psram) { Wc.up = 2; }
|
if (psram) { Wc.up = 2; }
|
||||||
|
@ -1151,6 +1151,7 @@ uint32_t WcSetup(int32_t fsiz) {
|
|||||||
camera_sensor_info_t *info = esp_camera_sensor_get_info(&wc_s->id);
|
camera_sensor_info_t *info = esp_camera_sensor_get_info(&wc_s->id);
|
||||||
|
|
||||||
AddLog(LOG_LEVEL_INFO, PSTR("CAM: %s Initialized"), info->name);
|
AddLog(LOG_LEVEL_INFO, PSTR("CAM: %s Initialized"), info->name);
|
||||||
|
TasmotaGlobal.camera_initialized = true;
|
||||||
Wc.up = 1;
|
Wc.up = 1;
|
||||||
if (Wc.psram) { Wc.up = 2; }
|
if (Wc.psram) { Wc.up = 2; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user