Issue of the topic: getting negative value from PV-installation - would like to convert it to positive value before showing on a label
I am retrieving the power generation of my PV-installation. So far so good. I am getting (absolutely logical) negative values. Again, so far so good. Now I would like to change this value into a positive value before showing it on a label.
I am a openHAB newbie - old but still willing to learn.
I searched the internet for hours, and also this community - but didn`t find a solution which I understand or beeing able to implement.
I hoped that there is a solution which can be easily implemented while working in the UI-mode - without a need to create extra files nor programing.
I mean only change the value for display - no state change is planed.
I would like to create a widget just for showing this value on my overview page. it is currently running fine - just showing the (correct) negative value. Just for my “convenience” I would like to show the value as positive value.
Right, sorry. I forgot to convert the item state string to a number. That adds one more level of difficulty. To convert you have to use parseInt (or parseFloat):