J’ai refait l’installation de ma camera avec le code suivant et j’ai bien les sensors et l’image qui remonte
esphome:
name: poulcam2
friendly_name: Poulcam
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "yyyyyyyyyyyyyyyy"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Poulcam Fallback Hotspot"
password: "p2YkBfT1Yl4v"
captive_portal:
esp32_camera:
name: Poulcam
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
# Image/Video settings, https://esphome.io/components/esp32_camera.html
max_framerate: 25 fps # default: 10 fps, max 60
idle_framerate: 0.2 fps # default: 0.1 fps - framerate for 'picture' in HA dashboard
resolution: 1024x768
jpeg_quality: 10
vertical_flip: False
contrast: 0 # default: 0, variable -2 to 2
brightness: 1 # default: 0, variable -2 to 2
saturation: 0 # default: 0, variable -2 to 2
# Server video/pictures, https://esphome.io/components/esp32_camera_web_server.html
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
time:
- platform: homeassistant
id: homeassistant_time
output:
#flashlight
- platform: gpio
pin: GPIO4
id: gpio_4
#statuslight led 33 for wifi connect
- platform: gpio
pin:
number: GPIO33
inverted: True
id: gpio_33
light:
#flashlight
- platform: binary
output: gpio_4
name: Light
sensor:
- platform: wifi_signal
name: Wifi signal
id: wifi_signal_db
update_interval: 60s
#Reports the WiFi signal strength in %
- 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: "%"
entity_category: "diagnostic"
device_class: ""
- platform: uptime
name: Uptime
#Capteur DHT temperature & humidité
- platform: dht
model: dht22
pin: GPIO15
temperature:
name: Température
humidity:
name: Humidité
update_interval: 60s
text_sensor:
- platform: version
name: ESPHome Version
- platform: wifi_info
ssid:
name: Wifi
switch:
- platform: restart
name: Restart
binary_sensor:
- platform: template
name: "Camera is streaming"
id: cam_streaming
Il me reste un problème à résoudre, ma camera est connecté en usb au PC et fonctionne mais lorsque je l’alimente seulement (via un chargeur usb par ex.) elle est « OFFLINE », mais ce problème n’est pas en lien avec l’objet de cet article donc je vais mener mes recherches pour sa résolution.
Maintenant quand je modifie mon code initial pour implémenter ce qui nous concerne pour activer/désactiver l’IR flash j’ai une erreur de compilation du code (via la fonction « Validate » dans ESPHome), ce qui m’empêche de charger le yaml.
Failed config
ID relay_ir_light redefined! Check light->0->id.
Code :
esphome:
name: poulcam2
friendly_name: Poulcam
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "yyyyyyyyyyyyyyyy"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Poulcam Fallback Hotspot"
password: "p2YkBfT1Yl4v"
captive_portal:
esp32_camera:
name: Poulcam
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
# Image/Video settings, https://esphome.io/components/esp32_camera.html
max_framerate: 25 fps # default: 10 fps, max 60
idle_framerate: 0.2 fps # default: 0.1 fps - framerate for 'picture' in HA dashboard
resolution: 1024x768
jpeg_quality: 10
vertical_flip: False
contrast: 0 # default: 0, variable -2 to 2
brightness: 1 # default: 0, variable -2 to 2
saturation: 0 # default: 0, variable -2 to 2
# Server video/pictures, https://esphome.io/components/esp32_camera_web_server.html
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
time:
- platform: homeassistant
id: homeassistant_time
output:
#flashlight
- platform: gpio
pin: GPIO4
id: gpio_4
light:
#Test IR light
- platform: binary
id: relay_ir_light
output: gpio_4
name: ${friendly_name} flash
sensor:
- platform: wifi_signal
name: Wifi signal
id: wifi_signal_db
update_interval: 60s
#Reports the WiFi signal strength in %
- 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: "%"
entity_category: "diagnostic"
device_class: ""
- platform: uptime
name: Uptime
#Capteur DHT temperature & humidité
- platform: dht
model: dht22
pin: GPIO15
temperature:
name: Température
humidity:
name: Humidité
update_interval: 60s
text_sensor:
- platform: version
name: ESPHome Version
- platform: wifi_info
ssid:
name: Wifi
switch:
- platform: restart
name: Restart
# Test IR light
- platform: gpio
name: "IR Light Switch"
id: relay_ir_light
pin:
number: GPIO2
inverted: False
binary_sensor:
- platform: template
name: "Camera is streaming"
id: cam_streaming
Logs de l’erreur :
INFO ESPHome 2024.4.1
INFO Reading configuration /config/esphome/poulcam2.yaml...
WARNING GPIO0 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/Paris'
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
Failed config
switch.gpio: [source /config/esphome/poulcam2.yaml:125]
platform: gpio
name: IR Light Switch
ID relay_ir_light redefined! Check light->0->id.
id: relay_ir_light
pin:
number: 2
inverted: False
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
ignore_strapping_warning: False
drive_strength: 20.0
disabled_by_default: False
restore_mode: ALWAYS_OFF
interlock_wait_time: 0ms
Avez vous une idée de l’origine du problème ?