custom domoticz page cannot control device from outside wlan

Moderator: leecollings

Post Reply
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

custom domoticz page cannot control device from outside wlan

Post by paede »

Hi
I made a custom html to show and control a webcam.
The camera is a esp32-cam.
Pan and tilt is working via mySensors. In domoticz pan and tilt are dimmers.
I can access the page from wlan and it works perfect.
when I connect from outside wlan (mobile data), i can access the page and the camerapicture works flawless.
Unfortunately the dimmers (pan and tilt) do not respond to the sliders I used in the webpage.
Can someone please have a quick look on the html
turret.zip
html-file
(1.6 KiB) Downloaded 46 times
and tell me what i need to change.
greets paede
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by paede »

Mabe I need to be more precise. I use the following code to change values on the dimmer devices.

Code: Select all

function dim(devicecode,dimlevel){
 execute('PUT', '../json.htm?type=command&param=switchlight&idx='+devicecode+'&switchcmd=Set%20Level&level='+dimlevel, '');
}

function execute($method,$url,$message){
xmlhttp=new XMLHttpRequest();
xmlhttp.open($method,$url,true)
xmlhttp.send($message);
}
<input type="range" min="5" max="100" value="50" onmouseup="dim(286,this.value);;">
idx 286 is the dimmer for pan.
This works on the same network as domoticz, but it doesn't work from outside this network. All other functions of domoticz work from outside this network.
What do I need to change to have functionality from outside lan
User avatar
kiddigital
Posts: 437
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by kiddigital »

Why do you use a ‘PUT’ request? I am not sure if Domoticz handles that correctly.

Try a ‘GET’ request as all data is contained in the URL. No need for a ‘POST’.

Make sure that you have given access to the right IP addresses in Domoticz (remote networks) so it accepts incoming requests.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by paede »

Why do you use a ‘PUT’ request? I am not sure if Domoticz handles that correctly.
I copied this from someone else.
So I just change 'PUT' to 'GET' ?
My knowledge in html and javascript is very basic. I usually copy code and change that to my needs.

domoticz works from remote networks. Only the dimmers on my custom page do not work. when i change those in "normal" devices tab they work.

Thanks
paede
User avatar
kiddigital
Posts: 437
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by kiddigital »

Yes, just change PUT to GET.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by paede »

ok I changed the PUT to GET.
But that did not make any change.

Controlling of pan and tilt works fine on the custom html in local network, but in remote network it does not work.
User avatar
waltervl
Posts: 5363
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by waltervl »

If you use user/password to access domoticz, you have to add that to the json statement in custom page as it is not integrated in Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5363
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: custom domoticz page cannot control device from outside wlan

Post by waltervl »

And additional perhaps add the IP of your domoticz server to the url variable too
see https://github.com/domoticz/domoticz/bl ... om.example
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests