Skip to content

API responds 400 with oh-input-card #4027

@ErikDB87

Description

@ErikDB87

The problem

I've got this page:

config:
  icon: water
  label: Irrigatie
  order: "7"
  sidebar: true
blocks:
  - component: oh-block
    config:
      title: Sproeiers
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: f7-row
                      config:
                        style:
                          align-items: stretch
                        stylesheet: |
                          .card {
                            flex: 1 1 0px;
                          }
                      slots:
                        default:
                          - component: oh-toggle-card
                            config:
                              item: Kranen_irrigatie_Power_1
                              title: Sproeierschakelaar
                          - component: oh-label-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_1
                              title: Ingestelde sproeitijd
                              visible: =items.Kranen_irrigatie_Power_1.state === 'OFF'
                          - component: oh-input-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_1
                              sendButton: true
                              title: Nieuwe sproeitijd (in seconden)
                              type: number
                              useDisplayState: true
                              visible: =items.Kranen_irrigatie_Power_1.state === 'OFF'
                          - component: oh-label-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_Remaining_1
                              title: Resterende sproeitijd
                              visible: =items.Kranen_irrigatie_Power_1.state === 'ON'
  - component: oh-block
    config:
      title: Druppelslang
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: f7-row
                      config:
                        style:
                          align-items: stretch
                        stylesheet: |
                          .card {
                            flex: 1 1 0px;
                          }
                      slots:
                        default:
                          - component: oh-toggle-card
                            config:
                              item: Kranen_irrigatie_Power_2
                              title: Druppelslangschakelaar
                          - component: oh-label-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_2
                              title: Ingestelde druppeltijd
                              visible: =items.Kranen_irrigatie_Power_2.state === 'OFF'
                          - component: oh-input-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_2
                              sendButton: true
                              title: Nieuwe druppeltijd (in seconden)
                              type: number
                              useDisplayState: true
                              visible: =items.Kranen_irrigatie_Power_2.state === 'OFF'
                          - component: oh-label-card
                            config:
                              item: Kranen_irrigatie_AutoOFF_Timer_Remaining_2
                              title: Resterende druppeltijd
                              visible: =items.Kranen_irrigatie_Power_2.state === 'ON'
masonry: []
grid: []
canvas: []

I tried updating Kranen_irrigatie_Power_2 via the oh-input-card, but:
image|690x86

Nothing is logged in the openHAB log, but that doesn't seem all too illogical, because this is logged in Chrome's log:

index-Buyt_kkZ.js:5219  POST http://192.168.1.9:8080/rest/items/Kranen_irrigatie_AutoOFF_Timer_2 400 (Bad Request)
(anonymous) @ index-Buyt_kkZ.js:5219
pu @ index-Buyt_kkZ.js:5041
postPlain @ index-Buyt_kkZ.js:22815
m2 @ index-Buyt_kkZ.js:23971
i3 @ index-Buyt_kkZ.js:22519
sendButtonClicked @ index-Buyt_kkZ.js:43674
(anonymous) @ index-Buyt_kkZ.js:3303
Nn @ index-Buyt_kkZ.js:1028
Pn @ index-Buyt_kkZ.js:1035
n2 @ index-Buyt_kkZ.js:3134
irrigatie:1 Uncaught (in promise) Bad Request
XMLHttpRequest.send
(anonymous) @ index-Buyt_kkZ.js:5219
pu @ index-Buyt_kkZ.js:5041
postPlain @ index-Buyt_kkZ.js:22815
m2 @ index-Buyt_kkZ.js:23971
i3 @ index-Buyt_kkZ.js:22519
sendButtonClicked @ index-Buyt_kkZ.js:43674
(anonymous) @ index-Buyt_kkZ.js:3303
Nn @ index-Buyt_kkZ.js:1028
Pn @ index-Buyt_kkZ.js:1035
n2 @ index-Buyt_kkZ.js:3134

If I copy the HTTP request "as cURL (bash)", this is the output:

curl 'http://192.168.1.9:8080/rest/items/Kranen_irrigatie_AutoOFF_Timer_2' \
  -H 'Accept: */*' \
  -H 'Accept-Language: nl,en-US;q=0.9,en;q=0.8,de;q=0.7' \
  -H 'Authorization: Bearer [redacted]' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: text/plain' \
  -b 'X-OPENHAB-SESSIONID=[redacted, although that's probably not necessary]' \
  -H 'Origin: http://192.168.1.9:8080' \
  -H 'Referer: http://192.168.1.9:8080/page/irrigatie' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36' \
  -H 'X-OpenHAB-Source: org.openhab.ui' \
  -H 'X-Requested-With: XMLHttpRequest' \
  --data-raw $'60 30\'00"' \
  --insecure

I'm also making a GitHub issue for this.

Expected behavior

I expect a 500 response.

Steps to reproduce

I suppose:

  1. Create an oh-input-card component.
  2. Try to change the state of an item.

Your environment

runtimeInfo:
  version: 5.1.3
  buildString: Release Build
locale: nl-BE
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 21.0.10
  javaVendor: Ubuntu
  osName: Linux
  osVersion: 6.8.0-106-generic
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 77309656
  totalMemory: 544210944
  uptime: 47218
  startLevel: 100
addons:
  - automation-jsscripting
  - binding-astro
  - binding-bluetooth
  - binding-buienradar
  - binding-chromecast
  - binding-gpstracker
  - binding-homekit
  - binding-hpprinter
  - binding-http
  - binding-icalendar
  - binding-mail
  - binding-mqtt
  - binding-network
  - binding-networkupstools
  - binding-openweathermap
  - binding-pihole
  - binding-remoteopenhab
  - binding-semsportal
  - binding-sonos
  - binding-tado
  - binding-tradfri
  - binding-unifi
  - binding-unifiprotect
  - binding-upnpcontrol
  - misc-openhabcloud
  - persistence-mapdb
  - persistence-rrd4j
  - transformation-jsonpath
  - transformation-map
  - ui-basic
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    electron: false
    capacitor: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1.25
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: nl
    languages:
      - nl
      - en-US
      - en
      - de
    onLine: true
    platform: Win32
  screen:
    width: 1536
    height: 864
    colorDepth: 32
  support:
    touch: false
    pointerEvents: true
    passiveListener: true
    intersectionObserver: true
  themeOptions:
    dark: light
    autoDarkMode: true
    bars: light
    homeNavBar: default
    homeBackground: default
    disableExpandableCardAnimation: false
    blocklyRenderer: null
    disablePageTransitionAnimation: false
    hideChatInput: false
    webAudio: false
    visibleBreakpointDisabled: false
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/146.0.0.0 Safari/537.36
timestamp: 2026-03-22T07:24:16.451Z

Browser console

See above.

Browser network traffic

See above, and:

Image

Additional information

N/a

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmain uiMain UI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions