#759 tuner interval usage in haystack

Anilkumar Venkatesan Wed 20 Nov 2019

Hey team, We are new to haystack, we are in process of using tuner concepts, where we have defined an Entity, which has minValue, maxValue, but i couldnt see any interval kind defined. Is anything of this kind available, if so, is there any referral to it? say for Enum we have it as 0,1,2,3 which is mapped to say ("off, auto, coolonly, heatonly"). we normally like to have min, max, interval (or increment), so that in UI it can shown as a dropdown.

Brian Frank Wed 20 Nov 2019

If you are new to Haystack, make sure you are using the Haystack 4 docs.

An enumeration definition in Haystack 4 looks like this:

def: ^myEnum
is: ^str
enum:
  - off: help here
  - auto: help here
  - coolonly: help here
  - heatonly: help here

Also see enum tag for more options.

An interval would be a tag that subtypes from duration which is effectively a Number value restricted to have a time unit (hr, min, sec, etc):

def: ^myInterval
is: ^duration
minVal: 1min
maxVal: 5min

Anilkumar Venkatesan Wed 20 Nov 2019

Hi Brian,

Thank you for the reply, we are clear about enums. But the duration def we also know that and for interval as you mentioned it restricts only to Time like hr, mins,secs.

But for our piece, we need some thing common float interval say if my range can be only from -20 till +20 and it increments by say 5, in this case it will be like -20,-15,10,-5,0,5,10,15,20 will be my range, where user can select only within this values.

is there anything haystack supports like this?

Brian Frank Fri 22 Nov 2019

There is no standard tag for those semantics today. I would probably call it incrementVal myself as a peer to minVal and maxVal

Login or Signup to reply.