Updating 'step' for media_player - editing javascript does nothing?

So media_player currently increments the volumes in 10% steps which with a Sonos is too big a jump to be useful. I noticed the input_slider supports a “step” parameter so I thought I’d take a look at implementing the same for media_player.

I am using Appdaemon 2.0.7 and HA 49.0

I can see that the step is hardcoded to 0.1 in appdaemon/widgets/basemedia/basemedia.js. My first attempt was just to edit this to 0.01 to ensure that I was looking at the right bit of code. I immediately came unstuck though - I can see that the compiled javascript in /conf/compiled/javascript/default/.js reflects the new “step” that I defined - yet the up/down volume steps are still 10%/0.1 when used in the browser. I also deleted conf/compiled/javascript/application.json and restarted appdaemon and it still doesn’t take effect…I then clear all cached files in my browser and that still doesn’t help.

Using the developer tools I can also see that compiled_javascript/application.js still reflects the original value, not my updated one.

Is there anything I need to do to get changes to the javascript to actually be reflected? I have a few ideas I want to try and implement but have fallen at the first hurdle.

Could be a caching issue - the only place that should be set is in the widget itself. Have you tried forcing a recompile, or deleting the entire compiled directory instead of just parts of it?

I’ve deleted the entire compiled directory and can see it getting recreated and the compiled application.json still containing the old setting.

I have dash_force_compile: ‘1’ set in my application,yaml but regardless, deleting the whole compiled directory should do the trick but sadly doesn’t.

I have confirmed that apddaemon/widgets/basemedia/basemedia.js contins my alteration, stopped appdaemon, cleared /conf/compiled/* and restarted appdaemon and yet the compiled application.json still reflects the original value.

What is your dev process like for the widgets? Is it normally just a matter of making sure the dashboards recompile or would you expect to have to clear out other caches between changes?

when i make changes then normally i flush the cash from my browser, delete the compiled dir and the changes take place.
in rare cases i needed to restart appdaemon.

Dashboard should detect any widget changes and automatically recompile, and you should be able to check that is happening because the page generation in the log will take a lot longer. Also as Rene says, sometimes browser caching can catch you off guard.

I took a look - and for me, changing the step resulted in the desired behavior (minus a few glitches as the widget wasn;t tested for steps other than 10%). So, not sure why you can;t change it.

Anyway, since I was in the code I added a step parameter to the media widget - it will be in the next release.

1 Like

Late response - but thank you very much for this!