Open DanielBaulig opened 2 years ago
I think the best approach would be to duplicate the action to have a 'number' version. With the naming of both updated to reflect how they operate. The reason being I can see value in supporting things like an 'contains' operator which will only work properly on strings. Perhaps a boolean one is wanted too which would want even less options.
As a workaround until something is done here, you could use the mqtt: Update variable with value from MQTT topic
feedback to create a variable with the value, then use the internal: Check variable value
which does treat them as numbers
All of the following comparisons will always compare two strings. In most cases when people choose operators like greater than or smaller than, the intention is to do a number comparison. The string comparison behavior is very unexpected and to most people probably completely arbitrary.
https://github.com/bitfocus/companion-module-generic-mqtt/blob/15b25e54324b44123e7bc4cede41f9a2538a1808/index.js#L156-L161
Possible solutions: Either the dropdown menu should be extended to also include numeric comparisons (which should lead to both operands being converted to numbers prior to comparison) or an additional toggle should enable number casting.