It is currently April 23rd, 2024, 5:18 pm

Measure WebParser not working with Bar

Get help with installing and using Rainmeter.
Enno
Posts: 10
Joined: December 25th, 2019, 8:36 am

Measure WebParser not working with Bar

Post by Enno »

Hi to all,

I try to add a box with my printer consumables, e.g. toner, waste an so on.
I could get the percentages from my IOBroker installation, where i collect them by SNMP and have an simple.api instance to grab them by rainmeter.

Pulling the values into Text is no problem.
But using in MeterBlackBar it won´t work.
The Bar will be at 0%

Did I have to convert the string into int? I thought, from other topics, that a Measure should give back both, if the string is only numbers.

The Webparser will give back e.g. "52" so I have to substitute the " to nothing.

thanks in advance

Code: Select all

[measureBlack]
Measure=Plugin
Plugin=WebParser
URL=http://172.16.8.64:8087/states?pattern=snmp.0.CanonMF645cx.Black
UpdateRate=60
StringIndex=1
RegExp=(?siU)"val":(.*),
Substitute='"':""

[MeterBlack]
Meter=String
MeterStyle=styleLeftText
MeasureName=measureBlack
X=20
Y=15r
W=78
H=14
Text="%1 %"

[MeterBlackBar]
MeasureName=measureBlack
Meter=BAR
X=55
Y=0r
W=140
H=10
BarColor=0,0,0,255
SolidColor=255,255,255,25
BarOrientation=Horizontal
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure WebParser not working with Bar

Post by balala »

Enno wrote: February 19th, 2023, 2:42 pm Hi to all,

I try to add a box with my printer consumables, e.g. toner, waste an so on.
I could get the percentages from my IOBroker installation, where i collect them by SNMP and have an simple.api instance to grab them by rainmeter.

Pulling the values into Text is no problem.
But using in MeterBlackBar it won´t work.
The Bar will be at 0%

Did I have to convert the string into int? I thought, from other topics, that a Measure should give back both, if the string is only numbers.

The Webparser will give back e.g. "52" so I have to substitute the " to nothing.
Since we can't test (not having access to the source). it is a little bit difficult, however I suggest two things:
  • For first a Bar meter needs to get the value of the measure set in its MeasureName option, as a percentage. This can be achieved by adding a MinValue=0 (the lowest possible value which can be returned by the measure) and a MaxValue=100 (the largest value) option to the measure which returns the value which has to be shown on the bar (in this case to the [measureBlack] measure). Use the correct values, if these are not correct.
  • If the above solution doesn't help, you'll have to use a Calc measure, to get the value of the WebParser measure and "convert" it to a numerical value. Try adding a this kind of measure to your code:

    Code: Select all

    [measureBlackNum]
    Measure=Calc
    Formula=[measureBlack]
    MinValue=0
    MaxValue=100
    DynamicVariables=1
    Now modify the MeasureName option of the [MeterBlackBar] meter to MeasureName=measureBlackNum.
    Note that the above [measureBlackNum] measure has set the MinValue and the MaxValue options. I set them to MinValue=0 and MaxValue=100, since most probably this is the case, but take care to use the proper values, if these are not correct. What the bar will show you, depends on how are you setting these values.
If you did add this measure, remove the previously added MinValue and MaxValue options from the [measureBlack] measure.
If none of these solution work, post please the code which is accessible through the address set in the URL option of the [measureBlack] measure.
Enno
Posts: 10
Joined: December 25th, 2019, 8:36 am

Re: Measure WebParser not working with Bar

Post by Enno »

Hi balala,

second solution was the correct one.
have to set a new measure blackNum with the min/maxvalue and use it in the meter bar.

now it looks like expected:
2023-02-19.17_04_49--C__Users_Lars_Documents_Rainmeter_Skins_Enno_IOBroker_IOBroker.ini.png
thanks for this quick reply.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure WebParser not working with Bar

Post by balala »

Enno wrote: February 19th, 2023, 4:07 pm second solution was the correct one.
have to set a new measure blackNum with the min/maxvalue and use it in the meter bar.
Great! :thumbup:
Enno wrote: February 19th, 2023, 4:07 pm now it looks like expected:

2023-02-19.17_04_49--C__Users_Lars_Documents_Rainmeter_Skins_Enno_IOBroker_IOBroker.ini.png
Did you download this skin from the Forum? Because a while ago (well, in fact 10 years ago - OMG!!!) I had a skin looking like the one in your screenshot and am wondering if that is the skin you're using.
Enno wrote: February 19th, 2023, 4:07 pm thanks for this quick reply.
You're welcome. I'm glad if I helped.
Enno
Posts: 10
Joined: December 25th, 2019, 8:36 am

Re: Measure WebParser not working with Bar

Post by Enno »

balala wrote: February 19th, 2023, 7:31 pm Did you download this skin from the Forum? Because a while ago (well, in fact 10 years ago - OMG!!!) I had a skin looking like the one in your screenshot and am wondering if that is the skin you're using.
Nope, it´s not based on your script.
The Base is illustro pulsar from Pul53dr1v3r
Rest is self developed and based on my ioBroker installation.
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure WebParser not working with Bar

Post by balala »

Enno wrote: February 20th, 2023, 8:06 am Nope, it´s not based on your script.
The Base is illustro pulsar from Pul53dr1v3r
Rest is self developed and based on my ioBroker installation.
Alright, was just curious...