---
title: roPowerManager
slug: develop/ropowermanager
docTags: 
createdAt: 2025-03-11T07:07:18.732Z
---

The *roPowerManager* object is used to report the battery state of the device.

Object Creation: The *roPowerManager* object is created as follows:

```text
CreateObject("roPowerManager")
```

## ifPowerManager

### GetPowerSource() As String

Returns either "Battery", "AC", or "Ethernet", depending on the power source.

### GetBatteryStatus() As Object

Returns the following values:

- `state` <font color="#6B21A8">string</font>: Returns the device battery status as either "charging", "discharging", "charge-complete", or "charge-fault"
- `soc_percent` <font color="#6B21A8">int</font>: The level of charge of the battery as a percentage.
- `hardware_version` <font color="#6B21A8">string</font>: The hardware version number

### PowerOff()

Indicates that the charger should cut the power

### SetPowerSwitchMode(as A String)

Takes either "hard" or "soft"

### GetPowerSwitchMode() As String

Returns whether it is set to "hard" or "soft"

## ifMessagePort

### SetPort(as A Object)

Which message port should be used to get messages from the power manager.
