Questions about hardware that can be controlled by Indigo (but not through the interfaces and plugins listed). If Indigo doesn't support some bit of hardware you're interested in, and you don't find a 3rd Party Plugin for it, add it to this forum. Be sure to include links to as much information as you can find about it.
Note: adding it here does not mean we're going to add it - in fact it's possible one of our 3rd party developers may decide to write a plugin for it. We add hardware/features based on a lot of different factors beyond just having a request for it.
Trigger hs100 test
Script Error embedded script: global name 'requests' is not defined
Script Error Exception Traceback (most recent call shown last):
embedded script, line 4, at top level
NameError: global name 'requests' is not defined
import json
import requests
# do the http request
reply = requests.get('python tplink_smartplug.py -t 10.0.0.26 -c info')
# convert the text result to Python dictionary
data = json.loads(result_json)
# extract the state
state = data['system']['get_sysinfo']['relay_state']
# update the variable (put in the correct variable ID)
indigo.variable.updateValue(1234567, value=state)
import requests
# do the http request
r = requests.get('python tplink_smartplug.py -t 10.0.0.26 -c info')
# get the results
data = r.json()
# extract the state
state = data['system']['get_sysinfo']['relay_state']
# update the variable (put in the correct variable ID)
indigo.variable.updateValue(1234567, value=state)
ChopOMatic wrote:No worries, Joe. Getting heavy-eyed here, too. Haven't been to bed yet. I appreciate the help a lot and we'll tackle it tomorrow if you're up for it. Again, thanks!
Script Error embedded script: HTTPConnectionPool(host='usr', port=80): Max retries exceeded with url: /bin/python%20tplink_smartplug.py%20-t%2010.0.0.26%20-c%20info (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10ee54fd0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
Script Error Exception Traceback (most recent call shown last):
import subprocess
import json
# do the http request
r =subprocess.call(['python', 'tplink_smartplug.py', '-t', '10.0.0.26', '-c', 'info'])
# get the results
data = json.loads(r)
# extract the state
state = data['system']['get_sysinfo']['relay_state']
# update the variable (put in the correct variable ID)
indigo.variable.updateValue(1234567, value=state)
ChopOMatic wrote:That doesn't work, either.
What would I add to the Python script and where in order to update the variable?
state = data['system']['get_sysinfo']['relay_state']
indigo.variable.updateValue(1234567, value=state)
#!/bin/sh
python /Users/<you>/tplink_smartplug.py -t 10.0.0.26 -c info | grep relay_state | cut -c25
chmod 755 tplink.sh
Users browsing this forum: No registered users and 8 guests