martgras / LukeRobertsControl

A gateway to control a Luke Roberts Lamp using http, mqtt or a rotary switch
MIT License
13 stars 2 forks source link

MQTT not working anymore #7

Open mikekuss opened 10 months ago

mikekuss commented 10 months ago

Hello,

first of all thank you for creating this project! I hope this repo is still maintained. I am trying to set it up to use it with MQTT and Homeassistant, but MQTT keeps failing on me when trying to connect:

I checked out the repo in vscode and installed pio. I needed to fix a few things to get it to compile correctly like changing some logs from ESP_LOGE(TAG, "state is NULL"); to ESP_LOGE("TAG", "state is NULL"); or adapting some wifi functions in the app_utils.cpp. I guess some newer dependencies are automatically installed on my machine?

After some time I got it to work and with comenting out -DMQTTHOST in the platformio_usersettings.ini. Everything seems to work fine and I can control the lamp via the website, but as soon as I enable the DMQTTHOST it keeps crashing with the following log:

I NimBLEDevice: BLE Host Task Started
I NimBLEDevice: NimBle host synced.
D NimBLEScan: >> stop()
D NimBLEScan: << stop()
[  2525][I][mqtt_handler.h:342] mqtt_reconnect(): Connecting to MQTT...
[  2701][I][mqtt_handler.h:235] on_mqtt_connect(): mqtt connected
[  2708][I][mqtt_handler.h:240] on_mqtt_connect(): mqtt subscribed to cmnd/lrcontroller
[  2708][I][mqtt_handler.h:243] on_mqtt_connect(): mqtt 709
[  2716][I][mqtt_handler.h:368] mqtt_reconnect(): Connected to mqtt broker 192.168.86.42

assert failed: xQueueGenericSend queue.c:832 (pxQueue->pcHead != ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == ((void *)0) || pxQueue->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle())

Backtrace: 0x40083c09:0x3ffd0d20 0x40094999:0x3ffd0d40 0x4009a685:0x3ffd0d60 0x4009544e:0x3ffd0e90 0x400d7807:0x3ffd0ed0 0x400d885f:0x3ffd0f00 0x400fbd5a:0x3ffd0fd0

  #0  0x40083c09:0x3ffd0d20 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
  #1  0x40094999:0x3ffd0d40 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
  #2  0x4009a685:0x3ffd0d60 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
  #3  0x4009544e:0x3ffd0e90 in xQueueGenericSend at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:821 (discriminator 2)
  #4  0x400d7807:0x3ffd0ed0 in MqttPublish::queue(char const*, char const*, bool, unsigned char) at src/mqtt_handler.h:197
  #5  0x400d885f:0x3ffd0f00 in setup() at src/main.cpp:673
  #6  0x400fbd5a:0x3ffd0fd0 in loopTask(void*) at C:/Users/mike/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42

Any help would be very much appreciated!

micdis commented 8 months ago

Hi! could you provide your changed files!?

I don't get it working.... :- (

pinkerunicorn commented 6 months ago

I also stuck at this point. So bad the developer doen't fix his/here code.

fabsss commented 5 months ago

Same problem here as well. @mikekuss what ESP32 derivate are you using? I'm using an ESP32-C3 which is only single core. I'm wondering if it has something to do since the error indicates a threading issue.