# How to overrule volume\_set capability

**URL:** <https://community.homey.app/t/how-to-overrule-volume-set-capability/47120>\
**Category:** Developers\
**Created:** [May 6, 2021, 5:14am UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120 "2021-05-06T05:14:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rinwinte](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rinwinte/32/17257_2.png) [@Rinwinte](https://community.homey.app/u/Rinwinte)\
**Post date:** [May 6, 2021, 5:14am UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120/1 "2021-05-06T05:14:28Z")

</div>

I would like to overrule the volume\_set capability to comply with the following in the UI and flow action screen.

min: -80  
max: 12  
step: 0.5  
labelDecimals:1  
labelmultiplier:1  
label/unit: “dB”

I tried this using capabilitiesoptions and using a custom json.compose for the action. However, for these settings I get -8000% - 1200% instead of -80 - 12dB in steps of 0.5.

How can I accomplish this?

---

<div class="post-metadata">

**Author:** ![Shakesbeard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/shakesbeard/32/15112_2.png) [@Shakesbeard](https://community.homey.app/u/Shakesbeard)\
**Post date:** [May 6, 2021, 6:22am UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120/2 "2021-05-06T06:22:20Z")

</div>

Don’t do it.  
For compatibility reasons I highly recommend keeping the percentage range definition for the volume.  
Instead map to the devices target scale in the onSetCapability handler.

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [May 6, 2021, 6:49am UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120/3 "2021-05-06T06:49:23Z")

</div>

I agree with @Shakesbeard, I feel most users will understand the percent scale much more, especially as a dB scale should be logarithmic.

However, my first thought is it is something built into the volume slider to multiply by 100 as the normal 0 to 100% scale requires the value to be set between 0 and 1. Therefore, you will probably need to divide the value you set by 100 and multiply the returned value by 100.

---

<div class="post-metadata">

**Author:** ![Rinwinte](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rinwinte/32/17257_2.png) [@Rinwinte](https://community.homey.app/u/Rinwinte)\
**Post date:** [May 6, 2021, 8:20am UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120/4 "2021-05-06T08:20:35Z")

</div>

Thanks for heb responses. I thought of using the 0-100% scale. However, the device uses -80 - 12dB scale. So when using the remote each increment is 0.5dB. When using the 0-100% scale this would be a loss of precision, because th dB scale has 186 steps en the other scale 100. Which means that each % would be 1 dB instead of 0.5dB.

Is the userfriendly 0-100% scale worth the lost precision? And is it clear enough for the user that it would see dB on the device screen and % in the homey UI.

---

<div class="post-metadata">

**Author:** ![Shakesbeard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/shakesbeard/32/15112_2.png) [@Shakesbeard](https://community.homey.app/u/Shakesbeard)\
**Post date:** [May 6, 2021, 12:54pm UTC](https://community.homey.app/t/how-to-overrule-volume-set-capability/47120/5 "2021-05-06T12:54:35Z")

</div>

> [@Rinwinte](#):
>
> Is the userfriendly 0-100% scale worth the lost precision?

Definitly. Only audiophiles would care about the details anyways. I highly doubt anyone will care about the slight loss in precision.

And it will spare a lot of trouble when working with other app logics volume stuff. Or the new auto generated set relative volume card and so on.
