Hi.
I try to combine some ESPHome code and C++ , but I don’t have enough space on esp32.
So I want to it in C++ , since in this way I can skip OTA and maybe other stuffs which ESPHome include.
AFAIK , EspHome converts its code to C++ and compiles it then.
How can I get C++ source code or maybe conver EspHome to C+ ?
ESPHome can be configured without ota or captive_portal or fallback_wifi and many other things.
Just leave out the key in the YAML code.
If you would post your code it would be much easier to help, some components are very heavy and could make a big difference (web server/captive portal for example).
Now I am curious. What are you doing that you ran out of space? Which space did you run out of?
RAM?
ROM?
How do you know you are out of space?
With an esp8266, I would not be so curious, since it is fairly limited in both RAM and ROM. The esp32 has more of both and I have found it has plenty for many things.
What in esphome do you find so valuable that you aren’t just using platformio directly to program in c/c++?
I use esphome BECAUSE it does a great job with OTA and a decent enough job with everything else that it is worth the trouble to figure out how to create external components.
Which also leads to the question which esp32 you are using (which also would be answered by providing your yaml).
Today you also can get beefy esp32’s with 16MB flash and additional 8MB psram for example
Maybe it ran out of NVS ram.
Happened to me the other day and in reading post on forums it was suggested that my program stored to much information.
I found a little obscure article that said it was because the NVS ram just needed to be cleared, because that did not happen automatically when you flashed code to it.
Trying to out how to clear the NVS ram I was instructed to make a partition file and change the partition from time to time. Also a bit complicated.
In the another article I learnt that a that ESPHome had a function for that. It is called factory reset.
button:
- platform: factory_reset
name: Restart with Factory Default Settings
id: onkyo_factory_reset
entity_category: "diagnostic"
Add this little piece of code, then call it as a button press in HA and NVS ram is cleared.
ESP32-WROOM
I want to implement wi-fi speaker and BT speaker on one esp32.
… share your yaml with us?
Typically this modules (if classic esp32) come without any psram and are a bad choice for audio applications (buffering )
Best would be probably that you give this post a read
Hi.
In EspHome Wi-Fi Speaker (will update later to external DAC) :
esphome:
name: speaker
friendly_name: Speaker
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "ungAC0ZV9WtKRfZm4JDpdvIN2py0rIMmk1EVpGVnEOI="
ota:
- platform: esphome
password: !secret ota_pass
web_server:
port: 80
wifi:
ssid: !secret ssid
password: !secret ssid_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Speaker Fallback Hotspot"
password: "nyR0erergBr"
i2s_audio:
id: bus_i2s
i2s_lrclk_pin: GPIO2 #this GPIO is wasted
i2s_bclk_pin: GPIO3 #this GPIO is wasted
media_player:
- platform: i2s_audio
name: ESPHome I2S Media Player
dac_type: internal
mode: stereo
output:
- platform: esp32_dac
pin: GPIO26
id: dac_output0
- platform: esp32_dac
pin: GPIO25
id: dac_output1
captive_portal:
For BT Speaker I tried this, but I think I need to find something smaller :
#include "AudioTools.h"
#include "BluetoothA2DPSink.h"
AnalogAudioStream out;
BluetoothA2DPSink a2dp_sink(out);
LinearVolumeControl vctrl(true);
void setup() {
a2dp_sink.start("BT_Speaker");
}
void loop() {
}
And from here I want to take only visualization part (Sound to Display Module convert).