Page 1 of 2

MyPi - New iOS App for Home Automation projects

Posted: Sun May 22, 2016 12:36 pm
by KobiSnir
Hi All,
I have developed a new iOS App & Python script for Home Automation projects:
It's very easy to use, installation takes only couple of minutes.

Please download and try, let me know what you think.

App URL :
https://itunes.apple.com/app/id1098156642

My home automation demo video:
https://www.youtube.com/watch?v=6jnO74Hd3fE

App usage demo:
https://www.youtube.com/watch?v=yNSkWW9n_dA

Setup tutorial:
https://www.youtube.com/watch?v=EHqi5CKSnmQ

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed May 25, 2016 2:11 pm
by Coolmott
Oooh! ooh! ooooh!
This is perfect. I'm looking for something like this in for my automation project, but, I need to mod the UI.
Would you consider sharing source?

Re: MyPi - New iOS App for Home Automation projects

Posted: Fri Aug 05, 2016 7:05 pm
by Budjes
Hi,

I have an issue to run mypi_server.pyc
Python 3.4 is installed.

[email protected] ~ $ sudo python3 mypi_server.pyc
Traceback (most recent call last):
File "mypi_server.py", line 5, in <module>
ImportError: No module named 'RPi'

Looks like import RPi.GPIO as GPIO is not recognized

If I run it by python like:

[email protected] ~ $ sudo python mypi_server.pyc
RuntimeError: Bad magic number in .pyc file

Also an error.

Could you give a hint how to fix...Thx

Re: MyPi - New iOS App for Home Automation projects

Posted: Sun Aug 07, 2016 7:22 am
by KobiSnir
Hi,
What Pi model & os do you have?

Re: MyPi - New iOS App for Home Automation projects

Posted: Mon Aug 08, 2016 6:06 pm
by Budjes
Hello KobiSnir,

Thx for your reply, still having the issue as discribed above.
To come back to your questions

Pi-Model = Pi2
OS =
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian

If more info needed, just let me know...

Re: MyPi - New iOS App for Home Automation projects

Posted: Mon Aug 08, 2016 7:24 pm
by KobiSnir
I guess the GPIO package is missing/not installed.
You can install it by typing :
sudo apt-get install python3-rpi.gpio

It's recommended to update your os by typing:
sudo apt-get update
sudo apt-get upgrade

Re: MyPi - New iOS App for Home Automation projects

Posted: Mon Aug 08, 2016 9:27 pm
by Budjes
Dear KobiSnir,

This GPIO Package was installed long time ago
Many updates and upgrades are done after that...
I have no other issues with using GPIO's.
There are now around 12 in use for several functions.
offcourse I checked and changed the mypi.cfg into free GPIO's

But I followed your instructions again.
Result stays the same

[email protected] ~ $ sudo python3 mypi_server.pyc
Traceback (most recent call last):
File "mypi_server.py", line 5, in <module>
import RPi.GPIO as GPIO
ImportError: No module named 'RPi'

Tried also:
[email protected] ~ $ sudo python mypi_server.pyc
RuntimeError: Bad magic number in .pyc file

Any other suggestions? Would be nice to have this running...Thx

Re: MyPi - New iOS App for Home Automation projects

Posted: Tue Aug 09, 2016 1:59 pm
by KobiSnir
Please try to run python3 and type import RPi.GPIO as GPIO
If you will get the same error than it's not a problem with my script.
Image

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed Aug 10, 2016 4:20 am
by Budjes
Dear KobiSnir,

I am somehow a step further. Thx

Before installing PIP:
==================
[email protected] ~ $ python3
Python 3.4.2 (default, Aug 5 2016, 15:54:33)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi.GPIO as GPIO
>>>
KeyboardInterrupt
No isses with the RPi.GPIO as GPIO
But no connection possible with your app on iphone 6 IOS 9.3.4

By installing re-installing PIP I got a connection (Yes!) on a local network with the app:
I installed these:
sudo apt-get -y install python3-rpi.gpio
sudo apt-get install python3-pip
sudo pip3 install unicornhat

