Skip to content

Working with Wokwi

Alex Lennon edited this page Dec 24, 2022 · 2 revisions

This is the Wokwi ESP32 base project to run

https://wokwi.com/projects/338441480049787475

Go here and then F1 "Load Hex File" to upload your .bin file and it will run in the simulator

For Tasmota build the ESP32 build and change the user_config_override.h file to default to connect to the Wokwi virtual WiFi gateway

/ -- Master parameter control --------------------
#undef  CFG_HOLDER
#define CFG_HOLDER        4617                   // [Reset 1] Change this value to load SECTION1 configuration parameters to flash

// -- Setup your own Wifi settings  ---------------
#undef  STA_SSID1
#define STA_SSID1         "Wokwi-GUEST"             // [Ssid1] Wifi SSID

#undef  STA_PASS1
#define STA_PASS1         ""     // [Password1] Wifi password

Setup WiFi bridge

General details here: https://docs.wokwi.com/guides/esp32-wifi

Join the Wokwi Club here at $7/month

https://wokwi.com/club

Download and run the private WokWi IoT Gateway

https://github.com/wokwi/wokwigw/releases/tag/v1.0.3

image

Enable the local gateway in the browser simulator with F1->Enable Private WokWi Internet Gateway

Upload your hex file and the simulator will boot Tasmota connecting to your local gateway

image

You can see above I can publish to my local MQTT broker!

You can connect to the webserver running on the simulator by browsing to http://localhost:9080

image

Piping TCP from the simulator to other places (e.g. serial)

You can run a local socat server e.g. to pipe to serial with

socat -v /dev/ttyUSB0,raw,echo=0,crnl,b115200 TCP-LISTEN:1234

Then you can connect to that port 1234 with a Berry script

tcp = tcpclient()
tcp.connect("192.168.2.170", 1234)
print("connected:", tcp.connected())
s= "ATI\r\n"
tcp.write(s)
print("available1:", tcp.available())
tasmota.delay(100)
print("available1:", tcp.available())
r = tcp.read()
tcp.close()
print(r)

Berry Cookbook

Publish an MQTT message

import mqtt
mqtt.publish("tele/tasmota_000110/Test", "A test")