Open dkaukov opened 1 year ago
Add web_server component and it should work. Keep this issue open so that I remember to fix it.
:+1:
It compiles, but crashing on MQTT connection.
Hi, i realized to late that MQTT for beken-72xx is not implemented yet (https://docs.libretuya.ml/docs/status/arduino/). An ESPHome configuration with MQTT enabled compiles - but is also crashing on MQTT connections or shortly after the connection. Topics are sent once. @kuba2k2 is implementing/fixing MQTT for beken-72xx planned in the near future? I need MQTT for ioBroker support...
It's not my priority currently. Also, I don't have ways to test it - I don't have any MQTT broker, except for mosquitto installed on my PC locally, which I tested and it didn't crash.
ok! Maybe i can help by providing some more information? Can i grab some logs somehow? The device is accessible only via network, i used cloudcutter to flash.
A device without UART access won't do. When I was fixing issues on various components, I even had a JTAG debugger attached sometimes.
I seem to be running into the same issue. The firmware compiles and flashes, but shortly after the reboot the device crashes. It also appears that on boot the a message single message makes it into the broker (mosquitto) before crashing.
I also have the same issue I believe. CBU module (BK7231N) in a tongou rail switch. Works fine on Esphome API, but crashes after 1 message on MQTT. (Mosquito broker in HASS that i use for all my other devices)
Let me know if there are any logs I can get to assist
I also have the same issue I believe. CBU module (BK7231N) in a tongou rail switch. Works fine on Esphome API, but crashes after 1 message on MQTT. (Mosquito broker in HASS that i use for all my other devices)
Let me know if there are any logs I can get to assist
I think I’m running into the same issue.
I have the same board (CBU) and I can compile the firmware if I add the mqtt
component.
However, as soon as the device starts I can only see a message in the console saying “MQTT Connected!” and this is the only message that gets constantly spammed into the console. No other updates for sensors or button are sent to the MQTT broker.
I can’t even access the device via its IP, but the web server is enabled in the configuration. I don’t know if it constantly restarts or what, I can perform OTA update though, so I guess it stays online.
Any help on this would be highly appreciated, let me know if I can provide you additional information or logs.
Same issue on my side. I've got a WRE2 Board in a power plug with an RTL8710BN chip. As long as I keep the mqtt component disabled / commanded it works. But ones I compile and download OTA with the mqtt component, the board is'nt anymore reachable and opens after a while the fallback hot spot. It seem's some how the WiFi connection will be cut of, because of the mqtt component and hangs somewhere on a loop. The topics will be created, so for very short moment the establishment of connection must be succeed. I'm using ioBroker as well, so no chance for the api component and HASS for me. @kuba2k2 Let me know how I can help, because without mqtt this power plug is just another lab rat for me.
That's my yaml in case it's useful.
name: plug01
friendly_name: plug01
rtl87xx:
board: wr2e
framework:
version: dev
# Enable logging
logger:
# Enable Home Assistant API
#api:
# encryption:
# key: "NNmEHnn7ZGraG+GLnM1l9vkvern/aLGSRdV1SQtQtHs="
ota:
password: "3855fb12edfaac040202d0493ace64de"
wifi:
ssid: "mySSID"
password: "myPassword"
# Enable fallback hotspot in case wifi connection fails
ap:
ssid: "Plug01 Fallback Hotspot"
captive_portal:
# Example configuration entry
web_server:
port: 80
binary_sensor:
- platform: gpio
pin:
number: 05
inverted: true
mode:
input: true
pullup: true
name: "TouchSwitch"
on_press:
- switch.toggle: relay
- platform: status
name: "TouchSwitch Status"
sensor:
- platform: wifi_signal
name: "Plug01 WiFi Signal"
update_interval: 60s
switch:
- platform: gpio
name: "Relay"
on_turn_on:
then:
- switch.turn_on: led
on_turn_off:
then:
- switch.turn_off: led
pin:
number: 14
inverted: true
id: relay
- platform: gpio
name: "Status LED"
pin:
number: 19
inverted: true
id: led
status_led:
pin:
number: 12
inverted: true
Same issue on my side. I've got a WRE2 Board in a power plug with an RTL8710BN chip. As long as I keep the mqtt component disabled / commanded it works. But ones I compile and download OTA with the mqtt component, the board is'nt anymore reachable and opens after a while the fallback hot spot. It seem's some how the WiFi connection will be cut of, because of the mqtt component and hangs somewhere on a loop. The topics will be created, so for very short moment the establishment of connection must be succeed. I'm using ioBroker as well, so no chance for the api component and HASS for me. @kuba2k2 Let me know how I can help, because without mqtt this power plug is just another lab rat for me.
That's my yaml in case it's useful.
name: plug01 friendly_name: plug01 rtl87xx: board: wr2e framework: version: dev # Enable logging logger: # Enable Home Assistant API #api: # encryption: # key: "NNmEHnn7ZGraG+GLnM1l9vkvern/aLGSRdV1SQtQtHs=" ota: password: "3855fb12edfaac040202d0493ace64de" wifi: ssid: "mySSID" password: "myPassword" # Enable fallback hotspot in case wifi connection fails ap: ssid: "Plug01 Fallback Hotspot" captive_portal: # Example configuration entry web_server: port: 80 binary_sensor: - platform: gpio pin: number: 05 inverted: true mode: input: true pullup: true name: "TouchSwitch" on_press: - switch.toggle: relay - platform: status name: "TouchSwitch Status" sensor: - platform: wifi_signal name: "Plug01 WiFi Signal" update_interval: 60s switch: - platform: gpio name: "Relay" on_turn_on: then: - switch.turn_on: led on_turn_off: then: - switch.turn_off: led pin: number: 14 inverted: true id: relay - platform: gpio name: "Status LED" pin: number: 19 inverted: true id: led status_led: pin: number: 12 inverted: true
What version of the firmware are you using? Now that libretiny
has been merged into esphome
, I would suggest you try the official version to see if it works. I did some quick tests, and I found out that mqtt
is working fine using the latest esphome release. However, I noticed that deep sleep is not supported anymore in the official release, which is what I'm currently struggling with, but in your case this should not be a problem if you need to control a plug.
@alessiocappa I am using the docker version from here (2023.9.0-dev) on my Pi 4 to manage the device and I installed it according to this Tut. I flashed the Board with the Itchiptool v4.6.0. In the first place I used this yaml to got the device connected to my WiFi.
name: plug01
friendly_name: plug01
rtl87xx:
board: wr2e
framework:
version: dev
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "NNmEHnn7ZGraG+GLnM1l9vkvern/aLGSRdV1SQtQtHs="
ota:
password: "3855fb12edfaac040202d0493ace64de"
wifi:
ssid: "mySSID"
password: "myPassword"
# Enable fallback hotspot in case wifi connection fails
ap:
ssid: "Plug01 Fallback Hotspot"
captive_portal:
# Example configuration entry
web_server:
port: 80
Have you link for me and the reader to this post to the official version as a docker container? Thanks for the effort.
@alessiocappa Ok, I guess I found it (here). I was first confused, because the device wizzard wasn't showing the WR2E board. So I choose something, and exchange the yaml configuration. Without the mqtt component same status. So my file and device still work.
Unfortunately the yaml wouldn't accept and compile with the mqtt component (see picture). It seems not to be available for the WR2E board with the RTL8710BN chip. Or I am doing something wrong?
Which device platform are you using? Beken chip?
Newer versions of ESPHome (specifically the upstream version, not the fork) make MQTT compilation on Realtek impossible, due to the crashing issues. Older versions will compile (they didn't have such a check) but will obviously not work properly.
MQTT is incompatible with Realtek. I have not been able to get it to work yet - I don't know what makes it crash (and I've been searching for the cause).
@alessiocappa Ok, I guess I found it (here). I was first confused, because the device wizzard wasn't showing the WR2E board. So I choose something, and exchange the yaml configuration. Without the mqtt component same status. So my file and device still work.
Unfortunately the yaml wouldn't accept and compile with the mqtt component (see picture). It seems not to be available for the WR2E board with the RTL8710BN chip. Or I am doing something wrong?
Which device platform are you using? Beken chip?
@BinaryBrain86 sorry, I think I misread the chip you're using. Indeed, I'm using a CBU board (BK7231N) and MQTT seems to be working fine with the latest ESPHome version.
Newer versions of ESPHome (specifically the upstream version, not the fork) make MQTT compilation on Realtek impossible, due to the crashing issues. Older versions will compile (they didn't have such a check) but will obviously not work properly.
MQTT is incompatible with Realtek. I have not been able to get it to work yet - I don't know what makes it crash (and I've been searching for the cause).
@kuba2k2 Thanks for the information, and even more I appreciate your effort. I was searching in the Repo for mqtt and found this:
I'm right the library here will be used for mqtt? In that case you probably considered this (I know it's written ESP8266, but who knows it might take effects on other IoT chips).
I tried to go through some Python build scripts, but after a while I lost the thread.
This library is not used in ESPHome. The one used is called AsyncMqttClient-esphome
.
Not sure I'm on the right spot, but in the PlatformIO.ini is still version 1.0.0 referenced. 2.0.0 Is already released. Not sure if it matter.
This file is not used for compilation, though it should have been updated too. This file doesn't affect errors.
As I have mentioned before, MQTT with this library is incompatible with Realtek. This is not about compilation errors or different versions - it crashes on runtime. There's nothing you can do by changing versions.
Enabling MQTT in the ESPHome for "realtek-ambz" produces the error: