ioBroker / ioBroker.simple-api

HTTP-API Interface to read and write objets and states
MIT License
40 stars 19 forks source link

Cannot set value of a single button object #106

Closed raintonr closed 2 years ago

raintonr commented 2 years ago

Through a Loxone adapter, I have the following state showing in the objects tree:

{
  "type": "state",
  "common": {
    "name": "Doorbell Trigger: pulse",
    "read": false,
    "write": true,
    "type": "boolean",
    "role": "button"
  },
  "native": {
    "uuid": "1868dea6-00fc-013a-fffff62eeb38b63d"
  },
  "from": "system.adapter.loxone.0",
  "user": "system.user.admin",
  "ts": 1640294977643,
  "_id": "loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse",
  "acl": {
    "object": 1636,
    "state": 1636,
    "owner": "system.user.admin",
    "ownerGroup": "system.group.administrator"
  }
}

In the admin web interface a pushbutton is shown. When I press this (in the web interface) an update triggers as expected.

I should be able to trigger the same action with the REST API by hitting...

http://x.x.x.x:8087/set/loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse&value=1

... yet the above does not work and returns a 500 server error to the client. Nothing is shown in the IOB log. I tried value=true with the same result.

However, using setBulk like this...

http://x.x.x.x:8087/setBulk/?loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse=1

... does work!

The single set logic clearly has some kind of flaw which needs to be fixed.

Apollon77 commented 2 years ago

Please repeat the call to set (with value true please!) with enabled debug log and show it

raintonr commented 2 years ago

I tried value=true with the same result.

:stuck_out_tongue_closed_eyes:

OK, for the debug, tried again with that and absolutely nothing came out.

Apollon77 commented 2 years ago

And you really set debug loglevel for the instance? Admin - Instances - expert mode enable - expand instance settings, change loglevel from info to debug?

raintonr commented 2 years ago

Yes. I even stopped it on from the admin page and ran from shell using this:

DEBUG=* node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js debug simple-api.0

When I use 'setBulk` this comes out...

2021-12-26 08:49:19.012  - debug: simple-api.0 (8183) Values: {"loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse":"1","user":"system.user.admin"}

... but trying set I see absolutely nothing and a server error returned to client.

Apollon77 commented 2 years ago

Can you please do the call via "curl" with also -v and show me what the body is on such an eror 500? In the adapter testing the "/set/" is tested the same as your example on top

raintonr commented 2 years ago

Ahhhhh... look what I've done :clown_face:

http://x.x.x.x:8087/set/loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse&value=1

This works just fine:

http://x.x.x.x:8087/set/loxone.0.1868dea6-00fc-013a-fffff62eeb38b63d.pulse?value=1

Apollon77 commented 2 years ago

hehe ... I was also not seeng this important but minor change :-(