dzvent sendtoURL to control switches on another Domoticz server

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
andrhrstv
Posts: 2
Joined: Friday 10 May 2024 10:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

dzvent sendtoURL to control switches on another Domoticz server

Post 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
User avatar
habahabahaba
Posts: 233
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: dzvent sendtoURL to control switches on another Domoticz server

Post by habahabahaba »

what are Dz versions ?
HvdW
Posts: 617
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: dzvent sendtoURL to control switches on another Domoticz server

Post 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.
Bugs bug me.
User avatar
waltervl
Posts: 5902
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: dzvent sendtoURL to control switches on another Domoticz server

Post 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==
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
andrhrstv
Posts: 2
Joined: Friday 10 May 2024 10:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzvent sendtoURL to control switches on another Domoticz server

Post by andrhrstv »

@waltervl i can't believe I've missed this one, thanks for pointing it out, it worked.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest