KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

MyPi - New iOS App for Home Automation projects

Sun May 22, 2016 12:36 pm

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

Coolmott
Posts: 1
Joined: Wed May 25, 2016 2:07 pm

Re: MyPi - New iOS App for Home Automation projects

Wed May 25, 2016 2:11 pm

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?

Budjes
Posts: 5
Joined: Fri Aug 05, 2016 6:57 pm

Re: MyPi - New iOS App for Home Automation projects

Fri Aug 05, 2016 7:05 pm

Hi,

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

pi@RBPI ~ $ 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:

pi@RBPiServer ~ $ sudo python mypi_server.pyc
RuntimeError: Bad magic number in .pyc file

Also an error.

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

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Sun Aug 07, 2016 7:22 am

Hi,
What Pi model & os do you have?

Budjes
Posts: 5
Joined: Fri Aug 05, 2016 6:57 pm

Re: MyPi - New iOS App for Home Automation projects

Mon Aug 08, 2016 6:06 pm

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...

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Mon Aug 08, 2016 7:24 pm

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

Budjes
Posts: 5
Joined: Fri Aug 05, 2016 6:57 pm

Re: MyPi - New iOS App for Home Automation projects

Mon Aug 08, 2016 9:27 pm

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

pi@RBPi ~ $ 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:
pi@RBPi ~ $ sudo python mypi_server.pyc
RuntimeError: Bad magic number in .pyc file

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

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Tue Aug 09, 2016 1:59 pm

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

Budjes
Posts: 5
Joined: Fri Aug 05, 2016 6:57 pm

Re: MyPi - New iOS App for Home Automation projects

Wed Aug 10, 2016 4:20 am

Dear KobiSnir,

I am somehow a step further. Thx

Before installing PIP:
==================
pi@RBPi ~ $ 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.

pi@RBPi ~ $ 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

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Wed Aug 10, 2016 5:09 am

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...

Aerts0909
Posts: 1
Joined: Fri Nov 04, 2016 9:20 pm

Re: MyPi - New iOS App for Home Automation projects

Fri Nov 04, 2016 9:54 pm

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 ?

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Sat Nov 05, 2016 9:23 am

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...

jayt80
Posts: 22
Joined: Tue Nov 08, 2016 11:53 pm

Re: MyPi - New iOS App for Home Automation projects

Tue Nov 08, 2016 11:56 pm

This is awesome!

Will this work with Siri or HomeKit?

KobiSnir
Posts: 7
Joined: Wed Apr 06, 2016 7:11 am

Re: MyPi - New iOS App for Home Automation projects

Wed Nov 09, 2016 5:08 am

I will support it in the next update...

jayt80
Posts: 22
Joined: Tue Nov 08, 2016 11:53 pm

Re: MyPi - New iOS App for Home Automation projects

Wed Nov 09, 2016 11:15 pm

KobiSnir wrote:I will support it in the next update...
Can't wait! Thanks!

ElEscalador
Posts: 950
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA

Elescalador

Thu Nov 10, 2016 1:53 am

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.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

ember1205
Posts: 13
Joined: Thu Nov 10, 2016 12:39 am

Re: Elescalador

Thu Nov 10, 2016 2:28 am

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.

ElEscalador
Posts: 950
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA

Re: MyPi - New iOS App for Home Automation projects

Thu Nov 10, 2016 1:31 pm

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.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

ember1205
Posts: 13
Joined: Thu Nov 10, 2016 12:39 am

Re: MyPi - New iOS App for Home Automation projects

Thu Nov 10, 2016 2:12 pm

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.

ember1205
Posts: 13
Joined: Thu Nov 10, 2016 12:39 am

Re: MyPi - New iOS App for Home Automation projects

Thu Nov 10, 2016 4:06 pm

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.

eshroom
Posts: 1
Joined: Tue Dec 06, 2016 3:46 pm

Re: MyPi - New iOS App for Home Automation projects

Tue Dec 06, 2016 3:49 pm

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?

Brunereks
Posts: 2
Joined: Wed Dec 07, 2016 2:38 am

Re: MyPi - New iOS App for Home Automation projects

Wed Dec 07, 2016 2:44 am

Hi, you can do this.
Create a DNS account and where you insert your IP in the app you should use 'yourdnsname.dnsprovider.'.

kiwi_cam
Posts: 2
Joined: Thu Feb 23, 2017 3:13 am

Re: MyPi - New iOS App for Home Automation projects

Thu Feb 23, 2017 3:21 am

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

sardjono
Posts: 2
Joined: Thu Mar 16, 2017 4:54 am

Re: MyPi - New iOS App for Home Automation projects

Thu Mar 16, 2017 5:01 am

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:
pi@raspberrypi:~/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

sardjono
Posts: 2
Joined: Thu Mar 16, 2017 4:54 am

Re: MyPi - New iOS App for Home Automation projects

Fri Mar 17, 2017 2:12 pm

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.

Return to “Automation, sensing and robotics”