QNimbus / node-red-contrib-openhab-v2

MIT License
9 stars 3 forks source link

Username and password - Not stored or retrieved incorrectly? #29

Closed fredericdepuydt closed 3 years ago

fredericdepuydt commented 3 years ago

I've been tinkering in the code but apparently wasn't able to solve the fact that my username is never stored (always returns an empty line when retrieving the configuration via the web).

As I'm using an API token generated by Openhab, my hotfix is overwritting the auth{ } part in the node.axios declaration.

    node.axios = axios.create({
      method: 'get',
      baseURL: node.url,
      auth: {
        username: 'oh.nodered.*****************************************************************************',
        password: ''
      },
      httpAgent: new http.Agent({}),
      httpsAgent: new https.Agent({
        rejectUnauthorized: !!config.checkCertificate
      })
    });

This is an ugly fix, and I'd rather fix the code myself. But I'm too unfamiliar with Node.js and Javascript.

I'm running on Openhab 3.0.0 M5

Churator commented 3 years ago

@fredericdepuydt Can you explain in what file? While its ugly its sure some workaround 👍 Edit1: Found it - ./node_modules/node-red-contrib-openhab-v2/nodes/openhab-v2-controller.js Edit2: Even after doing that change, I now can read the item list, but when item change state on OH3, nothing happen in NR still. Same with you ?

BerndN68 commented 3 years ago

I have the same behaviour. By adjusting the "auth:" entry, I can read out data from OpenHAB 3. Unfortunately, events (SSE) do not work.

fredericdepuydt commented 3 years ago

@Churator, @BerndN68 did you also check my other issue/pull request #28 ? That solved the event issue for me.

BerndN68 commented 3 years ago

@fredericdepuydt thanks for the tip. With the changes from #28, it also works for me. Thanks Bernd

Churator commented 3 years ago

@Churator, @BerndN68 did you also check my other issue/pull request #28 ? That solved the event issue for me.

Thanks. Working perfect with your 2 updates. Is it normal that I need full deployment after each new node added ? (Otherwise I can't see "connected" status and its not working)

moonilightshaker commented 3 years ago

I have the same error. Password and username are not saved.