Pybiosis - Python Automation and Device Integration
I am all about automation and streamlining. One of the tools I use is a
StreamDeck which has programmable buttons.
This hardware device lets you add in custom buttons with icons to execute specific actions - typically for streaming so you can switch things like camera views etc really easily. Because the developers use a file system of JSON files to represent the button layouts, and which functions they execute, I am able to write a Python wrapper around that to add my own functions from Python - essentially giving me a fully customizable interface to all my python code. With
Pybiosis, you can easily add functions to do things like fill out forms, open applications, configure your monitors (which I change often), and really anything Python can do. Here is an example function connected to multiple services (including Google Assistant and a Task Scheduler):
The special line here is: @deck(location='Games/2,0', image='default0.png'). When this code runs, it will recompile the Stream Deck files to place a button in the desired location so that a button press will execute the associated python function. The line: Games.play_with_laptop("Bloons", 'hdmi') hides some magic. It will:
- Launch the game Bloons Tower Defence 6 from Steam,
- Switch my right monitor to the HDMI setting so that it displays a connected laptop, and
- Stop extending my primary computer to that screen
This way I can play local co-op bloons instantly and I can forget about all of the menus and settings!! To do all of that monitor management I had to create python wrappers for several existing applications like:
The keen-eyed will have also noticed the line: @google(voice=multi_phrase(...)). This hooks up my Google Assistant to recognize the programmed voice commands and execute the python function. A huge thanks to
Push2Run which enables the voice commands
, I highly recommend you check it out! Below is a video of me running this python function through a voice command, along with a project description:
So even though I showed how it can be used to launch a game, it can be used for any python function you can think of! You can checkout the code on github.