I have a script, as follows:
- Code: Select all
import requests
import datetime
import json
url = 'http://10.0.1.96/index.php/pages/main/gaugeValues/2162'
indigo.server.log("Test Script Executed")
reply = requests.get(url, timeout=1.0)
indigo.server.log(reply.content)
result = json.loads(reply.text)
for item in result[0]:
indigo.server.log(item)
Output to the log is:
Script Test Script Executed
Script [{"chanId":"","maxWatt":10161.8,"currWatt":1690,"minWatt":24,"unit":"W","netWatts":0,"tmpWatt":0}]
Script netWatts
Script chanId
Script currWatt
Script tmpWatt
Script maxWatt
Script unit
Script minWatt
What I want is the value of the item, not the item description, i.e. What is the value following "currWatt"? Probably real easy but I don't know how to do it.
Thank you.