OpenHAB 3.2.0M5 arm64 docker on arm64 Pi4 RaspiOS Bullseye
Howdy! Still trying to get the very basics down in OH3, it’s fighting me every. step. of. the. way.
So, I have a Homie device that controls a preamp. The volume property controls a large sound system.
The homie property is defined like so:
homie/aerohome/outputs-spk-spk-main/volume/$name Volume
homie/aerohome/outputs-spk-spk-main/volume/$settable true
homie/aerohome/outputs-spk-spk-main/volume/$retained true
homie/aerohome/outputs-spk-spk-main/volume/$datatype integer
homie/aerohome/outputs-spk-spk-main/volume/$format 0:100
homie/aerohome/outputs-spk-spk-main/volume 26
In OH2.5, I would have used PaperUI to link an item to this parameter in the Thing, and then added the following statement into the sitemap:
Setpoint item=Workstation_Volume icon="soundvolume" minValue=0 maxValue=100 step=5
Now, the reason I used Setpoint instead of a Dimmer is that dimmers immediately jump to the value you click on, without warning so if you accidentally touch it near 100 you and people around you may all have to change pants. This is bad enough for a smart speaker but with a proper stereo system it is really not fit for use.
In OH3, I tried adding a “Number” item, but then when I try to interact with it, all I get is a Graph! (Analyze)
I tried making it a Dimmer item, then I get a slider, but when adjust it, the slider outputs values between 0 and 1 (decimal values get posted to the /set topic) despite the Homie property clearly stating the range is 0:100. This of course just results in the audio completely muting. Better than getting blasted out of your chair, sure, but still not really usable.
So… How do I do it? What’s a good way of representing a volume control on a Page?
I think I would prefer a setpoint item like you use for adjusting temperature – step size 5 or even 10 does the job nicely.
By the way, I found this topic about setpoints in openhab 3 but I don’t have a grasp of metadata and cards yet so I did not understand the solution.
Besides, in the spirit of “getting day-to-day users out of the business of needing to write rules for every little thing” (@rlkoshak) I would think that the Item range should follow what the Homie property dictates, without having to do textual configuration somewhere… (yes, rules are not metadata, but I think it correlates with the intent, if not with the letter). I will of course do the text configuration to get it to work as long as someone clues me in, just a possible enhancement for the future.
Now, here’s a pipe dream.
I write audio processing software for a living.
I solved the on-screen volume control problem in my own user interface ten years ago.
Here’s how I did it.
You press down anywhere on the slider. It depresses but does not change the value.
Then you move left or right while holding your finger down. The slider follows your movement in an accelerated/decelerated fashion depending on your speed of movement, and it follows you as you go outside the physical boundaries of the slider on the screen, as long as you don’t let go. This way you can set an absolutely accurate value, and it never jumps to an unintended value. It works equally well with a finger on a touch screen as it does with a mouse.
Finally, when you do let go, you’ve probably noticed how the act of letting go of a slider always ends up nudging the value up or down by one, leaving you with a value other what you intended? That is, 49 or 51, somehow never 50?
I actually solved that too. My slider has a little history buffer. When you let go, it jumps to the value it had ~100ms ago. People always pause on the value they want, before letting go, so this way you get the right value.
It works like a dream, and it has for 10 years.
In my own product, it’s not just for volume control, I use it for all sliders.
I think this type of slider would be wonderful as a volume control in openHAB. Any takers?