Problems with numerical values in input cards

  • Platform information:
    • openHAB version: 3.2

I have now setup my Modbus TCP pulse counter (Adam 6250) and I have some issues with the input cards where I want to give an offset value for the pulse counters. The screen shot below shows the problem:
Screenshot 2022-04-03 083004

When I type a decimal number in the input card I get an error message saying “Please enter a valid value”.

Code for the input card is:

value: oh-input-item
  inputmode: decimal
  outline: true
  sendButton: true
  type: number
  validate: false

I have checked the number format in Control panel and “.” is the correct Decimal symbol. I have also tried to use “true” for validate but no effect. When I click the Send-button the value has been updated when I reopen the page. Also the Items page shows that the input value has been updated. Any ideas what is causing this nuisance?

1 Like

I’m having the same issue with wanting to enter electricity prices (tariff) as decimals. Have you or anybody else found a solution or do we need to file a bug report?

If you add this to the config in the yaml, it should work:

step: any

The issue is that the default step for type number is 1. inputmode does not have an impact, that will only influence what keyboard popup appears.
I will see if I can lift this constraint in the code and make the step size optional.

@ Mherwege, many thanks for this tip. This solved the problem.

I have set ‘step: 0.001’ successfully, which did away with the problem, of only accepting integers. The OP’s initial problem and question was about something else, though. It seems, that the validator, is expecting a comma as a decimal separator, even if the locale has the decimal separator set to a dot. Any solution for that?

I do think it was the same issue. He checked the decimal separator, but that has nothing to do with it.

You can just set it to: step: any, litteral any, no value. That will make sure you can put any decimal value.

Created PR #1726 with a proposed fix.