Is it possible to limit the range to a certain interval ?
Is it possible to specify steps of 0.5 instead of 1.0 ?
Note: I can change the itemtype to number:temperature if needed. Currently it is defined as string to avoid conversions when I send the command string to the device (using http binding).
Hi Hugo,
This should be quite easy. In āsettingsā ā āitemsā select in the search bar your item.
Add meta data and select default list item. Then choose as widget āstepper list itemā.
Now select in your item underneath āMetadataā the ādefault list item widgetā (which should refer to āoh-stepper-itemā). Now you can edit āminā, āmaxā and āstepā.
Hope this helps.
By the way: in my setup I set the item to ānumber:temperatureā. Maybe this is an issue in your definition if above isnāt working.
I just checked and I also have āstate descriptionā set. Just āadd metadataā ā āstate descriptionā and also set here the min/max/step and donāt forget to set the pattern to ā%0.1fā. Then save but also go back to the item overview. Somehow you need to do this before this is activated.
If you now select the item (search bar) you should be able to have a stepping setpoint.
In short:
define item als ātemperature:setpointā,
set semantic class as setpoint and semantic property as temperature
set state description
set default list item widget
and then magic should happen.
Iām on 4.0.2 and waiting to go to 4.1.1 (probably next weekend). If this is a bug (I donāt think so however), I am curious to know.
What did the trick, apart from your suggestion of specifying the state description, was removing the old item and creating a new one. Updating the old item did not work (maybe a OH 4.1.1 bug).
Now I have another problem (Iām afraid Iām not a java expert) ā I use this JS script transformation to send the command to the device:
It worked when i was a string (only one decimal is allowed, and 20 should be sent as 20.0). Now itās a number:temperature and probably I need some sort of conversion.
2024-01-14 18:26:53.244 [WARN ] [ransform.CascadedValueTransformation] - Transformation ignored, failed to parse idOperacion=1019&temperatura=%.1f: The transformation pattern must consist of the type and the pattern separated by a colon
(function(i) {
var array = i.split("\n");
if (array.length > 6) {return array[6].split("=")[1];}
})(input)
If I define the item as number:temperature, I get the actual value from the device but I cannot set it. I would prefer to define the item as number:temperature, but if I canāt transmit the desired value to the device I will keep the item as string.
The problem is this line of code var resultado = "idOperacion=1019&temperatura=" + i;. i is a string when the item is string, but is something else when the item is number:temperature, and in this case needs to be converted to a string.
Hi Hugo, I have some NodeRed scripts running, but, as mentioned, no OH js experience. In NodeRed it can be done converting to string by appending toString(). So it would be i.toString() . You could try this, but else I am out of ideas.
Thank you very much. I know that you chase issues until they are solved, and Iām happy that now it is solved.
The key was when you told me to use console.log(i); this allowed me to make several tests, and the conclusion is:
If, in the http binding, the channel is defined as http:string, this implies that the item must be a string type
but if the channel is defined as http:number, the item can be number:temperature.
I was linking a http:string channel to a number:temperature item and the cmdEcoforestTempObj.js was not event called. Iāve corrected it now in my code.