lights on off switch on a webpage

Moderator: Telldus

Post Reply
etka
Posts: 12
Joined: Fri Mar 17, 2023 9:45 am

lights on off switch on a webpage

Post by etka »

hello
i would like to have a lights on off switch on a webpage,
so that a visitor off the page , could turn on or off the light.
has anybody an idea how to build the switch on a webpage?
perhaps with telldus live or a own server
thank you etka
JoGi
Posts: 17
Joined: Fri Mar 17, 2023 9:45 am

Re: lights on off switch on a webpage

Post by JoGi »

I'w done this here: http://blog.ajjm.se/webcam
Simple description is that i'm running tdtool with the php exec().
Longer description is not available now, writing from my phone...
etka
Posts: 12
Joined: Fri Mar 17, 2023 9:45 am

Re: lights on off switch on a webpage

Post by etka »

nice webpage , thats wat i mean, how can i do it?
how looks the html code in the page for the switches , to switch
your lamp at the aquarium .is it with dyndns or telldus live ?
and which files i need on the webserver folder
JoGi wrote:I'w done this here: http://blog.ajjm.se/webcam
Simple description is that i'm running tdtool with the php exec().
Longer description is not available now, writing from my phone...
JoGi
Posts: 17
Joined: Fri Mar 17, 2023 9:45 am

Re: lights on off switch on a webpage

Post by JoGi »

I have a server online @ home that my tellstick is conected to.

There is a simple php-file on the server that executes tdtool.
Executing the php page with a querystring for On or Off will execute the 2 different parameters to turn on or off.
http://site.se/switch.php?on
and
http://site.se/switch.php?off

Code: Select all

$on = $_REQUEST["on"];
$off =  $_REQUEST["off"];

if (isset($on))
	exec("/usr/bin/tdtool --on 1");
if (isset($off))
	exec("/usr/bin/tdtool --off 1");
Then there is some more ajax and crossdomain workarounds that I have done on my webcam-page.
etka
Posts: 12
Joined: Fri Mar 17, 2023 9:45 am

Re: lights on off switch on a webpage

Post by etka »

is the code for the switch.php file on the server?
because in your webpage, i found this code for the buttons
and is the webpage is on your homeserver?

<p>Spotlight: <button id="onSwitch" type="button">Sätt på</button>
<button id="offSwitch" type="button">Slå av</button>
</p>

i have my webpage on a webhoster and the tellstick is not on a server ,
its on a pc and yousing telldus center because i use the telldus center at the pc to switch ....
but i have some videos and fotos , because the space is small at the hoster from my homenet on the webpages via dyndns and portforwarding to my windows home server .
will it work with dyndns portforwarding and a tellstick serversoftware ?



JoGi wrote:I have a server online @ home that my tellstick is conected to.

There is a simple php-file on the server that executes tdtool.
Executing the php page with a querystring for On or Off will execute the 2 different parameters to turn on or off.
http://site.se/switch.php?on
and
http://site.se/switch.php?off

Code: Select all

$on = $_REQUEST["on"];
$off =  $_REQUEST["off"];

if (isset($on))
	exec("/usr/bin/tdtool --on 1");
if (isset($off))
	exec("/usr/bin/tdtool --off 1");
Then there is some more ajax and crossdomain workarounds that I have done on my webcam-page.
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: lights on off switch on a webpage

Post by micke.prag »

If you have your webpage hosted on another computer than the one running TelldusCenter (as in your case) you might find the Telldus Live! api simpler to use.
It is designed for this kind of application.
http://developer.telldus.com
Micke Prag
Software
Telldus Technologies
etka
Posts: 12
Joined: Fri Mar 17, 2023 9:45 am

Re: lights on off switch on a webpage

Post by etka »

in telldus live is the complete home automation , thats not for public!
i only want perhaps 2 light switches for public using
so telldus live is not the way to do it
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: lights on off switch on a webpage

Post by micke.prag »

You don't need to publish all your light. You can freely choose which two lights you whant to expose.
Micke Prag
Software
Telldus Technologies
Post Reply