Browse Source

更正MQTT主题名

locky 4 years ago
parent
commit
261ebb5d79
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Controller/IotCoreController.py

+ 3 - 3
Controller/IotCoreController.py

@@ -252,7 +252,7 @@ class IotCoreView(View):
                                                                                             'token_iot_number')
             if not iot.exists():
                 return response.json(10043)
-            thing_name = iot[0]['thing_name']  # IoT core上的物品名: Ansjer_Device_+序列号+企业编码
+            thing_name = iot[0]['thing_name'][14:]  # IoT core上的物品名: Ansjer_Device_ + 序列号+企业编码/uid
             endpoint = iot[0]['endpoint']
             Token = iot[0]['token_iot_number']
             # Token = '297a601b3925e04daab5a60280650e09'
@@ -261,8 +261,8 @@ class IotCoreView(View):
             # rtsp://rtsp.zositech.org:8554/ZFdqWldXRFpMTkVaYVZEaEJXRXhUV0RFeE1VRT1B
             # api doc: https://docs.aws.amazon.com/zh_cn/iot/latest/developerguide/http.html
             # https://IoT_data_endpoint/topics/url_encoded_topic_name?qos=1
-            # 请求url来发布MQTT消息
-            url = 'https://{}/topics/{}?rtsp_command={}'.format(endpoint, topic_name, MSG)
+            # post请求url来发布MQTT消息
+            url = 'https://{}/topics/{}'.format(endpoint, topic_name)
             authorizer_name = 'Ansjer_Iot_Auth'
             signature = self.rsa_sign(Token)  # Token签名
             headers = {'x-amz-customauthorizer-name': authorizer_name, 'Token': Token,