Almost there....But I see a lot of Disconnected/Connected in the log (See below)
and the I/O inputs turning on and off like crazy!
Seems not to be possible to add just one input and one output in the config to check if there is an issue.
What I do not like is that webiopi shows also other GPIO's going on and off as soon I start the app on the phone.
So I took to be sure a other pi2 with nothing hardwired connected on the pi, to be sure no outputs/inputs where send high/low where something physical. is connected.

[email protected] ~ $ sudo python3 mypi_server.pyc
MyPi TCP Server v1.4
Loading configuration file: /home/pi/mypi.cfg
Init GPIO Output pins
Init GPIO Input pins
Pin 7: level=0
Pin 13: level=0
Pin 15: level=0
Listening for incoming connections on Port 5000
Pin 7: level=1
Pin 13: level=1
Pin 15: level=1
Pin 7: level=0
10.0.0.13 Disconnected...
Connected to: 10.0.0.13
Pin 7: level=1
Pin 13: level=1
Pin 15: level=1
Pin 7: level=0
Pin 13: level=0
Pin 15: level=0
Pin 7: level=1
Pin 13: level=1
Pin 15: level=1
Connected to: 10.0.0.13
10.0.0.13 Disconnected...
Pin 7: level=0
Pin 13: level=0
Pin 15: level=0
10.0.0.13 Disconnected...
Connected to: 10.0.0.13
Pin 7: level=1
Pin 13: level=1
Pin 15: level=1
10.0.0.13 Disconnected...
Connected to: 10.0.0.13
Pin 7: level=0
Pin 13: level=0
Pin 15: level=0
Pin 7: level=1
Pin 13: level=1
Pin 15: level=1
10.0.0.13 Disconnected...
Connected to: 10.0.0.13
Pin 7: level=0
Pin 13: level=0
Pin 15: level=0
10.0.0.13 Disconnected...
Connected to: 10.0.0.13

When mypi_server.pyc in the terminal is stopped, the I/O' come back to normal state, that was easy to follow with webiopi

Any suggestions to make this work! Thx in advanced

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed Aug 10, 2016 5:09 am
by KobiSnir
Disconnect message is normal when you quit the app or move it to background...

If you wish to control only one I/O you should change the pin numbers of OUT2 to OUT 8 (use the same as OUT1)
also change IN2 to IN8 (same as IN1).

I guess the reason your I/O goes like crazy is several packages trying to control the GPIO at the same time.
You should stop WebIOPi and see how it works...

Re: MyPi - New iOS App for Home Automation projects

Posted: Fri Nov 04, 2016 9:54 pm
by Aerts0909
Hi,

Works perfect on my Pi 3 B ,
How can I Setup another 8 relays on the same Pi,
and what to do when I use another Pi ?

Re: MyPi - New iOS App for Home Automation projects

Posted: Sat Nov 05, 2016 9:23 am
by KobiSnir
You can not control 16 relays with the same Pi,
However you can control up to 4 devices with the iOS App,
8 relays each...

Re: MyPi - New iOS App for Home Automation projects

Posted: Tue Nov 08, 2016 11:56 pm
by jayt80
This is awesome!

Will this work with Siri or HomeKit?

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed Nov 09, 2016 5:08 am
by KobiSnir
I will support it in the next update...

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed Nov 09, 2016 11:15 pm
by jayt80
KobiSnir wrote:I will support it in the next update...
Can't wait! Thanks!

Elescalador

Posted: Thu Nov 10, 2016 1:53 am
by ElEscalador
Any chance your app can run a command line command? I have several things I can control just fine from an Android app "hot button", but the wife and kids cannot from their iPhones without typing in a ssh client - which really kills usefulness and I don't need them typing in command line anyway.

Re: Elescalador

