whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

Capture device battery status in MD

Open reinier-millo opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like.

Be able to capture the current battery status of the phone device.

Describe an alternate solution.

No response

Additional context

No response

reinier-millo avatar Sep 24 '22 06:09 reinier-millo

To get current battery percentage and charging status for the attached device on demand, use the method getBatteryStatus() Learn more: https://docs.wwebjs.dev/ClientInfo.html#getBatteryStatus

To subscribe to events emitted when the battery percentage for the attached device changes, listen to the event change_battery. Will not be sent if using multi-device. Learn more: https://docs.wwebjs.dev/Client.html#event:change_battery

lfdelphino avatar Nov 12 '22 21:11 lfdelphino

It is possible to do this in multi-device, but it is super inaccurate that I wouldn't bother. If the phone is offline etc. the state of the battery is not streamed. Will keep open & in mind for later though

purpshell avatar Jan 06 '23 17:01 purpshell