簡體   English   中英

操作超時連接到IBM物聯網服務

[英]operation time out connection to IBM iot service

我試圖在樹莓派上運行python腳本。 而且我的設備也已經連接到bluemix上。 最初,我可以運行腳本,但是現在出現以下錯誤。


2016-11-14 06:46:30,490 ibmiotf.application.Client警告無法加密消息,因為TLSv1.2不可用(基於SSL的MQTT至少需要Python v2.7.9或3.4和openssl v1.0.1)2016-11-14 06:46:40,571 ibmiotf.application.Client關鍵操作連接到IBM物聯網服務的時間超時:1tlj3z.messaging.internetof Things.ibmcloud.com連接到IBM物聯網服務的操作超時:1tlj3z.mes saging .internetofthings.ibmcloud.com

PIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17, GPIO.OUT)
client = None
def myCommandCallback(cmd):
if cmd.event == "light":

有效負載= json.loads(cmd.payload)

 command = payload["command"]
print command
if command == "on":
GPIO.output(17, True)

elif命令==“關閉”:

GPIO.output(17,假)

try:
options = ibmiotf.application.ParseConfigFile("/home/pi/device.cfg")
options["deviceId"] = options["id"]
options["id"] = "aaa" + options["id"]
client = ibmiotf.application.Client(options)
client.connect()
client.deviceEventCallback = myCommandCallback
client.subscribeToDeviceEvents(event="light")        

while True:
    GPIO.wait_for_edge(18, GPIO.FALLING)
    print "Button Pushed"
    myData = {'buttonPushed' : True}
    client.publishEvent("raspberrypi", options["deviceId"], "input", "json", myData)
    time.sleep(0.2)

ibmiotf.ConnectionException除外,例如e:print e

看來您的錯誤是由於您未使用Python和OpenSSL版本來支持TLS v1.2,而IoT平台需要TLS v1.2進行加密連接。

在端口8883或443上使用安全MQTT消息傳遞時,較新的客戶端庫將自動信任由Watson IoT Platform提供的證書。 如果您的客戶端環境不是這種情況,則可以從messages.pem下載並使用完整的證書鏈。

請參閱IoT TLS安全要求文檔

您最初是在非SSL端口上運行腳本嗎? 您在域中是否有通配符?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM