Page 1 of 1

dzvent sendtoURL to control switches on another Domoticz server

Posted: Friday 10 May 2024 10:45
by andrhrstv
Hi all,

I used dzvent sendtoURL to control devices on another Domoticz server that I have, but because of the authentication changes in the recent versions of Domoticz I can't get my dzvents to authenticate to the API of the other Domoticz anymore.

The 2 Domoticz servers communicate thru public IPs.
I used to send the username and password as parameters in the URL, but that is now deprecated.
I tried "Allow Basic-Auth authentication over plain HTTP (API only)."
I have tried this now (as well as variation without the Basic, thru HTTP and HTPS as well):

Code: Select all

		domoticz.openURL (
                    {
                url = 'https://DNS.name/json.htm?type=command&param=udevice&idx=66&nvalue=0',
                method = 'GET',
                headers = {
                  Authorization = "Basic <YWRRANDhOM4=:QrRANDOgfMTkw>" 
                  }
                }
        )
So wanted to find out how anyone else had overcome this and what you are using.

Cheers

Re: dzvent sendtoURL to control switches on another Domoticz server

Posted: Saturday 11 May 2024 18:55
by habahabahaba
what are Dz versions ?

Re: dzvent sendtoURL to control switches on another Domoticz server

Posted: Saturday 11 May 2024 20:05
by HvdW
Try this:
https://www.domoticz.com/wiki/Setting_up_Device_sharing
Much easier.
Choose which sensors or switches wil apparaat in the other domoticz setup.

Re: dzvent sendtoURL to control switches on another Domoticz server

Posted: Sunday 12 May 2024 15:07
by waltervl
According Domoticz API documentation the authorization header should contain one encoded string "username:password" You seem to have split it up into 2 strings.
When creating your own app or script this is not always done for you.

First the username and password are combined into one string "username:password"
This string is encoded using the RFC2045-MIME version of base64
The authorization method and a space i.e. "Basic " is then put before the encoded string.

This results in a header in the following format:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Re: dzvent sendtoURL to control switches on another Domoticz server

Posted: Tuesday 14 May 2024 18:15
by andrhrstv
@waltervl i can't believe I've missed this one, thanks for pointing it out, it worked.