Supereg / homebridge-http-switch

Powerful http switch for Homebridge: https://github.com/homebridge/homebridge
ISC License
218 stars 36 forks source link

WWW-authentication issue #118

Open frizby66 opened 1 year ago

frizby66 commented 1 year ago

Describe the bug Unable to trigger lock on Dahua Door Panel. Homebridge log returns 401 error

Expected behavior Trigger door lock

To Reproduce Steps to reproduce the behavior: See config.

Version (output of npm list -g homebridge homebridge-http-switch)

Configuration

"accessory": "HTTP-SWITCH",
    "name": "panelrest",
    "method": "GET",
    "switchType": "stateless",
    "timeout": 1000,
    "debug": "true",
    "auth": {
        "username": "xxxxx",
        "password": "xxxxxxxx",
        "sendImmediately": "false"
    },
    "onUrl": "http://xxx.xx.x.xx/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote"

Additional context See attached showing what Dahua API says about 401 authentication errors:-

"Video products support digest authentication, see RFC 2617 for detail. If the http request sent by client does not provide valid "Authorization" header information, video products would return HTTP status code 401 and some information for authentication, then client should calculate authentication information according RFC 2617, and sent request again with authentication information using “Authorization” header. Video products return the required resource only if authorization information correct. For example:

  1. When digest authentication fails, video products’s response is :
  2. Then the client calculates the digest authorization using information like username, password, nonce, HTTP method and URI with MD5, and then sends it to server.When digest authentication fails, video products’s response is “401 Unauthorized” :"
Screenshot 2023-03-29 at 14 55 35
feedericob commented 1 year ago

hi, i have the same problem, you find a solution?

Thanks

frizby66 commented 1 year ago

No!!!

On 29 Sep 2023, at 15:51, feedericob @.***> wrote:

hi, i have the same problem, you find a solution?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/Supereg/homebridge-http-switch/issues/118#issuecomment-1741018273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2T4RTMND7MSQJ6T7UQ4MDX43N63ANCNFSM6AAAAAAWMARSBA. You are receiving this because you authored the thread.

feedericob commented 1 year ago

@Supereg may you help us?

feedericob commented 1 year ago

sendImmediately is BOOLEAN and so the value is without "

{ "accessory": "HTTP-SWITCH", "name": "Gate", "switchType": "stateless", "onUrl": { "url": " http://192.168.1.250/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote", "method": "GET", "strictSSL": false, "auth": { "username": "xxx", "password": "xxx", "sendImmediately": false } } }

frizby66 commented 12 months ago

Great, that worked for me :-)

Now if there was an option to set the switch as a lock, rather than a switch.

On 1 Oct 2023, at 14:58, feedericob @.***> wrote:

sendImmediately and so the value is without "

{ "accessory": "HTTP-SWITCH", "name": "Gate", "switchType": "stateless", "onUrl": { "url": " http://192.168.1.250/cgi-bin/accessControl.cgi?action=openDoor&channel=1&UserID=101&Type=Remote", "method": "GET", "strictSSL": false, "auth": { "username": "xxx", "password": "xxx", "sendImmediately": false } } }

— Reply to this email directly, view it on GitHub https://github.com/Supereg/homebridge-http-switch/issues/118#issuecomment-1742090765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2T4RVWI5RM4DSLJGWUDEDX5FZJZANCNFSM6AAAAAAWMARSBA. You are receiving this because you authored the thread.

feedericob commented 12 months ago

I can't help you on this, the plugin programmer should decide.

However, perhaps the lock button also identifies the opening and closing and if it is a simple gate without a sensor there is no possibility of identifying whether the gate is really open or closed.

you could display it as a push button, but I don't know how to do it.

@Supereg