1678
|
1 // Auto generated code by esphome
|
|
2 // ========== AUTO GENERATED INCLUDE BLOCK BEGIN ===========
|
|
3 #include "esphome.h"
|
|
4 using namespace esphome;
|
|
5 logger::Logger *logger_logger;
|
|
6 wifi::WiFiComponent *wifi_wificomponent;
|
|
7 ota::OTAComponent *ota_otacomponent;
|
|
8 mqtt::MQTTClientComponent *mqtt_mqttclientcomponent;
|
|
9 using namespace mqtt;
|
|
10 using namespace json;
|
|
11 // ========== AUTO GENERATED INCLUDE BLOCK END ==========="
|
|
12
|
|
13 // camera.cpp
|
|
14 extern void cam_setup();
|
|
15
|
|
16 void setup() {
|
|
17 // ===== DO NOT EDIT ANYTHING BELOW THIS LINE =====
|
|
18 // ========== AUTO GENERATED CODE BEGIN ===========
|
|
19 // async_tcp:
|
|
20 // esphome:
|
|
21 // name: garage_hall_cam
|
|
22 // platform: ESP32
|
|
23 // board: nodemcu-32s
|
|
24 // build_path: garage_hall_cam
|
|
25 // arduino_version: espressif32@1.12.4
|
|
26 // platformio_options: {}
|
|
27 // includes: []
|
|
28 // libraries: []
|
|
29 App.pre_setup("garage_hall_cam", __DATE__ ", " __TIME__);
|
|
30 // logger:
|
|
31 // baud_rate: 115200
|
|
32 // level: DEBUG
|
|
33 // id: logger_logger
|
|
34 // tx_buffer_size: 512
|
|
35 // hardware_uart: UART0
|
|
36 // logs: {}
|
|
37 logger_logger = new logger::Logger(115200, 512, logger::UART_SELECTION_UART0);
|
|
38 logger_logger->pre_setup();
|
|
39 App.register_component(logger_logger);
|
|
40 // wifi:
|
|
41 // domain: ''
|
|
42 // use_address: 10.2.0.74
|
|
43 // id: wifi_wificomponent
|
|
44 // reboot_timeout: 15min
|
|
45 // power_save_mode: LIGHT
|
|
46 // fast_connect: false
|
|
47 // networks:
|
|
48 // - ssid: !secret 'wifi_ssid'
|
|
49 // password: !secret 'wifi_password'
|
|
50 // id: wifi_wifiap
|
|
51 // priority: 0.0
|
|
52 wifi_wificomponent = new wifi::WiFiComponent();
|
|
53 wifi_wificomponent->set_use_address("10.2.0.74");
|
|
54 wifi::WiFiAP wifi_wifiap = wifi::WiFiAP();
|
|
55 wifi_wifiap.set_ssid("...");
|
|
56 wifi_wifiap.set_password("...");
|
|
57 wifi_wifiap.set_priority(0.0f);
|
|
58 wifi_wificomponent->add_sta(wifi_wifiap);
|
|
59 wifi_wificomponent->set_reboot_timeout(900000);
|
|
60 wifi_wificomponent->set_power_save_mode(wifi::WIFI_POWER_SAVE_LIGHT);
|
|
61 wifi_wificomponent->set_fast_connect(false);
|
|
62 App.register_component(wifi_wificomponent);
|
|
63 // ota:
|
|
64 // id: ota_otacomponent
|
|
65 // safe_mode: true
|
|
66 // port: 3232
|
|
67 // password: ''
|
|
68 ota_otacomponent = new ota::OTAComponent();
|
|
69 ota_otacomponent->set_port(3232);
|
|
70 ota_otacomponent->set_auth_password("");
|
|
71 App.register_component(ota_otacomponent);
|
|
72 ota_otacomponent->start_safe_mode();
|
|
73 // mqtt:
|
|
74 // broker: 10.2.0.1
|
|
75 // port: 1883
|
|
76 // username: ''
|
|
77 // password: ''
|
|
78 // id: mqtt_mqttclientcomponent
|
|
79 // discovery: true
|
|
80 // discovery_retain: true
|
|
81 // discovery_prefix: homeassistant
|
|
82 // topic_prefix: garage_hall_cam
|
|
83 // keepalive: 15s
|
|
84 // reboot_timeout: 15min
|
|
85 // birth_message:
|
|
86 // topic: garage_hall_cam/status
|
|
87 // payload: online
|
|
88 // qos: 0
|
|
89 // retain: true
|
|
90 // will_message:
|
|
91 // topic: garage_hall_cam/status
|
|
92 // payload: offline
|
|
93 // qos: 0
|
|
94 // retain: true
|
|
95 // shutdown_message:
|
|
96 // topic: garage_hall_cam/status
|
|
97 // payload: offline
|
|
98 // qos: 0
|
|
99 // retain: true
|
|
100 // log_topic:
|
|
101 // topic: garage_hall_cam/debug
|
|
102 // qos: 0
|
|
103 // retain: true
|
|
104 mqtt_mqttclientcomponent = new mqtt::MQTTClientComponent();
|
|
105 App.register_component(mqtt_mqttclientcomponent);
|
|
106 mqtt_mqttclientcomponent->set_broker_address("10.2.0.1");
|
|
107 mqtt_mqttclientcomponent->set_broker_port(1883);
|
|
108 mqtt_mqttclientcomponent->set_username("");
|
|
109 mqtt_mqttclientcomponent->set_password("");
|
|
110 mqtt_mqttclientcomponent->set_discovery_info("homeassistant", true);
|
|
111 mqtt_mqttclientcomponent->set_topic_prefix("garage_hall_cam");
|
|
112 mqtt_mqttclientcomponent->set_birth_message(mqtt::MQTTMessage{
|
|
113 .topic = "garage_hall_cam/status",
|
|
114 .payload = "online",
|
|
115 .qos = 0,
|
|
116 .retain = true,
|
|
117 });
|
|
118 mqtt_mqttclientcomponent->set_last_will(mqtt::MQTTMessage{
|
|
119 .topic = "garage_hall_cam/status",
|
|
120 .payload = "offline",
|
|
121 .qos = 0,
|
|
122 .retain = true,
|
|
123 });
|
|
124 mqtt_mqttclientcomponent->set_shutdown_message(mqtt::MQTTMessage{
|
|
125 .topic = "garage_hall_cam/status",
|
|
126 .payload = "offline",
|
|
127 .qos = 0,
|
|
128 .retain = true,
|
|
129 });
|
|
130 mqtt_mqttclientcomponent->set_log_message_template(mqtt::MQTTMessage{
|
|
131 .topic = "garage_hall_cam/debug",
|
|
132 .payload = "",
|
|
133 .qos = 0,
|
|
134 .retain = true,
|
|
135 });
|
|
136 mqtt_mqttclientcomponent->set_keep_alive(15);
|
|
137 mqtt_mqttclientcomponent->set_reboot_timeout(900000);
|
|
138 // json:
|
|
139 // =========== AUTO GENERATED CODE END ============
|
|
140 // ========= YOU CAN EDIT AFTER THIS LINE =========
|
|
141 App.setup();
|
|
142 cam_setup();
|
|
143 }
|
|
144
|
|
145 void loop() {
|
|
146 App.loop();
|
|
147 }
|