2017-05-11 7 views
0

IoT를 처음 사용합니다. 방금 내 rpi에 모스투토를 설치하고이 튜토리얼을 사용하여 Watson IoT Platform에 내 장치와 게이트웨이를 등록했습니다. https://developer.ibm.com/recipes/tutorials/using-mosquitto-as-a-gateway-for-watson-iot/모스 퀴토와 ibm watson iot on Raspberry pi 연결이 거부되었습니다.

Mosquitto는 정밀 로컬 모드를 작동합니다.

mosquitto_sub -d -h pxci52.messaging.internetofthings.ibmcloud.com -i 'g:pxci52:myfstream:gateway' -t iot-2/type/myfstream/id/gateway/evt/status/fmt/raw 

하고 여기에

sudo mosquitto_pub -d -h pxci52.messaging.internetofthings.ibmcloud.com -i 'g:pxci52:myfstream:gateway' -t iot-2/type/myfstream/id/gateway/evt/status/fmt/raw -m "hello" 

내 conf의 파일입니다 : 내가 볼

pid_file /var/run/mosquitto.pid 
 

 
persistence true 
 
persistence_location /var/lib/mosquitto/ 
 

 
log_dest topic 
 

 

 
log_type error 
 
log_type warning 
 
log_type notice 
 
log_type information 
 

 
connection_messages true 
 
log_timestamp true 
 

 
include_dir /etc/mosquitto/conf.d 
 
connection bridge-to-watsoniot 
 
address pxci52.messaging.internetofthings.ibmcloud.com:1883 
 
cleansession true 
 
try_private false 
 
bridge_attempt_unsubscribe false 
 
notifications false 
 
notification_topic iot-2/type/myfstream/id/gateway/evt/status/fmt/raw 
 
remote_username token 
 
remote_password xxxxxx 
 
remote_clientid g:pxci52:myfstream:gateway 
 
notifications true 
 
topic iot-2/type/+/id/+/cmd/+/fmt/+ in iot-2/type/+/id/+/cmd/+/fmt/+ 
 
topic iot-2/type/+/id/+/evt/+/fmt/+ out iot-2/type/+/id/+/evt/+/fmt/+ 
 
connection_messages true

+0

모든 3 개의 프로그램 (mosquitto, mosquitto_sub & mosquitto_pub)이 동일한 클라이언트 ID를 사용하고 있습니다. 작동하지 않으며 각 연결마다 고유 한 ID가 필요합니다. – hardillb

+0

또한 암호를 설정 파일에 저장했습니다. 이 질문을 삭제하고 비밀번호를 다시 입력해도 암호를 다시 입력해도 암호가 여전히 기록에 남아있게됩니다. – hardillb

+0

ps : 기기를 삭제하고 테스트 목적으로 새 것을 시작하기가 쉽습니다. – Ninja

답변

0

그러나, 나는이 명령을 사용하여 문제 구독/출판 직면하고있다 로그에 잘못된 장치의 사용자 ID (토큰) auth : ClientID = 'g : pq ci52 : myfstream : gateway '그냥 "token"대신 "use-token-auth"을 시도하십시오. 다음과 같은 recipe 예제에서 지정한 내용입니다.

+0

지난 5 분 동안 2 회 모두, 심지어 내가 만들기 위해 cmd를에 주입해야합니다'sudo는 mosquitto_pub -d -h pqci52.messaging.internetofthings.ibmcloud.com -i 'g : pqci52 : myfstream : 게이트웨이'-u 유스 토큰 인증 -P Nr0CHkXNbn3o + WFeMW -t IOT-2/타입/myfstream/ID/게이트웨이/EVT/상태/FMT/원료 -m "안녕하세요"'이미 enaugh 낭비 iothub 푸른로 전환 헬프 IM FOR THANKS time on this – Ninja

+0

오늘 아침에 로그를 확인하고 Token auth failed (장치/게이트웨이가 데이터베이스에서 찾을 수 없음) : ClientID = 'g : pqci52 : myfstream : gateway'를 참조하십시오. 따라서이 장치가 게이트웨이로 등록되지 않았을 수 있습니다. – ValerieLampkin

+0

그것을 알 토큰 인증 성공 ': 된 ClientID ='D : pqci52 : myfstream : 게이트웨이 'ClientIP = ************'' 는 mosquitto_pub -d -h pqci52.messaging.internetofthings를 사용 pfci52 : myfstream : 게이트웨이 -u use-token-auth -P Nr0CHkXNbn3o + WFeMW -t iot-2/type/myfstream/id/gateway/evt/status/fmt/raw -m "hello"' – Ninja