@brycew I have just worked it out now… by butchering the code but working is working ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=9)
I noticed a fork of @DBuit by @neoantox where he made some minor tweaks to add a maximum volume… https://github.com/neoantox/media_player-popup-card/commit/77e642e171d1affd8e18217fbffb764f3a1e9b32
So I added a hard-coded maximum. Which worked! Yay!
Then, based on this code from the slider-entiry-row, I added a min
and step
setting…
.min=${t.min}
.max=${t.max}
.step=${t.step}
<input type="range" max="-10" min="-80" step="0.5" style="--slider-width:
So after i got that working, I changed it to use the values from my entity:
<input type="range" max="${stateObj.attributes.max}" min="${stateObj.attributes.min}" step="${stateObj.attributes.step}"
The other changes I made were to use the stateObj.state
rather than the volume attribute and changed the setVolume commands to call the input_number.set_value service.
_setVolume(state, value) {
this.hass.callService("input_number", "set_value", {
entity_id: state.entity_id,
value: value
});
}
Then I changed the units to those from my input_number as below:
<h4 id="volumeValue" class="${stateObj.state === "off" ? '' : 'brightness'}" data-value="${this.currentVolume}${stateObj.attributes.unit_of_measurement}">
Then I dug deeper and decided to just fork @DBuit original media_player-popup-card and make it work for me properly with optional settings on the card.
So now we have this:
Hopefully @DBuit will see this and build a real one and fix my current bug (I can’t display the units while changing the slider. The number shows but not the units.)
Big thanks again to @DBuit for all the work in creating the homekit styled popup cards in the first place. They are way easier to use on a phone/tablet than the slider entity row was.