I'm really not sure of the terminology for this so I'm hoping someone can point me in the right direction.
I want a very simple website where it can be called with a URL to change a variable, and it could also be called with another URL to see the value of that variable. I've done pure html back in the stone-age when we were all still on dial-up but I've not touched web app stuff.
So what would be best technology used to do something really simple like this ? I've no idea if this would be php or whatever ?
DIY Web App for a changeable status ?
Moderators: leecollings, remb0
-
- Posts: 140
- Joined: Wednesday 17 December 2014 17:30
- Target OS: Linux
- Domoticz version: V3.8650
- Location: Jyväskylä, Finland
- Contact:
Re: DIY Web App for a changeable status ?
HTML5 & jquery isnt that bad either 

LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
-
- Posts: 15
- Joined: Tuesday 15 March 2016 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DIY Web App for a changeable status ?
Many thanks - Once you'd confirmed that php was the right sort of thing I got this working in 10 mins with a few lines of PHP
I'm going to use this for geofencing so I can avoid having to make Domoticz visible on the Internet. Geofancy/Locative will be the iPhone and when triggered will call an externally hosted php webpage to set a value stored in a text file to say either left home or arrived home. On the Domoticz box there will be a script which will periodically check the web page and make a Domoticz API call to throw a virtual switch if the status changes.
Nothing elaborate or secure, but will be useful for trivial stuff and not for unlocking doors or turning anything on which could burn the house down

I'm going to use this for geofencing so I can avoid having to make Domoticz visible on the Internet. Geofancy/Locative will be the iPhone and when triggered will call an externally hosted php webpage to set a value stored in a text file to say either left home or arrived home. On the Domoticz box there will be a script which will periodically check the web page and make a Domoticz API call to throw a virtual switch if the status changes.
Nothing elaborate or secure, but will be useful for trivial stuff and not for unlocking doors or turning anything on which could burn the house down

- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: DIY Web App for a changeable status ?
I think a periodic script will cause to much delay for geofencing.
Why not host a PHP server and expose that to the net?
On that server you could do anything you like from limitations to secure login etc.
A simple script could be: (switch.php)
Call the script with a url like:
http://homeip/switch.php?idx=57&cmd=On&token=abc
Only switch 57 and 95 are excepted, only the commands On and Off and is only executed when the token 'abc' is sent with it (you should make that longer, something like WYZPcuetmL8jEqCFom2ckyDYHRtUXA).
Why not host a PHP server and expose that to the net?
On that server you could do anything you like from limitations to secure login etc.
A simple script could be: (switch.php)
Code: Select all
if(in_array($_POST['idx'], array(57,95)) && in_array($_POST['cmd'], array('On','Off')) && $_POST['token']=='abc') {
file_get_contents('http://127.0.0.1:8084/json.htm?type=command¶m=switchlight&idx='.$_POST['idx'].'&switchcmd='.$_POST['cmd'].'&level=0&passcode=');
}
http://homeip/switch.php?idx=57&cmd=On&token=abc
Only switch 57 and 95 are excepted, only the commands On and Off and is only executed when the token 'abc' is sent with it (you should make that longer, something like WYZPcuetmL8jEqCFom2ckyDYHRtUXA).
-
- Posts: 15
- Joined: Tuesday 15 March 2016 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DIY Web App for a changeable status ?
I've now set it all up and its working okay. One of my main objectives here was to avoid exposing anything on my home network.
On the Domoticz server I have a simple bash script running a loop - it checks the external website every 5 seconds and if it sees the home status flag change it then does a curl to throw the virtual switch.
In terms of CPU its not even using 1% of one of the 4 cores on the Raspberry Pi. In terms of bandwidth its just getting a single 1 or 0 so I'm not anticipating this adding up to anything significant.
On the Domoticz server I have a simple bash script running a loop - it checks the external website every 5 seconds and if it sees the home status flag change it then does a curl to throw the virtual switch.
In terms of CPU its not even using 1% of one of the 4 cores on the Raspberry Pi. In terms of bandwidth its just getting a single 1 or 0 so I'm not anticipating this adding up to anything significant.
Who is online
Users browsing this forum: No registered users and 1 guest