This object is in archive! 

Battery level through MQTT

Pat@ shared this question 4 years ago
Answered

Hi

is it possible to catch battery level information of devices through MQTT API for Zipabox?

Replies (4)

photo
1

Hi

it is possible to get it through API calls request/devices/UUID/info and request/devices/{uuid}/status. Its response body is as follows:

"state":

{ "batteryTimestamp": "2020-04-21T14:53:37Z",

"sentTimestamp": "2020-04-22T09:56:57Z",

"online": true,

"trouble": false,

"receiveTimestamp": "2020-04-22T09:56:57Z",

"transactionId": "0eedffcf-ffc1-4340-bbb0-867f07498304",

"onlineState": "ONLINE",

"timestamp": "2020-04-22T13:25:05Z",

"batteryLevel": 89,

"mainsPower": false }

photo
1

You have this information through "normal" API but is it possible with MQTT API?

photo
1

yes it is: use the topic: /${root}/request/devices/${uuid}/status

$(root) is the same for obtaining a value: /${root}/attributes/${uuid}/value

photo
1

I have tried through normal API and it is OK but I don't understand how use it with MQTT:

- should I subscribe to a topic /${root}/request/devices/${uuid}/status and wait that the Zipabox publish to this topic? In this case how often the Zipabox publish to the topic?


- or should I publish to the topic /${root}/request/devices/${uuid}/status and susbcribe to another topic (which?) to wait for the response?


Thanks for your response

photo
photo
1

Hi Dino

Can you explain more ? Which request to send in MQTT for obtain battery level ?

Actually I receive MQTT info from all my devices with topic : /attributes/UUID/value{value} and I can send commands with topic : /request/attributes/UUID/value

Thanks for your help

photo
1

Hi

please find in the attachment the lastest MQTT documentation (v2.9) where under Device topics (pages 23 & 24) you can find part about retreving device data.

Regarding battery level data, it will be published when its value is changed.

photo
1

Hi

thanks but is not very easy to understand the documentation because in fact it is necessary to publish to request/devices/${uuid}/status and read response from /${root}/${uuid}/status.

It is not exactly what it is writen in the documentation! But it is OK now.

photo
1

Thanks for the documentation Dino, I have been posponing the test of MQTT integration with Zipato, plus I'm starting to learn this protocol.

photo
1

Hi Dino

Thanks for your explainations. I use a thomsonbox and MQTT run well. But all my devices batterylevels are to "0".

Is this normal? The battery level does not seem to be implemented?

Thank for your help

photo
1

With thombox too, if got a -1 value for device with low battery. I suppose thomson devices does not return percentage.

photo
photo
1

Hi

here is attached updated MQTT documentation - version 3.1.

Leave a Comment
 
Attach a file