Library and script loader to control LEDs over the WebAPI of Artemis with Cheerpipes plugin.
Go to Actions or Releases and download ArtemisRemoteControl
If you already have python installed and know how to venv and pip, use this method:
- Create a new virtualenv
pip install https://github.com/Nama/ArtemisRemoteControl/archive/refs/heads/main.zip
Edit config.json
to your needs or use config.add()
(read below). Put the example or your own scripts into your scripts
folder.
If you've downloaded the exe, run it. Else, run run.py
.
- Put your own scripts in to the folder
scripts
- check
tasmota.py
for a full working example - Always use
from threading import Thread
, the plugin loader is blocking - Do
from artemisremotecontrol import setleds
- To set LEDs:
setleds('scriptname', {key, value})
- This appears in Artemis as a DataModel
- Set in Artemis what you want to do with the data
- To set LEDs:
- You can use the
Config()
class for your own scripts
Use these to initialize, so all scripts have their own "namespace" in the config:
from artemisremotecontrol.config import Config
from artemisremotecontrol import setleds
from threading import Thread
from time import sleep
try:
# Get the filename and use it for the config
config_name = __name__.split('.')[1]
except IndexError:
# Script was started directly, not with run.py, exit
# Read scripts/tasmota.py for a full example
exit()
async def loop():
while True:
data = {'key', 'value'}
setleds(config_name, data)
sleep(5)
config = Config()
config.load(config_name)
#Config.add(config_name, device)
tloop = Thread(target=loop)
tloop.start()
My idea was to have run.py
in PATH of the venv and just do run.py
to run it.
run.py
gets set to the path in the venv, also the shebang gets correctly set, but I couldn't run it. Windows complains, that there is no program defined to run that file.
So, we (or only I?) have to get the run.py
from this repo and run it in the cwd.