Raspberry Pi - MQTT Publish & MQTT Subscribe- Updating Multiple Fields In one MQTT publish request and vice versa

조회 수: 5 (최근 30일)
Hello,
I am working on raspberry pi with MQTT publish block. It is being used with Thingspeak Platform. I understood the example models for publiash and subscribe the fields.
I want to use the MQTT publish and Subscribe block for multiple fields of channel. I am struggling with proper Topic argument for both publish and subscribe blocks.
As I am bengineer, I will be happy to further explain the problem statement if the info given is insufficient.
I used floowing links as refernece but not understood the specific argument.
Regards
  댓글 수: 2
Christopher Stapels
Christopher Stapels 2021년 5월 4일
In the docs you linked, it lists the topic as
channels/<channelID>/publish/<apikey>
You can get the channel ID from your channel page on the upper left or in the address bar. Your API keys are on the API keys tab.
Does that help?
VISHAL SAWANT
VISHAL SAWANT 2021년 5월 6일
Thanks for replying. I tried this combination with MQTT publish block. The entry counter is updating but the values are not visible on Channel Field charts.
Input is 1x8 array of uint8 data type.

댓글을 달려면 로그인하십시오.

답변 (1개)

Christopher Stapels
Christopher Stapels 2021년 5월 6일
Your message needs to be of the form 'field1=value&field2=value2' etc.
If you use the update single field topic instead of the multiple fields topic, you can just send a number.
  댓글 수: 2
VISHAL SAWANT
VISHAL SAWANT 2021년 5월 14일
What I see is we can give input to MQTT publish block as 1xN array of number only. No string inputs are taken as input. Can you suggest something which can work with MQTT publish and MQTT subscribe block for channle feed.
Christopher Stapels
Christopher Stapels 2021년 5월 17일
편집: Christopher Stapels 2021년 5월 17일
If you dont need MQTT, you can use the ThingSpeak blocks in the support package for Raspberry pi. This has blocks for the ThingSpeak REST API.
If you want to update miltiple fields in one call, I think the MQTT block will not work for you. Ill submit it as an enhancement request for the block.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by