Closed whitebearded closed 2 years ago
Hmm, I'm not sure why it's not working for you.
The slider and the volume up/down buttons work for me (both change volume).
When you move the slider, does it report anything in your mqtt broker?
Thanks for the hint, Troy! I've enabled debugging on the broker:
When I try to set a volume < 100% I get this logs:
2022-02-03 13:52:06 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '0', mid: 44
2022-02-03 13:52:08 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '0', mid: 45
2022-02-03 13:54:34 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '0', mid: 46
When aiming for 100%:
2022-02-03 13:54:35 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '1', mid: 47
2022-02-03 13:54:36 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '1', mid: 48
Because of the 0 and 1 values I've then removed the int template casting in my config and confirmed my original assumption when setting the volume again:
2022-02-03 14:02:33 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on phoniebox/cmd/setvolume: '0.86', mid: 34
There seems to come a float value from the slider while I assume the +/- buttons add integers to read integers values?
I will experiment with some advanced template logic to multiple values < 1 with 100 and will get back to you.
Yeah this seems to have resolved it. Many thanks for your support!
volume:
service: mqtt.publish
data:
topic: "phoniebox/cmd/setvolume"
payload: >
{%if(volume <= 1.0)%}{{(volume * 100) | int }}{% else %}{{volume}}{% endif %}
I'm glad its working for you now!
Hi there,
many thanks for this great integration contribution!
I'm using it to control my RPi-Jukebox-RFID aka Phoniebox via mqtt. Most things are working just fine and I'm also able to control the volume, but only via the "+" and "-" buttons of the media player card. The slider shown is reflecting the current volume correctly but can not be used to set it.
I'm wondering if there is anything one can do on this? Is some function not interfaced by this extension yet? My best guess was that it might be a type issue and the slider might be using float instead of int, but a conversion didn't do the trick.
Version: Latest, 3f8cc81
My config:
Many thanks! :)