Calling @blynk.virtual_write not working

First post so forgive me if the format doesn’t look right. I did use the triple backticks so if it’s wrong, I’ll edit.

For some reason my code throws the TypeError: ‘NoneType’ object isn’t callable in reference to where I have @blynk.virtual_write(0)

I am wanting to do something extremely simple as I am very new at using Blynk. Just a button on the app that writes to virtual pin V0 which controls an LED connected to my ESP32 board.

Specs of this project:

  • ESP32 DevKitC - V4
  • Windows 10
  • Thonny IDE
  • LED is connected to GPIO pin 2

I come from a heavy programming background in industrial automation but Python is very different. With this I am still entry level and enjoying learning it so I’m guessing this is an easy fix for more experienced programmers. My code is below.

import BlynkLib
from machine import Pin
import network
import time

WIFI_SSID = 'xxxxxx'
WIFI_PASS = 'xxxxxxxxxxxxx'

BLYNK_AUTH = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'

wifi = network.WLAN(network.STA_IF)
if not wifi.isconnected():
    print("Connecting to WiFi...")
    wifi.connect(WIFI_SSID, WIFI_PASS)
    while not wifi.isconnected():

print('IP:', wifi.ifconfig()[0])

#Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

def blynk_connected(ping):
    print('Blynk ready. Ping:', ping, 'ms')

def blynk_disconnected():
    print('Blynk disconnected')

#Define LED pin
LED = Pin(2,Pin.OUT,Pin.PULL_DOWN) #Pin is connected to GPIO 2, use internal pulldown resistor

def virtualPin0WriteHandler(value):
    #when virtual pin V0 is written to from Blynk
    if int(value[0]) == 1:

while True:

Here is what I get in the Shell of my IDE:

Connecting to…
Traceback (most recent call last):
File “”, line 35, in
TypeError: ‘NoneType’ object isn’t callable

Any reason why you chose Python?
The Blynk C++ libraries are the most widely used and actively developed, Python isn’t widely used.

It’s not clear if you’re trying to use Blynk IoT or Blynk Legacy on a local server, but I’ll assume that it’s IoT.

You need to be running v1.0.0 of the Blynk Python library. This isn’t available as a bundled release, so if you haven’t already then you’ll need to manually copy the files from here…

If you also take a look at the examples folder there, and the example you’ll see the correct syntax for the virtual write command.



Thanks, Pete! I was able to figure it out by that hint you gave me. I was looking at the examples at the other GitHub made for using Micropython. The one you posted had the correct information.

Using the example showed me the way. That code was written to display a slider value in the Shell of our IDE. But with some modification I was able to get it to turn the LED on and off via a switch on the app.

Thanks again!

Oh and I’m using Python because it is starting to gain traction in a lot of industrial automation platforms. So not only can I use it at home for hobby projects, but I’ve actually used it in my career while programming some warehouse automation systems. Mostly for database management and sending messages over MQTT.

I’m really excited to progress with it and am enjoying a different style of programming than what I’d been used to in my career.

Glad it’s working.

If you’re interested in MQTT then you might have come across Node-Red (something that also seems to be used in some industrial applications). My home automation systems rely almost exclusively on MQTT for control and communication with devices, and I use Node-Red as my rules engine and integration hub. It has plug-ins for Blynk - which I use for my UI and mobile app, and for voice control systems like Alexa. More info on that here…