400 error when using a rollershutter component on a page

I started playing with pages and create a cell with a rollershutter control element linked to a rollershutter item. When I click the up/down button nothing happens. I wasn’t able to see anything in the logs, so I opened the web developer tools of the browser and noticed a 400 (bad request) call when I click the button.

I tried GETing the same URL and could verify the OpenHAB API is reachable:

curl -s \https://openhab.app.mewald.io/rest/items/kitchen_rollershutter | jq .
{
  "members": [
    {
      "link": "https://openhab.app.mewald.io/rest/items/kitchen_rollershutter_position",
      "state": "0",
      "type": "Dimmer",
      "name": "kitchen_rollershutter_position",
      "label": "Position",
      "category": "rollershutter",
      "tags": [
        "OpenLevel",
        "Opening"
      ],
      "groupNames": [
        "kitchen_rollershutter"
      ]
    },
    {
      "link": "https://openhab.app.mewald.io/rest/items/kitchen_rolltershutter_control",
      "state": "0",
      "type": "Rollershutter",
      "name": "kitchen_rolltershutter_control",
      "label": "Steuerung",
      "category": "rollershutter",
      "tags": [
        "OpenState",
        "Opening"
      ],
      "groupNames": [
        "kitchen_rollershutter"
      ]
    }
  ],
  "link": "https://openhab.app.mewald.io/rest/items/kitchen_rollershutter",
  "state": "NULL",
  "editable": true,
  "type": "Group",
  "name": "kitchen_rollershutter",
  "label": "Rollo",
  "category": "rollershutter",
  "tags": [
    "Blinds"
  ],
  "groupNames": [
    "kitchen"
  ]
}

Your title says error 404. The screenshot says error 400.
They are different errror messages.
404 indeed says that the endpoint/page is not available.
In your case ( 400 ) the error means that the request on the client site is not correct.
Unfortunately the complete request cannot be seen in the screenshot. The content of the request is missing.
The curl request is a GET request and not comparable to the POST request.
Could it be that in your POST request the command to be send is missing/empty ?

Oh yeah, I made a mistake there in the title. Fixed it.

Of course, the GET is not the same as a POST but at least is verified the endpoint exists and is reachable. Since I am running on Kubernetes with an Ingress controller, I figured it makes sense to verify the response doesn’t come from the ingress controller.

Here’s the full request as a curl. Apparently, the payload is just the text “DOWN”.

curl 'https://openhab.app.mewald.io/rest/items/kitchen_rollershutter' \
  -H 'authority: openhab.app.mewald.io' \
  -H 'pragma: no-cache' \
  -H 'cache-control: no-cache' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
  -H 'authorization: Bearer **************************' \
  -H 'content-type: text/plain' \
  -H 'x-requested-with: XMLHttpRequest' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'accept: */*' \
  -H 'origin: https://openhab.app.mewald.io' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://openhab.app.mewald.io/' \
  -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
  -H 'cookie: X-OPENHAB-SESSIONID=3f4d7617-cf41-48e7-96eb-f361b3b22081' \
  --data-raw 'DOWN' \
  --compressed

I am missing the -X POST in your curl statement. But I don’t know if curl uses POST as soon as --data-raw is part of the command. Does the access work when you use the API explorer ?

Yeah, curl creates a POST when there’s one of the data parameters.

The API explorer shows the same result:


It looks like you are trying to send the DOWN command to the equipment group and not to the rollershutter point item. In that case the error is probably because the first member of that group is a dimmer item and I don’t believe DOWN is a valid command for dimmer items.

Possible. This works:

curl 'https://openhab.app.mewald.io/rest/items/kitchen_rolltershutter_control' \
  -H 'authority: openhab.app.mewald.io' \
  -H 'pragma: no-cache' \
  -H 'cache-control: no-cache' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
  -H 'authorization: Bearer *******************' \
  -H 'content-type: text/plain' \
  -H 'x-requested-with: XMLHttpRequest' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'accept: */*' \
  -H 'origin: https://openhab.app.mewald.io' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://openhab.app.mewald.io/' \
  -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
  -H 'cookie: X-OPENHAB-SESSIONID=3f4d7617-cf41-48e7-96eb-f361b3b22081' \
  --data-raw 'DOWN' \
  --compressed

I thought, since I group those points in equipments (everything is an item in the end, isn’t it?) I could use those.

An equipment is just a regular group item with an extra semantic tag. Group items propagate whatever command they receive to all the member items, but they are not intelligent about it, there’s no filter to prevent commands from going to an incompatible object. For the semantic groups you are very often going to have too many different types of items in the group to be able to broadcast a sensible command via that group.

Typically if you want to be able to use a group to send a command to a lot of similar items at once, you will create a group just to hold those items for that purpose.