Trouble understanding rangeValue


#1

1) Give a description of the problem

I’m trying to use rangeValue to change the header of the gauge to read Winter/Spring/Summer/Fall based on the number of days in the year

image

2) What is the expected behaviour?

According to the number of days in the year, the gauge header should read (0-91) “Winter”, (92-182) “Spring”, (183-274) “Summer”, (275-365) “Fall”

3) What is happening/not happening?

Can’t get the variables to work correctly.

[EDIT] I guess I should tag @WCmore, since it’s his tile I’m trying to recreate.

**4) Post a Green Snapshot of the piston

5) Attach logs after turning logging level to Full

+6ms ╔Received event [Home].test = 1616256501948 with a delay of 1ms,canQueue: true, calledMyself: false
+49ms ║RunTime initialize > 48 LockT > 0ms > rtDT > 32ms > pistonT > 31ms (first state access 16 7 41)
+52ms ║Runtime (7934 bytes) successfully initialized in 32ms (v0.3.113.20210211_HE)
+52ms ║╔Execution stage started
+55ms ║║Cancelling statement #1’s schedules…
+65ms ║║Calculating (integer)0
+67ms ║║Calculating (string) + (string)0 >> (string) 0
+69ms ║║Calculating (string) 0 + (string) >> (string) 0
+81ms ║║Calculating (string)79 + (string) " Days" >> (string)79 " Days"
+85ms ║║Executed virtual command setTile (1ms)
+92ms ║║Calculating (string)Days of the Year: + (string)79 >> (string)Days of the Year: 79
+93ms ║║Executed virtual command setState (0ms)
+96ms ║╚Execution stage complete. (44ms)
+98ms ╚Event processed successfully (97ms)

#2

Another undocumented function. Sorry I don’t have an answer. I’ve never heard of this function. Where did you find out about it?

EDIT: I found the documentation. Looks like you are missing the default value. I think you could remove the ‘0’ so ‘winter’ becomes the default value. Like this:

range value({dayOfYear}, 'winter', 91, 'spring', 182, 'Summer', 274, 'Fall')


#3

rangeValue


#4

I looked at that earlier. It didn’t help. :frowning:

@guxdude, nope. I’m sure the problem is I’m not formatting the text correctly, but I’ve tried all manner of ways with no luck.


#5

I was just documenting the function. I’m on my phone and haven’t looked been able to look at the piston.


#6

I know. Unfortunately, that link was referring to color values, and I need to carry over text.


#7

Seems to work fine. I did these tests:

putting any value in for the input worked fine:

using the dayOfYear came up with the correct answer:

Not sure what problem you ar having…

Wait a minute. You are using dayOfYear before you define it. try switching the order of your define statements.


#8

And while I did that, I noticed I had extraneous vertical bars in the command

{ I rangeValue({dayOfYear}, ‘Winter’, 79, ‘Spring’, 182, ‘Summer’, 274, ‘Fall’) | }

Now the piston works. Thank you!!! :smiley:


#9

I was going to ask you about those next. Glad you got it working. :smile: