Manually Publishing / Subscribing. Acknowledgement


#1

Hi, I have been playing with manually publishing / subscribing with a MQTT client and the Cayenne broker.

Temperature example worked perfect, but I want to know something about actuator/button example.

I think that Cayenne Works this way:

  1. If you switch a button ON in Cayenne dashboard, you will receive a message in “v1/username/things/clientID/cmd/cannel” like “uniquestring,1” . You need to confirm from the MQTT client with “v1/username/things/clientID/data/cannel” with value “1” that the order is received, so after that, Dashboard will switch the button ON.

For me, that way is NOT an acknowledgement, as “v1/username/things/clientID/data/cannel” with value “1” is an order itself to switch on. Any way, I you want, after that, you could also confirm that everything is ok with “v1/username/things/clientID/response” value “ok,uniquestring”

  1. If you switch a button OFF in Cayenne dashboard, you will receive a message in “v1/username/things/clientID/cmd/cannel” like “uniquestring,0” . You need to confirm from the MQTT client with “v1/username/things/clientID/data/cannel” with “value” 0 that the order is received, so after that, Dashboard will switch the button OFF.

For me, that way is NOT an acknowledgement, as “v1/username/things/clientID/data/cannel” with value “0” is an order itself to switch on. Any way, I you want, after that, you could also confirm that everything is ok with “v1/username/things/clientID/response” value “ok,uniquestring”

  1. If you switch a button ON in your client (“v1/username/things/clientID/data/cannel” with “value” 1) , Cayenne dashboard will show ON immediately without publishing anything in other subtopic

  2. If you switch a button OFF in your client (“v1/username/things/clientID/data/cannel” with “value” 0), Cayenne dashboard will show OFF immediately without publishing anything in other subtopic

Imagine that you could have several clients: the device itself, Cayenne android app, any other mqtt client in esp8266 or …

So, how could I detect when I switch OFF or ON my button in any of my clients that Cayenne broker has received the message so its new state has been publish to other subscribers? How could my other clients know about the new state?

I know about QOS, but I am thinking about other brokers that usually publish every time there is a state that changes what is the new state, so I could publish ON or OFF from my client and get my “acknowledgement” subscribing to the same or other topic.

I hope you understand me. Thanks.

NOTE: Where can I find the response messages (error or ok) that I send ? I can’t find anything in dashboard, and I can’t find also any error messages.


#2

this is how cayenne work, you need to send the data and response back so that both the web dashboard and app are in sync.

you just need to subscribe to the data published by the client.

i did not understand this.

you will receive json returned like {success:false}.it depends on you how you are handling the response in manual subscribing.


#3

Ok, I understand, It is good wat to do it. Thanks

When I use this way: “If you switch a button ON/OFF in your client (“v1/username/things/clientID/data/cannel” with “value” 1/0) , Cayenne dashboard will show ON/OFF immediately without publishing anything in other subtopic”

I can’t see any update in “v1/username/things/clientID/cmd/cannel”.

Which is the topic that I need to suscribe ?

I am using an MQTT client in Android mobile phone, so I can see any response. I thought that I could see a log or something similar in the cayenne web page dashboard. Is it not possible?

Thanks a lot for your answer, but I need a few more. :wink:


#4

As i said you need to subscribe to the publish topic not the subscribe topic.


#5

Ok, thanks a lot.


#6

Have you got it working?


#8

Yes, I have finally understood you. Thanks a lot.

there is something that I haven’t tried: read the responses. I supossed that errors and responses could be seen in the web page dashboard, but I can’t, can I ?

Happy new year !!!