# Error -110 setting battery level threshold on HSM6

**URL:** https://community.zymbit.com/t/error-110-setting-battery-level-threshold-on-hsm6/1261
**Category:** HSM6
**Created:** [August 23, 2021, 5:03pm UTC](https://community.zymbit.com/t/error-110-setting-battery-level-threshold-on-hsm6/1261 "2021-08-23T17:03:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![haydon](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@haydon](https://community.zymbit.com/u/haydon)
#### Post date: [August 23, 2021, 5:03pm UTC](https://community.zymbit.com/t/error-110-setting-battery-level-threshold-on-hsm6/1261/1 "2021-08-23T17:03:57Z")

</div>

Hi,

I’m testing the battery threshold functions so have two python scripts where I find the current voltage and then set the threshold above/below that so I can ‘pretend’ a battery going flat. Example of setting the threshold to above the current battery voltage:

```auto
import zymkey
import time
battLevel = zymkey.client.get_batt_volt()
print(f'Current battery level: {battLevel}v')
threshold = battLevel - 0.2
zymkey.client.set_battery_voltage_threshold(threshold)
print(f'Set threshold to: {threshold}')

```

However, this fails producing the following output:  
`Current battery level: 3.064746141433716v Traceback (most recent call last): File "./zk_set_batt_above_threshold.py", line 12, in <module> zymkey.client.set_battery_voltage_threshold(threshold) File "/usr/local/lib/python3.8/dist-packages/zymkey/ __init__.py", line 1807, in set_battery_voltage_threshold raise AssertionError("bad return code %d" % ret) AssertionError: bad return code -110`

Thanks  
Haydon

---

<div class="post-metadata">

### Author: ![Bob\_of\_Zymbit](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@Bob\_of\_Zymbit](https://community.zymbit.com/u/Bob_of_Zymbit)
#### Post date: [August 23, 2021, 7:32pm UTC](https://community.zymbit.com/t/error-110-setting-battery-level-threshold-on-hsm6/1261/2 "2021-08-23T19:32:03Z")

</div>

> [@haydon](#):
>
> ```auto
> import zymkey
> import time
> battLevel = zymkey.client.get_batt_volt()
> print(f'Current battery level: {battLevel}v')
> threshold = battLevel - 0.2
> zymkey.client.set_battery_voltage_threshold(threshold)
> print(f'Set threshold to: {threshold}')
> 
> ```

Trying to set to 2.5V or higher is not allowed and will throw an exception. Try something that ends up below 2.5V.
