feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Send ON/OFF commands remotely to Raspi

Thu Jul 31, 2014 2:17 pm

I now have a new Raspi B+. On it, I intend to have an Apache server, and loaded into the server an HTML file I have already drafted and tested for layout but which currently contains no script code. The HTML file includes a button.The Raspi will be connected to my home LAN when I return there from UK. I'd like to send a heater ON/OFF command from the HTML file(ON/OFF.html) button displayed remotely in a browser when I load it, to a Pyhton application I can write, running on the Raspi to use a solid-state relay to connect/disconnect the mains power to the heater. I've spent hours reading about JavaScript, Ajax, jQuery, Comet on the web and am sure it should be easy but I can't seem to get the exact code into my ancient head.
Anybody having snippets they are willing to pass on will be listened to with much joy.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Send ON/OFF commands remotely to Raspi

Thu Jul 31, 2014 2:53 pm

this Instructable gives instructions for operating a garage door opener from a web page, you should be able to modify the python code to your purpose easily enough.
Doug.
Building Management Systems Engineer.

feverish
Posts: 486
Joined: Wed Jun 27, 2012 2:29 pm

Re: Send ON/OFF commands remotely to Raspi

Thu Jul 31, 2014 7:04 pm

Many thanks. I've read it through a few times and it seems an excellently detailed and understandable tutorial. Wish me luck! I'll report back when it is up and running.
If discrimination is not challenged then we are effectively in collusion with the perpetrators of such behaviour:-Oxford dictionaries

Return to “Automation, sensing and robotics”