Blynk 2 and Raspberry Pi - How to get Blynk 2 working?

@MDurie Add widgets switch (V0 set to pulse) and led (V1) on your app then use this test code:

import BlynkLib
import BlynkTimer
import socket, errno
import RPi.GPIO as GPIO
from datetime import datetime as dt

#set GPIO pinout
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

#set physical relay pins as output
rel_S1 = 5      #pin 29 CH1  V0

#leds status as input
in_ledS = 17    #pin 11

arr_relays = [rel_S1]

#setup pins as output
GPIO.setup(arr_relays, GPIO.OUT)

arr_leds = [in_ledS]

#setup pins as input
GPIO.setup(arr_leds, GPIO.IN)

#cloud server
BLYNK_TEMPLATE_ID = ''
BLYNK_DEVICE_NAME = ''
BLYNK_AUTH = ''

blynk = BlynkLib.Blynk(BLYNK_AUTH)

# Create BlynkTimer Instance
timer = BlynkTimer.BlynkTimer()

def init():
  #set putput state of relay pins
  GPIO.setup(arr_relays, GPIO.OUT)
  GPIO.output(arr_relays, GPIO.HIGH)
  GPIO.cleanup(arr_relays)

def update_virtual_led():
  #S
  if(GPIO.input(arr_leds[0]) == 1):
    blynk.virtual_write(1, 0)
  else:
    blynk.virtual_write(1, 255)

@blynk.on('V0')
def S1_write_handler(value):
  if int(value[0]) == 1:
    print('relay on')
    GPIO.setup(arr_relays[0], GPIO.OUT)
    GPIO.output(arr_relays[0], GPIO.LOW)
    timer.set_timeout(1, S1_timeout)


#--- timeouts ---
def S1_timeout():
  GPIO.output(arr_relays[0], GPIO.HIGH)
  GPIO.cleanup(arr_relays[0])
  print('relay off')

@blynk.on("connected")
def blynk_connected():
  print('Updating leds values from the server...')
  blynk.sync_virtual(1)

#--- activate timers ---
timer.set_interval(2, update_virtual_led) #update virtual leds for 2 secs


if __name__ == "__main__":
    init() #runs once
    while True:
      try:
        blynk.run()
        timer.run()
      except socket.error as e:
        print(e)
        if(e.errno != errno.EPIPE):
          t = time.time()
          s = dt.fromtimestamp(t).strftime('%d/%m/%Y %H:%M:%S - ')
          logging.error(s + "err blynkmain " + str(e))
          raise
        blynk.connect()