Originally posted by sh1ntomi
View Post
Did you try using Curl on the command line to check the JSON?
Code:
curl -X POST -d '"$command"' "$LMSIP":9000/jsonrpc.js"
An example of the full python code would be this:
Code:
#!/usr/bin/env python import requests # ----------configure players and set base values ServerLMS = 'http://314.local:9000/jsonrpc.js' PlayersOn = ["xx:xx:xx:xx","xx:xx:xx:xx","xx:xx:xx:xx"] for EachPlayer in PlayersOn: try: data = '{ "id": 1, "method": "slim.request", "params":["'+EachPlayer+'", ["power", 1]]}' requests.post(ServerLMS, data=data) except:
As an alternative, when your script is running on the same Pi that runs the player, you could just use the command line shortcuts. ("pcp up", "pcp down") through os.system?
Leave a comment: