Convert lua script to python

Hi,

I have a lutron grafikeye qs with a network interface QSE-CI-NWK-E. I have tried to look into the work done by deustis but I think I lack the knowledge how to get it to work https://github.com/home-assistant/core/pull/9121/commits/efe7a5580d7bdc0e36cfd06ea8641f36d8a8745c

I have this lua script working just fine from my Vera secure but I would like to move aweay from the vera. I have started to move the Z-wave components I have but I won’t be able to get rid of the vera before the Lutron integration is working.

LUA Script:

local socket = require “socket”
local lutron_tcp

function connectLutron()
lutron_tcp = assert(socket.tcp())
lutron_tcp:settimeout(0.5)
lutron_tcp:connect(“192.168.0.50”, 23)
end

function sendLutron(cmd)
lutron_tcp:send(cmd … “\r”)
sleepLutron()
end

function disconnectLutron()
lutron_tcp:close()
end

function sleepLutron()
luup.sleep(500)
end

function powerOnLutron()
sendLutron(“password”)
sleepLutron()
end

connectLutron()
powerOnLutron()
sendLutron("#DEVICE,0x000b0eb9,3,14,30,1")
disconnectLutron()

Thanks in advance for any pointers!