Hi,
I searched a lot, but found nothing, or I am not able to put the pieces together.
I want to change this parameters by HA and set them persistant.
Is this possible?
Regards
> vertical_flip: true
> horizontal_mirror: false
> resolution: 800X600 # 400x296
> max_framerate: 12 fps
from this declaration
esp32_camera:
name: "${devicename} Kamera"
id: "${devicename_id}_kamera"
external_clock:
pin: GPIO0
frequency: 20MHz
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
vertical_flip: true
horizontal_mirror: false
resolution: 800X600 # 400x296
max_framerate: 12 fps
Olivier1974
(Olivier Toussaint)
January 17, 2023, 8:30pm
2
Not sure to get what you ask, sorry.
You did a configuration in ESPHome, specifying
But you’d like to be able to change those 4 parameters from HA?
YEs i want to change them by a lovalace card switch entity.
I don’t think you can change any of the the parameters you presented at runtime. This configurations are “burned in” to the firmware when compiled.
Olivier1974
(Olivier Toussaint)
January 21, 2023, 3:34pm
5
This is also my feeling. I can’t see a way to do it.
veli
March 9, 2024, 10:58am
6
I don’t think you can change any of the the parameters you presented at runtime. This configurations are “burned in” to the firmware when compiled.
Nope There is an API , for which you can create your device local API and UI configuration. Will write a write-up later. Credit to the API goes to someone else who I forgot, the UI elements are OC by me.
in ESPHome YAML:
api:
id: ${device_name}_api
services: # change camera parameters on-the-fly
- service: camera_set_param
variables:
name: string
value: int
then:
- lambda: |-
bool state_return = false;
if (("contrast" == name) && (value >= -2) && (value <= 2)) { id(${device_name}_camera).set_contrast(value); state_return = true; }
if (("brightness" == name) && (value >= -2) && (value <= 2)) { id(${device_name}_camera).set_brightness(value); state_return = true; }
if (("saturation" == name) && (value >= -2) && (value <= 2)) { id(${device_name}_camera).set_saturation(value); state_return = true; }
if (("special_effect" == name) && (value >= 0U) && (value <= 6U)) { id(${device_name}_camera).set_special_effect((esphome::esp32_camera::ESP32SpecialEffect)value); state_return = true; }
if (("aec_mode" == name) && (value >= 0U) && (value <= 1U)) { id(${device_name}_camera).set_aec_mode((esphome::esp32_camera::ESP32GainControlMode)value); state_return = true; }
if (("aec2" == name) && (value >= 0U) && (value <= 1U)) { id(${device_name}_camera).set_aec2(value); state_return = true; }
if (("ae_level" == name) && (value >= -2) && (value <= 2)) { id(${device_name}_camera).set_ae_level(value); state_return = true; }
if (("aec_value" == name) && (value >= 0U) && (value <= 1200U)) { id(${device_name}_camera).set_aec_value(value); state_return = true; }
if (("agc_mode" == name) && (value >= 0U) && (value <= 1U)) { id(${device_name}_camera).set_agc_mode((esphome::esp32_camera::ESP32GainControlMode)value); state_return = true; }
if (("agc_value" == name) && (value >= 0U) && (value <= 30U)) { id(${device_name}_camera).set_agc_value(value); state_return = true; }
if (("agc_gain_ceiling" == name) && (value >= 0U) && (value <= 6U)) { id(${device_name}_camera).set_agc_gain_ceiling((esphome::esp32_camera::ESP32AgcGainCeiling)value); state_return = true; }
if (("wb_mode" == name) && (value >= 0U) && (value <= 4U)) { id(${device_name}_camera).set_wb_mode((esphome::esp32_camera::ESP32WhiteBalanceMode)value); state_return = true; }
if (("test_pattern" == name) && (value >= 0U) && (value <= 1U)) { id(${device_name}_camera).set_test_pattern(value); state_return = true; }
if (true == state_return) {
id(${device_name}_camera).update_camera_parameters();
ESP_LOGI("esp32_camera", "parameter %s:%d", name.c_str(), (int)value);
}
else {
ESP_LOGW("esp32_camera", "parameter error in name or data range");
}
then in Home Assistant Service call:
service: esphome.camera_set_param
data:
name: contrast
value: 2
1 Like
Apologies for my inexperience here but what sort of construct is this control dashboard? Is this a series of cards that have the service calls behind them (if so, what sort of card allows parameters to be entered and passed in the service call?), is it an automation script? Something else? Just point me in the right direction…