hugobloem / esp-ha-speech

Local speech recognition on an ESP32 for Home Assistant
142 stars 10 forks source link

Continuous Rebooting #2

Closed dshafik closed 1 year ago

dshafik commented 1 year ago

After making the change in #1 I am able to successfully build using VS Code, and using idf.py build, and then I can flash with VS Code (set to UART mode) or with idf.py -p /dev/cu.usbmodem101 flash and while the flash seems to happen fine, it going into a continuous reboot loop. The main screen comes up, and then after a few seconds it reboots.

I suspect this is an issue with the wifi or bluetooth stack starting up, but it's a complete 100% guess.

dshafik commented 1 year ago

Looking at the "Monitor" function in VSCode, I see this error: E (10350) MN_COMMAND: esp_mn_commands_clear(47): The mn commands is not initialized

justinhunt1223 commented 1 year ago

@dshafik I narrowed this down to an issue with the wifi. I made two changes to the code to get it to stop rebooting. In main/app/app_wifi.c change line 73 from ESP_ERROR_CHECK(esp_wifi_connect()); to ESP_ERROR_CHECK_WITHOUT_ABORT(esp_wifi_connect()); and comment out line 168 //esp_netif_create_default_wifi_ap();

I have it flashed, running, and it at least recognizes the wake word.

dshafik commented 1 year ago

Can confirm I'm in the same place. It's also not possible to connect to the WiFi hotspot created, which is presumably because of the commented out line. Commenting out the line stops the error I mentioned above, which might be because it's trying to register voice commands when none are specified.

justinhunt1223 commented 1 year ago

WiFi is definitely broken using my previous changes. I made some hack changes to app_wifi.c to get it to work, hopefully we can get these resolved. Replace app_wifi.c with the following and set your wifi info at the top:

pastebin

app_src.c line 72 has the list of default commands. Add some of yours in there to test it out. Make sure you update secrets.h with your mqtt/home assistant stuff. I successfully have this connected to my wifi and I can turn on/off my mudroom lights by changing one of the sentences in there to match my house. I need to work on a script to auto publish commands now since I don't want to update this and reprogram changes.

dshafik commented 1 year ago

@justinhunt1223 this works! One change I had to make was that all of the commands in app_sr.c use the ID 0 (third property in the list) so only the last one works. Using this, works:

    {SR_CMD,  SR_LANG_EN, 0, "Turn on the Shapes",  "TkN nN jc sdPS", {NULL}},
    {SR_CMD, SR_LANG_EN, 1, "Turn off the Shapes", "TkN eF jc sdPS", {NULL}},

Now I can control my Nanoleaf Shapes from ESP BOX via Home Assistant!

hugobloem commented 1 year ago

Looking at the "Monitor" function in VSCode, I see this error: E (10350) MN_COMMAND: esp_mn_commands_clear(47): The mn commands is not initialized

This error is more of a warning of that happens during the startup of the speech recognition service and shouldn't be anything to worry about.

I have merged the solution @justinhunt1223 provided and @christian-nils introduced in #7. Thank you all and please let me know if you find other bugs.