Posted: Thu Nov 10, 2016 2:28 am
by ember1205
ElEscalador wrote:Any chance your app can run a command line command? I have several things I can control just fine from an Android app "hot button", but the wife and kids cannot from their iPhones without typing in a ssh client - which really kills usefulness and I don't need them typing in command line anyway.
Why don't you create a Safari shortcut on the iPhone (you could do the same with a URL on Android) with a specific URL that will connect to the Pi and have that trigger the command script on the Pi. You can use various controls and such like forcing that that connection come from your local LAN in order to be allowed all through the Apache configuration.

Re: MyPi - New iOS App for Home Automation projects

Posted: Thu Nov 10, 2016 1:31 pm
by ElEscalador
That's an interesting idea. Would take a little more work/doing on my part....I really like how hot button handles it - does the ssh handshake, enters the command to run a program, and actually returns results to me.

Re: MyPi - New iOS App for Home Automation projects

Posted: Thu Nov 10, 2016 2:12 pm
by ember1205
ElEscalador wrote:That's an interesting idea. Would take a little more work/doing on my part....I really like how hot button handles it - does the ssh handshake, enters the command to run a program, and actually returns results to me.
That's a lot more overhead between the devices than loading a simple URL. You'd need to leverage a scripting language on the Pi in order to get it to kick off right away once the URL is loaded. You could also create your own interactive web page that could load different scripts and have the shortcut on the mobile devices load the main page.

Re: MyPi - New iOS App for Home Automation projects

Posted: Thu Nov 10, 2016 4:06 pm
by ember1205
Interestingly, came across this just now: http://www.instructables.com/id/Simple- ... ur-Raspbe/

The piece on installing and configuring the web server might be just what you need.

Re: MyPi - New iOS App for Home Automation projects

Posted: Tue Dec 06, 2016 3:49 pm
by eshroom
Great looking app, thanks for taking the time to make and share.

I am using my Raspberry Pi to open my communal apartment door. I have worked out the hardware side and wiring and wonder if this app can be used remotely so I can open the door (or trigger other relays) over the internet when I am not home?

Re: MyPi - New iOS App for Home Automation projects

Posted: Wed Dec 07, 2016 2:44 am
by Brunereks
Hi, you can do this.
Create a DNS account and where you insert your IP in the app you should use 'yourdnsname.dnsprovider.'.

Re: MyPi - New iOS App for Home Automation projects

Posted: Thu Feb 23, 2017 3:21 am
by kiwi_cam
I'm trying to use MyPi on a Model B Rev 2 Raspberry Pi.

I'm getting an error running MyPi server "ValueError: The channel sent is invalid on a Raspberry Pi", which I believe is saying that this Model doesn't have as many GPIO pins as the script is written for. Any advice on how I can get this working?

Thanks,

Cameron

Re: MyPi - New iOS App for Home Automation projects

Posted: Thu Mar 16, 2017 5:01 am
by sardjono
Had the same problem as kiwi_cam. Mine is an older Pi 1 Model B. Was working fine on my newer Pi 3

Error as follow:
[email protected]:~/mypi $ python3 mypi_server.pyc
MyPi TCP Server v1.5
Loading configuration file: /home/pi/mypi/mypi.cfg
Init GPIO Output pins
Init GPIO Input pins
Traceback (most recent call last):
File "mypi_server.py", line 77, in <module>
ValueError: The channel sent is invalid on a Raspberry Pi

Is it possible to share the mypi_server.py script so that we can do our own fix? Thanks

Re: MyPi - New iOS App for Home Automation projects

Posted: Fri Mar 17, 2017 2:12 pm
by sardjono
Received a reply from KobiSnir, the author of this great tool. I replicate his reply below to benefit Kiwi and others...

> Hi,
> You are getting this error since model 1 uses other pinout, you should
> edit mypi.cfg and replace the pin numbers to avaliable one...

For me, I got it working on my old RPi by remapping the input pins as follow in the mypi.cfg:

IN 1 -> pin 3
IN 2 -> pin 5
IN 3 -> pin 8
IN 4 -> pin 10
IN 5 -> pin 12
IN 6 -> pin 22

Works like a charm.