Number type variable acting odd in RM5

c7 and RM5.1:

I can create a Number variable (called now) and with initial value to 0. then i create another Number variable (called lastrun) to 0.

i create a rule that has two actions -- set var now to now() in milliseconds, and then set var last = var now. but var now ends up being -927572611.

Screenshot 2022-03-26 at 20-44-15 test1

to test if the Number variable could actually hold a bigint, i edited the variable manually and set it to 1648341980412. works fine.

i cant imagine im doing something wrong- bug ?

Just for the sake of discussion, what happens if you name the variable something other than now?

1 Like

similar type of oddness. if i set a variable to a constant big number and then set another var to that, both are set like they've overflowed.

actually it looks like there's some int vs bigint problem.. it starts at 2147483648.

i can edit the variables manually and set them huge. so those Number types must be bigint. is the UI stuck in int ?

Definitely looks like an overflow, might be able to use a string variable convert it to number to do the math and then store back as string.

Tagging @bravenel

1 Like

I will look. I thought I had weeded out all of the int references...


Yeah, found a few lurkers. Fixed for next release. Thanks!

1 Like

Download the Hubitat app