import RPi.GPIO as GPIO
import urllib2
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(26,GPIO.OUT)
true = 1
while(true):
try:
response = urllib2.urlopen('http://softxide.com/iot/home_auto/buttonStatus.php')
status = response.read()
except urllib2.HTTPError, e:
print e.code
except urllib2.URLError, e:
print e.args
print status
if status=='ON':
print "setting GPIO 26 "
GPIO.output(26,True)
elif status=='OFF':
GPIO.output(26,False)
//Open a terminal
//Run these
sudo chmod a+x test.py
//Then
sudo python -i test.py
//And it should work
Scite is text editorOk I played with this a bit and it works if you run this file as is no changes and open there page and click on the on and off buttons it will.
But befor you try let's go over some stuff
First off python uses indentation to tell where the if then ends while loop ends you mess with the indentation the file will error and not run so this is what I do
I use linux and Scite I think it will work on windows what Scite does is it let you test your code
You set it for python and test for indentation and if it's ok you can try it out
To run this you save as say test.py
Yes it's good one to work's great on linux I think it work on windows to but may have problems with python not being the same on the piScite is text editor
Now I have installed pibrellaIf you use the code I just posted it should work I had to fix indentation.
Try it first
pi@raspberrypi:~ $ cd Downloads/Raspi_IoT_Home_Auto-master
pi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo chmod a+x test.pypi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo python -i test.py<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
^A<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
^A<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
Yes, I just fixed the indentation of your code and attached the file to avoid copy paste errors. Sometimes indentation error comes when copying code from forum message.LOl Tsan the code I posted is the same as yours
Sorry I didn't understand I am able to control one led right now but if I want to control two LED so can we do this with link http://softxide.com/iot/home_auto/Yell and a lot easier then that was lol
Setup your own server
Read this http://www.phpeasystep.com/phptu/6.html
How will you control your home device from outside home network ? I think ISP provider will not allow to run web server at home. Might be they will take some charges . I don't think that you will run server at homeYou would want set up your own web server
The whole code have to be changed