Hello, my small HA setup is battery powered with a solar panel. I’ve 3 ESP32cam connected but I would like to spare some energy using deep sleep feature. The idea is to put 3 cameras in deep sleep during the night (from 19:00 to 09:00) Reading several posts, it seams that MQTT is mandatory and API configuration needs to be removed.
There is someone that can provide me a configuration example?
Many thanks in advance.
Here my current config file:
substitutions:
hostname: "gnc"
camname: "gnc"
esphome:
name: $hostname
friendly_name: $hostname
#on_boot:
# - lambda: |-
# id(my_ota).set_auth_password("xxxxx");
esp32:
board: esp32cam
framework:
type: arduino
logger:
# level: very_verbose
api:
encryption:
key: !secret api_key
services:
- service: camera_set_param
variables:
name: string
value: int
then:
- lambda: |-
bool state_return = false;
if (("resolution" == name) && (value >= 0U) && (value <= 17U)) { id($camname).set_frame_size((esphome::esp32_camera::ESP32CameraFrameSize)value); state_return = true; }
if (("vertical_flip" == name) && (value >= 0) && (value <= 1)) { id($camname).set_vertical_flip(value); state_return = true; }
if (("horizontal_mirror" == name) && (value >= 0) && (value <= 1)) { id($camname).set_horizontal_mirror(value); state_return = true; }
if (("contrast" == name) && (value >= -2) && (value <= 2)) { id($camname).set_contrast(value); state_return = true; }
if (("brightness" == name) && (value >= -2) && (value <= 2)) { id($camname).set_brightness(value); state_return = true; }
if (("saturation" == name) && (value >= -2) && (value <= 2)) { id($camname).set_saturation(value); state_return = true; }
if (("special_effect" == name) && (value >= 0U) && (value <= 6U)) { id($camname).set_special_effect((esphome::esp32_camera::ESP32SpecialEffect)value); state_return = true; }
if (("aec_mode" == name) && (value >= 0U) && (value <= 1U)) { id($camname).set_aec_mode((esphome::esp32_camera::ESP32GainControlMode)value); state_return = true; }
if (("aec2" == name) && (value >= 0U) && (value <= 1U)) { id($camname).set_aec2(value); state_return = true; }
if (("ae_level" == name) && (value >= -2) && (value <= 2)) { id($camname).set_ae_level(value); state_return = true; }
if (("aec_value" == name) && (value >= 0U) && (value <= 1200U)) { id($camname).set_aec_value(value); state_return = true; }
if (("agc_mode" == name) && (value >= 0U) && (value <= 1U)) { id($camname).set_agc_mode((esphome::esp32_camera::ESP32GainControlMode)value); state_return = true; }
if (("agc_value" == name) && (value >= 0U) && (value <= 30U)) { id($camname).set_agc_value(value); state_return = true; }
if (("agc_gain_ceiling" == name) && (value >= 0U) && (value <= 6U)) { id($camname).set_agc_gain_ceiling((esphome::esp32_camera::ESP32AgcGainCeiling)value); state_return = true; }
if (("wb_mode" == name) && (value >= 0U) && (value <= 4U)) { id($camname).set_wb_mode((esphome::esp32_camera::ESP32WhiteBalanceMode)value); state_return = true; }
if (("test_pattern" == name) && (value >= 0U) && (value <= 1U)) { id($camname).set_test_pattern(value); state_return = true; }
if (true == state_return) {
id($camname).update_camera_parameters();
}
else {
ESP_LOGW("esp32_camera_set_param", "Error in name or data range");
}
ota:
platform: esphome
password: !secret ota_password
id: my_ota
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: $hostname Fallback Hotspot
password: !secret fallback_ap_psw
captive_portal:
esp32_camera:
id: $camname
name: Camera
external_clock:
pin: GPIO0
frequency: 8MHz
i2c_pins:
sda: GPIO26
scl: GPIO27
data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
vsync_pin: GPIO25
href_pin: GPIO23
pixel_clock_pin: GPIO22
power_down_pin: GPIO32
# orientation
horizontal_mirror: false
vertical_flip: false
resolution: 1024x768
# esp32_camera_web_server:
# - port: 8080
# mode: stream
# - port: 8081
# mode: snapshot
button:
- platform: restart
name: Restart
binary_sensor:
- platform: status
name: Status
sensor:
- platform: wifi_signal
name: WiFi Signal db
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: copy
source_id: wifi_signal_db
name: WiFi Signal Percent
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: Signal %
entity_category: "diagnostic"
output:
- platform: ledc
channel: 2
pin: GPIO4
id: espCamLED
- platform: gpio
pin:
number: GPIO33
inverted: True
id: gpio_33
light:
- platform: monochromatic
output: espCamLED
name: Flash LED
- platform: binary
output: gpio_33
name: Red LED