Project

Algemeen

Profiel

Esphome » Geschiedenis » Versie 3

Micha Kersloot, 27-03-2023 15:36

1 1 Micha Kersloot
h1. Esphome
2
3
h2. TTGO T-Journal
4
5 2 Micha Kersloot
The T-journal is able to communicate the battery state over i2c. After bridging the pads as shown in the picter the IP5306 that is used is connected to pins 13 (scl) and 14 (sda). 
6 1 Micha Kersloot
7 2 Micha Kersloot
!clipboard-202303271732-dyvee.png!
8
9 3 Micha Kersloot
10
working configuration:
11
<pre>
12
substitutions:
13
  device_name: "cam01"
14
15
esphome:
16
  name: '${device_name}'
17
18
esp32:
19
 board: esp32dev
20
 framework:
21
   type: arduino
22
23
# Enable Home Assistant API
24
api:
25
  encryption:
26
    key: "xxxxxxxxxxxx"
27
28
ota:
29
  password: "xxxxxxxxxxxxx"
30
31
wifi:
32
  ssid: !secret wifi_ssid
33
  password: !secret wifi_password
34
35
  # Enable fallback hotspot (captive portal) in case wifi connection fails
36
  ap:
37
    ssid: "cam01 Fallback Hotspot"
38
    password: "xxxxxxx"
39
40
captive_portal:
41
42
external_components:
43
  - source:
44
      type: git
45
      url: https://github.com/MichaKersloot/esphome_custom_components
46
    components: [ ip5306, esp32_camera ]
47
48
i2c:
49
  - id: bus_a
50
    sda: 14
51
    scl: 13
52
    frequency: 400kHz
53
    scan: true    
54
55
ip5306:
56
  battery_level:   # sensor
57
    name: '${device_name} - Battery Level'
58
  charger_connected:  # binary_sensor
59
    id: connected
60
    on_press:
61
      then:
62
        - lambda: ESP_LOGD("TEST", "charging");
63
    on_release:
64
      then:
65
        - lambda: ESP_LOGD("TEST", "not charging");
66
  charge_full:  # binary_sensor
67
    id: full
68
    on_press:
69
      then:
70
        - lambda: ESP_LOGD("TEST", "fully charged");
71
    on_release:
72
      then:
73
        - lambda: ESP_LOGD("TEST", "still charging");
74
75
esp32_camera:
76
  name: '${device_name} - camera'
77
  external_clock:
78
    pin: GPIO27
79
    frequency: 20MHz
80
  i2c_pins:
81
    sda: GPIO25
82
    scl: GPIO23
83
  data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
84
  vsync_pin: GPIO22
85
  href_pin: GPIO26
86
  pixel_clock_pin: GPIO21
87
  agc_gain_ceiling: 8x
88
  # jpeg_quality: 16
89
  # max_framerate: 25Hz
90
  contrast: 0
91
  brightness: 1
92
  saturation: 0
93
  ae_level: 2
94
  # aec2: True
95
  horizontal_mirror: false
96
  vertical_flip: false
97
  resolution: 800x600
98
99
esp32_camera_web_server:
100
  - port: 8080
101
    mode: stream
102
  - port: 8081
103
    mode: snapshot
104
</pre>
105
106
107 2 Micha Kersloot
If you are unable to program:
108
109 1 Micha Kersloot
  python -m esptool --chip esp32 --port COM5 --baud 115200 --after hard_reset erase_flash
110
111 2 Micha Kersloot
and if even that doesn't solve it:
112 1 Micha Kersloot
113
  python -m esptool --port COM5 write_flash_status --non-volatile 0