Open flytrap50 opened 2 years ago
See example code here:
https://github.com/dotchance/jellyroll/blob/main/jellyroll.py
I can send a new pattern to the lights and display them. That is no problem.
What I want to do is physically save the pattern to the controller as a new file. So I can use the new pattern in the controllers built in scheduler. That way it shows up on Jellyfish's app in a folder I send it.
I tried setting the field to something like "Christmas/New Christmas Pattern", but it didn't save it.
Am I missing something? Is there a field that needs to be set to save the file to the controller?
`def getPatternFileData(ws, patternFileName):
patternFolder,patternName = patternFileName.split('/')
getPatternFileCmd = '{"cmd":"toCtlrGet","get":[["patternFileData", "%s","%s"]] }' % (patternFolder, patternName)
patternFileData = json.loads(wsSendCommand(ws, getPatternFileCmd))
#print("%s = %s" % (patternFileName, patternFileData))
return patternFileData`
If I remember right, I replaced the "get" with "set". (e.g. toCtlrSet,set) The API documentation is horrible (and in many cases wrong). I discovered most of the API commands by sniffing the communication between my phone and the controller using wireshark.
Here is an example command for saving a pattern to the controller: {"cmd":"toCtlrSet","patternFileData":{"name":"New","folders":"Easter","jsonData":"{\"colors\":[0,255,0],\"spaceBetweenPixels\":2,\"effectBetweenPixels\":\"No Color Transform\",\"colorPos\":[],\"type\":\"Color\",\"skip\":1,\"numOfLeds\":1,\"runData\":{\"speed\":10,\"brightness\":100,\"effect\":\"No Effect\",\"effectValue\":0,\"rgbAdj\":[100,100,100]},\"direction\":\"Left\"}"}}
Does anyone know if there is a way to save a pattern to the controller?
I am creating an app to easily create new patterns and send them to the lights, but it would be nice if I could save them to the controller.
I have to imagine there is a way, but I haven't figured it out yet.