https://www.youtube.com/watch?v=WunlqIMAdgw
or use GPIO Doctor: https://www.elektroda.com/rtvforum/topic3976371.html
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamSlash402 wrote:>>21451202
1. I'd rather not, we're talking microsoldering here, I don't wanna go trial and error if people have already done and found the correct way before me. Also, that doesn't really answer my question regarding if the pins on the BL0937 can be used or not.
2. This is the adapter that I have https://www.amazon.it/dp/B07TFSZ3ZP is there a way to tell if it's gonna work?
3. Umm, I only know about this tool https://github.com/openshwprojects/BK7231GUIFlashTool and I'm not really sure what chip to select when flashing as none of the ones I have are listed?
max4elektroda wrote:Usually it's impossible to tell if a specific adapter works, but they usually do. I would advise to use a separate power supply in every case, but it might be sufficient to power the pins of the plug with a power supply, sometimes 12 to 15V is enough to start the plug without connecting to high voltage.
p.kaczmarek2 wrote:connect 12V DC to the input of the plug directly. Not to the 3.3V rail
p.kaczmarek2 wrote:I think Max meant that you can connect 12V DC to the input of the plug directly. Not to the 3.3V rail, of course! That would burn WiFi module.
p.kaczmarek2 wrote:Capacitor to TTL or to AMS1117-3.3V? If you mean the latter, then answer is in the AMS1117 datasheet. It's recommended and required for stable voltage.
Info:MAIN:Time 44, idle 222630/s, free 62504, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TuyaSmartplug10/power_apparent/get
Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TuyaSmartplug10/power_reactive/get
Info:MAIN:Will do request HA discovery now.
Info:HTTP:HASS counts: 1 rels, 0 pwms, 0 inps, 0 excluded
Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic TuyaSmartplug10/power_factor/get
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_0/config, 1 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_138/config, 2 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_1/config, 3 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_2/config, 4 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_9/config, 5 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_10/config, 6 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_11/config, 7 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_3/config, 8 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_4/config, 9 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_7/config, 10 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_6/config, 11 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_12/config, 12 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_13/config, 13 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_8/config, 14 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_20/config, 15 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_21/config, 16 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_22/config, 17 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_23/config, 18 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_sensor_24/config, 19 items in queue
Info:MQTT:Queued topic=homeassistant/switch/TuyaSmartPlug10_relay_0/config, 20 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_temp/config, 21 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_rssi/config, 22 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_uptime/config, 23 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_build/config, 24 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_ssid/config, 25 items in queue
Info:MQTT:Queued topic=homeassistant/sensor/TuyaSmartPlug10_ip/config, 26 items in queue
Info:MQTT:Publishing val (324 bytes) to homeassistant/sensor/TuyaSmartPlug10_sensor_0/config retain=1
Info:MQTT:Publishing val (350 bytes) to homeassistant/sensor/TuyaSmartPlug10_sensor_138/config retain=1
Info:MQTT:Publishing val (324 bytes) to homeassistant/sensor/TuyaSmartPlug10_sensor_1/config retain=1
Error:MAIN:Low heap warning!
// start NTP and set timezone and daylight saving time
startdriver ntp
ntp_timeZoneOfs 1
CLOCK_CalcDST 0 3 1 2 60 0 10 1 3 0
// set geo to later calculate sunrise sunset
ntp_setLatLong 52.5244 13.4105
waitFor NTPState 1
// initially set on or off - relay is on channel 0
// on if it is before sunrise or after sunset
// off if it is after sunrise but before sunset
if $hour*3600+$minute*60+$second-$sunrise<0||$hour*3600+$minute*60+$second-$sunset>0 then setChannel 0 1
if $hour*3600+$minute*60+$second-$sunrise>0&&$hour*3600+$minute*60+$second-$sunset<0 then setChannel 0 0
// repeatedly (every day = 0xff) turn on on sunset / turn off at sunrise
addClockEvent sunset 0xff 31 setChannel 0 1
addClockEvent sunrise 0xff 32 setChannel 0 0p.kaczmarek2 wrote:Maybe addClockEvent?
As long as NTP gets time and device won't reboot, it will work.
https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
If your device will get a reboot (power off and on), then time will be lost - it's not possible to maintain time due to the power loss. You'd have to use battery backup like CR2032 etc
EDIT: I don't know about ESP stuff, they have used some strange OTA format that is not easily generated by our SDK. But I can help you with getting clock automations running.
max4elektroda wrote:can you explain a bit more the conditions?
You don't have any internet at the place or don't trust it?
How complex is the switching schedule?
Don't get me wrong, but for a simple on off at the same time every day a common cheap timer will provide all you need, usually including a battery backup for the clock.
addClockEvent 19:00:00 0xff 11 POWER ON
addClockEvent 23:00:00 0xff 12 POWER OFFTL;DR: 4-6 mA idle draw after PowerSave 1 [Elektroda, rufus4, post #21033260]; “use an external 3 V3 supply and flash succeeds first time” [Elektroda, kubanekjiri, post #21334922] Generic LSPA9 smart plugs with T34/BK7231N + BL0937 or BL0942 can be OTA-ready once correct pins are set.
Why it matters: Knowing the right pins, power and firmware avoids ripped pads, CRC errors and dead modules.
• MCU: Tuya T34 (BK7231N), 32-bit 120 MHz Wi-Fi SoC [Elektroda, p.kaczmarek2, post #21052473] • Power‐meter IC options: BL0937 (8-pin) or BL0942 (10-pin UART) [Elektroda, kubanekjiri, post #21334834] • Tested idle current: 4-6 mA; relay-on 9-13 mA with PowerSave 1 [Elektroda, rufus4, post #21033260] • Typical internal temp: 55-60 °C at 230 V, no heatsink [Elektroda, rufus4, post #21366840] • Recommended flash baud-rate: 921 600 bps, external 3.3 V ≥ 300 mA [Elektroda, kubanekjiri, post #21334922]
PowerSave 1 from the console or put it in autoexec.bat. Idle current drops from 8-16 mA to 4-6 mA, relay-on from 16 mA to 11-15 mA [Elektroda, rufus4, post #21033260] Keeping the web UI open prevents sleep, so close browser tabs to maintain savings [Elektroda, p.kaczmarek2, post #21033183]schedule command: schedule add 0 22:00 0; schedule add 0 06:00 1. Rules are stored in flash and run even offline [OpenBeken docs]./otaupload endpoint; upload a BK7231N-compatible ESPHome .rbl. Ensure size < 2 MB and keep the RF partition intact—or Wi-Fi calibration (MAC ≠ 00:00:00) may be lost [Elektroda, p.kaczmarek2, post #21040180]