我在获取此代码以将频道 ID 和值上传到 xively 时遇到问题,有人可以为我提供一些关于我哪里出错的指导吗?
temp = read_temp()
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"SolarFlow","current_value":temp_0}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"SolarReturn","current_value":temp_1}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"BufferIn","current_value":temp_2}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"BufferOut","current_value":temp_3}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"UFH_Flow","current_value":temp_4}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"GSHP_Flow","current_value":temp_5}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"GSHP_WellReturn","current_value":temp_6}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"GSHP_LoopsReturn","current_value":temp_7}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"HotWaterTank","current_value":temp_8}]})
data = json.dumps({"version":"1.0.0", "datastreams":[{"id":"HotWaterPreHeatTank","current_value":temp_9}]})
with open("temp.tmp", "w") as f:
f.write(data)
subprocess.call(['curl --request PUT --data-binary @temp.tmp --header "X-ApiKey: AR4soQUW2uG3t2pTVl3FVPPKZPfH66tJ0Z8SjBlEzhvFXpIK" http://api.cosm.com/v2/feeds/2002766727'], shell=True)
os.remove("temp.tmp")
干杯
史蒂夫