Lua Stream Deck Support
external
Page
Code Steps
Category
Label
Link
Separator
Title
Message
Page icon
No icon. This page keeps the plain index row.
orSVG or PNG, square, at least 32×32.
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Example application
Copy Markdown
Open in ChatGPT
Open in Claude
This is a full example application which will work with a Stream Deck Mini, load the 6 buttons, and show a message on the console when a button is pressed and released. its also showing how to load a button dynamically
uv=require("luv")
local e=require("elgato-lib")
local b=require("barionet-io")
relays= {0,0,0,0}
--[[
* * * * helper function: dump_block * * * *
* this function will hexdump a block *
* *
* argument: block to dump *
* result: block output to the console *
* * * * * * * * * * * * * * * * * * * * * *
]]--
dump_block=function(buf)
local prbuf=""
for i=1,buf:len() do prbuf=prbuf .. string.format("%02X ",buf:byte(i)) end
print(prbuf)
end
--[[
* * * * main function: keypress * * * * * *
* this function will be called when a *
* key on the elgato is pressed *
* *
* argument 1: key number (1..) *
* argument 2: 1=pressed 0=released *
* * * * * * * * * * * * * * * * * * * * * *
]]--
keypress=function(key,func)
print("key " .. key .. " func" .. func)
if func==1 then
ps="pressed "
if key>3 and key<7 then
print(" use key")
e.button(1,2,"n" .. key-3 .. "c.bmp")
if relays[key-3]>0 then
relays[key-3]=0
e.button(1,key,"n"..(key-3).."b.bmp")
b.setio(key-3,0)
else
relays[key-3]=1
e.button(1,key,"n"..(key-3).."c.bmp")
b.setio(key-3,1)
end
else if key==1 then
relays[1]=0 relays[2]=0 relays[3]=0
b.setio(1,0) b.setio(2,0) b.setio(3,0)
e.button(1,2,"paul80.bmp")
e.button(1,4,"n1b.bmp")
e.button(1,5,"n2b.bmp")
e.button(1,6,"n3b.bmp")
else
if key==3 then
relays[1]=1 relays[2]=1 relays[3]=1
b.setio(1,1) b.setio(2,1) b.setio(3,1)
e.button(1,2,"paul80c.bmp")
e.button(1,4,"n1c.bmp")
e.button(1,5,"n2c.bmp")
e.button(1,6,"n3c.bmp")
end
end
end
else
ps="released "
end
print(ps .. key)
end
e.init()
e.open(1,keypress)
-- dump_block(e.serial) -- if uncommented, prints the serial of the device (hexump)
-- dump_block(e.firmware) -- IF uncommented, prints the firwmare version of the device (hexdump)
e.reset() -- sends a reset command to the elgato
e.dimlevel(1,100) -- sets brightness level (100: 100%)
e.button(1,1,"paul80.bmp","paul80c.bmp") -- sets image for button 1 (standard and when pressed)
e.button(1,3,"paul80c.bmp","paul80.bmp")
e.button(1,4,"n1b.bmp") -- if only one given, no change upon press. buttons 4,5,6
-- when pressed permanently change/toggle (see keypress abovve)
e.button(1,5,"n2b.bmp")
e.button(1,6,"n3b.bmp")
b.start(100) -- start barionet io lib
b.setio(1,0) b.setio(2,0) b.setio(3,0) -- set all relays to 'off'
local timer=uv.new_timer()
timer:start(10,10,e.tick) -- elgato lib is called every 10ms to handle keys etc
-- all set up here, we can go to the loop.
uv.run()
Last updated on
null
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message