Multistate instead of numeric
-
Hi,
I've got a variable read from a 2 byte signed register over modbus IP.
It can only take on values of 1,2,3,4,etc. In mango on the data source screen the type of this point is numeric and I can't change it to multistate.I can use the "Range" text renderer and use ranges of 1-1,2-2,etc so the appropriate text is displayed instead of 1 or 2.
In the graphical view multistate image renderer works as well but some flexibility is lost when the type is numeric instead of multistate. For instance I can't assign the same image to multiple states.
Should I convert this numeric to a multistate with a meta point or is there someway to assign the data type of this point to multistate?
Thanks for the help
Craig -
The meta point solution would do it, yes. Maybe we can add to the list to allow modbus points to be multistate.
-
Is this as simple as editing com.serotonin.mango.view.text so that
private static ImplDefinition definition = new ImplDefinition("textRendererMultistate", "MULTISTATE", "textRenderer.multistate", new int[] {DataTypes.MULTISTATE});
reads
private static ImplDefinition definition = new ImplDefinition("textRendererMultistate", "MULTISTATE", "textRenderer.multistate", new int[] {DataTypes.MULTISTATE, DataTypes.NUMERIC});
I can't see any downsides...
-
You'd have to make sure the implementation handles a Double value type. It probably only handles Integer. And the configurater would probably need to be updated too.
-
adding Numeric datatype to the multistate renderer seems like it might be the wrong way to go about it...
Better to add mango multistate datatype to the modbus data point locator: I think I will add a select option to the pointlocator dialog to select either numeric or multistate when a numeric modbusDataType is specified.
I suppose I will have to modify the format the blob pointlocator data is stored in as well to store this additional field.
-
i've got this working, I'll send it along in a few months when it is properly tested.