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:
- 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”
- 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”
-
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
-
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.