Battery Monitor (Batmon) information¶
Add batmon¶
Description:
Used to add a new batmon interface
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/add/batmon
Request body:
Note: After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
The request body should be sent as form-data and it should contain the device information as illustrated in the section below:
Field name | Description | Type |
---|---|---|
batmon_name | Name of the batmon | str |
batmon_type | The type of batmon | str |
batmon_token | [Optional] Token that will be used to update the batmon. If not specified, a random token will be generated | str |
update_period | How often the batmon will be updated. This time is used to calculate the batmon status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. | str |
JSON format
{
"batmon_name":"Test batmon",
"batmon_type":"BMV",
"batmon_token":"f5d6dsewwds",
"update_period":120
}
Request example:
None
Response¶
{
"success": {
"batmon_id": 191683571546635,
"batmon_token": "df45g56df6"
}
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Batmon count¶
Description:
Used to get number of Batmons available
Request¶
Request method:
GET
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/count
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
None
Response¶
{
"success": {
"batmons": 3
}
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
List batmons¶
Description:
Used to list all the Batmons for the user
Request¶
Request method:
GET
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/list
Request body:
Note: After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
None
Request example:
None
Response¶
{
"success": [
{
"batmon_id": 651684261428596,
"batmon_name": "Batmon2",
"batmon_type": "BMV",
"batmon_status": "Online",
"batmon_voltage": 0.0,
"batmon_current": 0.0,
"batmon_power": 0.0,
"batmon_soc": 0.0,
"batmon_details": "{}",
"update_period": 15000,
"last_modified": 1684268628,
"batmon_token": "df45g56df6",
"notification_enabled": true,
"alarms": [
{
"alarm_id": 1684261564297,
"device_id": 651684261428596,
"alarm_name": "Batmon voltage",
"alarm_enabled": true,
"alarm_threshold_value": 10.0,
"alarm_condition": ">=",
"alarm_trigger_time": null,
"alarm_repeat_delay": 300,
"alarm_akn": null,
"update_time": 1684261564,
"alarm_triggered": false
}
],
"whatsapp_enabled": null,
"sms_enabled": null,
"voltage_units": "",
"current_units": "",
"power_units": "",
"soc_units": ""
}
]
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Field name | Description | Type |
---|---|---|
batmon_name | Name of the batmon | str |
batmon_type | The type of batmon | str |
batmon_token | Token that will be used to update the batmon. If not specified, a random token will be generated | str |
batmon_details | batmon details which will be stored as a json object | json |
batmon_status | Device status | json |
batmon_voltage | Battery voltage | json |
batmon_current | Battery current | json |
batmon_power | Battery power | json |
batmon_soc | Battery state of charge | json |
last_modified | Indicates the latest update time in epoch | json |
notification_enabled | Indicates if the notifications have been enabled for the interface | json |
whatsapp_enabled | Indicates if whatsapp notifications have been enabled for the interface | json |
sms_enabled | Indicates if sms notifications have been enabled for the interface | json |
voltage_units | Voltage units | json |
current_units | Current units | json |
power_units | Power units | json |
soc_units | State of charge units | json |
update_period | How often the batmon will be updated. This time is used to calculate the batmon status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. | str |
Batmon Status¶
Description:
Used to get batmon status
Request¶
Request method:
GET
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/status
Request body:
The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/status?batmon_id=65698658484984584&batmon_token=fds654gf654gdf56gdf654gdf
Json body example
{
"batmon_id": 65698658484984584,
"batmon_token": "fds654gf654gdf56gdf654gdf"
}
Response¶
{
"success": {
"batmon_id": 651684261428596,
"batmon_name": "Batmon2",
"batmon_type": "BMV",
"batmon_status": "Online",
"batmon_voltage": 0.0,
"batmon_current": 0.0,
"batmon_power": 0.0,
"batmon_soc": 0.0,
"batmon_details": "{}",
"last_modified": 1684268628,
"update_period": 15000,
"notification_enabled": true,
"whatsapp_enabled": null,
"sms_enabled": null,
"voltage_units": "",
"current_units": "",
"power_units": "",
"soc_units": "",
"alarms": [
{
"alarm_id": 1684261564297,
"device_id": 651684261428596,
"alarm_name": "Batmon voltage",
"alarm_enabled": true,
"alarm_threshold_value": 10.0,
"alarm_condition": ">=",
"alarm_trigger_time": null,
"alarm_repeat_delay": 300,
"alarm_akn": null,
"update_time": 1684261564,
"alarm_triggered": false
}
]
}
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Field name | Description | Type |
---|---|---|
batmon_name | Name of the batmon | str |
batmon_type | The type of batmon | str |
batmon_token | Token that will be used to update the batmon. If not specified, a random token will be generated | str |
batmon_details | batmon details which will be stored as a json object | json |
batmon_status | Device status | json |
batmon_voltage | Battery voltage | json |
batmon_current | Battery current | json |
batmon_power | Battery power | json |
batmon_soc | Battery state of charge | json |
last_modified | Indicates the latest update time in epoch | json |
notification_enabled | Indicates if the notifications have been enabled for the interface | json |
whatsapp_enabled | Indicates if whatsapp notifications have been enabled for the interface | json |
sms_enabled | Indicates if sms notifications have been enabled for the interface | json |
voltage_units | Voltage units | json |
current_units | Current units | json |
power_units | Power units | json |
soc_units | State of charge units | json |
update_period | How often the batmon will be updated. This time is used to calculate the batmon status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. | str |
Batmon update¶
Description:
Used to update batmon status
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/update/batmon
Request body:
The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/update/batmon?batmon_id=191679387165463&batmon_token=201679387120404&batmon_voltage=41&batmon_power=33&batmon_current=10&batmon_soc=22
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
"batmon_details": "{'key': 25}",
"batmon_voltage": 47,
"batmon_power": 33,
"batmon_current": 10,
"batmon_soc": 33
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Batmon history¶
Description:
Used to get batmon history data
Request¶
Request method:
GET
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/history
Request body:
The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.
Field name | Description | Type |
---|---|---|
min_epoch_tm_sec | Minimum time for history record | str |
max_epoch_tm_sec | [Optional] Maximum time for history data. This is set to current epoch time if not specified | str |
batmon_id | [Optional] batmon ID. All batmon history will be returned if not specified | str |
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/history?min_epoch_tm_sec=1641502593
Json body example
{
"min_epoch_tm_sec": 1641502593,
"max_epoch_tm_sec": 1999999999,
"batmon_id": 65897465466
}
Response¶
{
"success": [
{
"batmon_id": 651684261428596,
"batmon_name": "Batmon2",
"batmon_type": "TODO",
"min_time": 1684262423,
"max_time": 1684262699,
"data": [
{
"batmon_voltage": 47.0,
"batmon_current": 10.0,
"batmon_power": 33.0,
"batmon_soc": 33.0,
"batmon_details": "{\"key\": 25}",
"update_time": "2023-05-16T20:40:23"
},
{
"batmon_voltage": 47.0,
"batmon_current": 10.0,
"batmon_power": 33.0,
"batmon_soc": 33.0,
"batmon_details": "{\"key\": 25}",
"update_time": "2023-05-16T20:44:59"
}
]
}
]
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Field name | Description | Type |
---|---|---|
batmon_id | batmon ID | str |
batmon_name | Name of the batmon | str |
batmon_type | The type of batmon | str |
min_time | Minimum history time available | str |
max_time | Maximum history time | int |
data | Array containing batmon history data. | json |
Batmon edit¶
Description:
Used to edit batmon information
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/edit/batmon
Request body:
The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.
Field name | Description | Type |
---|---|---|
batmon_name | Name of the batmon | str |
batmon_type | The type of batmon | str |
batmon_token | [Optional] Token that will be used to update the batmon. If not specified, a random token will be generated | str |
voltage_units | Voltage units | json |
current_units | Current units | json |
power_units | Power units | json |
soc_units | State of charge units | json |
update_period | How often the batmon will be updated. This time is used to calculate the batmon status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. | str |
Note:
Only the batmon owner can edit the interface information.
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/edit/batmon?batmon_id=545467565849421245489&batmon_token=5fgd94dgfd6fsd8d986gd6dg&batmon_name=batmon&update_period=300
Json body example
{
"batmon_id": "{{batmon_id}}",
"batmon_token": "{{batmon_token}}",
"batmon_name": "batmon",
"update_period": 300,
"voltage_units": "V",
"current_units": "I",
"power_units": "W",
"soc_units": "%"
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Delete batmon¶
Description:
Used to delete batmon
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/delete/batmon
Request body:
The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/delete/batmon?batmon_state=true&batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Enable alerts¶
Description:
Used to enable interface alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/enable/alerts
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/enable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Disable alerts¶
Description:
Used to disable interface alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/disable/alerts
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/disable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Enable whatsapp¶
Description:
Used to enable interface whatsapp alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/enable/whatsapp
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/enable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Disable whatsapp alerts¶
Description:
Used to disable interface whatsapp alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/disable/whatsapp
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/enable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Enable sms alerts¶
Description:
Used to enable interface sms alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/enable/sms
Request body:
None
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/enable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Disable sms alerts¶
Description:
Used to disable interface sms alerts
Request¶
Request method:
POST
Headers:
Content-type: application/json
URL
https://spoilerinterface.com/interface/batmon/disable/sms
Request body:
None
Note:
After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.
Request example:
Params example
https://spoilerinterface.com/interface/batmon/enable/alerts?batmon_token=df45ddddsdaewg56df6&batmon_id=301659085216623
Json body example
{
"batmon_id":301659085216623,
"batmon_token": "df45ddddsdaewg56df6",
}
Response¶
{
"success": "success"
}
Field description¶
The response information contains a success key which indicates that the batmon interface has been added successfully