# CurrentState

Retrieve the current solar, input, output, battery and other measurements, updated every 5 seconds.

URL: **`http://LIVEX_IP_ADDRESS/api.php?get=currentstate`**

Method: **`GET`**

Response Format: **`JSON`**

## Response Example

```javascript
{"logtime":"2019-09-17 08:34:51","273":{"1":22830},"305":{"1":-17},"337":{"1":-40},"274":{"1":22880},"306":{"1":-29},"338":{"1":-67},"275":{"1":23240},"307":{"1":-816},"339":{"1":-1898},"353":{"1":-2005},"354":{"1":4998},"369":{"1":50},"1297":{"1":22850},"1329":{"1":21},"1361":{"1":49},"1298":{"1":22920},"1330":{"1":822},"1362":{"1":1884},"1299":{"1":23280},"1331":{"1":21},"1363":{"1":49},"1377":{"1":1984},"1378":{"1":4999},"1042":{"1":4830},"1058":{"1":-8260},"1074":{"1":52},"1121":{"1":-3989},"1553":{"1":0},"1569":{"1":0},"1617":{"1":0},"1554":{"1":0},"1570":{"1":0},"1618":{"1":0},"1634":{"0":0},"2321":{"1":0,"2":0,"3":0,"4":1},"2337":{"1":0,"2":0,"3":0,"4":0},"2465":{"1":1,"2":1,"3":10,"4":1},"24582":{"1":1721028},"28417":{"1":14800}}
```

## Response Parameters

```
{
    "logtime": "LOGTIME",
    "TYPE": {
        "ENTITY": VALUE,
        ...
    },
    ...
}
```

**`LOGTIME`** - (`String`) Timestamp when the measurements were logged\
\&#xNAN;*Format: `YYYY-MM-DD hh:mm:ss`*

**`TYPE`, `ENTITY`** - (`Integer`, `Integer`) Identifiers for the type of measurement\
\&#xNAN;*All* *`types`* *and* *`entities`* *are documented in our ID Protocol*

**`VALUE`** - (`Integer`) Measured value

## Examples

#### **`JavaScript Example (jQuery)`**

```javascript
$.get({
    url: "http://LIVEX_IP_ADDRESS/api.php?get=currentstate",
    success: function(response) {
        console.log(response);
        alert("Total Solar Power: " + response["1634"]["0"] + " W");
    }
});
```

#### **`PHP Example`**

```php
$response = file_get_contents("http://LIVEX_IP_ADDRESS/api.php?get=currentstate");
$jsonObject = json_decode($response, true);
var_dump($jsonObject);
echo "Total Solar Power: " . $jsonObject["1634"]["0"] . " W";
```

#### **`Python Example (requests)`**

```python
import requests
response = requests.get("http://LIVEX_IP_ADDRESS/api.php?get=currentstate")
jsonObject = response.json()
print(jsonObject)
print("Total Solar Power: " + str(jsonObject["1634"]["0"]) + " W")
```
