FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: Lectere am 16 Januar 2013, 04:16:59

Titel: Is it possible to send messages using pushingbox.com to android?
Beitrag von: Lectere am 16 Januar 2013, 04:16:59
Sorry, my German is bit rusty, so I write in English.

I'm using a raspberry pi with a WiFi stick, and a serial cul connected to the serial port.

I have a fs20TK a fs20 doorbell switch, and I like to send a push notification to my android device. With my old arduino I was using pushingbox.com to send messages to my android notifry app.

Is it also possible to use fhem to launch push notifications to android/notifry?

Vielen dank fur ire hifle!
Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: Lectere am 16 Januar 2013, 04:20:20
GET Method
curl "http://api.pushingbox.com/pushingbox?devid=v0123456789ABCDE (//api.pushingbox.com/pushingbox?devid=v0123456789ABCDE)"
POST Method
curl -d "devid=v0123456789ABCDE" http://api.pushingbox.com/pushingbox (//api.pushingbox.com/pushingbox)
Using PHP method :
$ch = curl_init('http://api.pushingbox.com/pushingbox?devid=v0123456789ABCDE (//api.pushingbox.com/pushingbox?devid=v0123456789ABCDE)');
curl_exec ($ch);
curl_close ($ch);

This is how to adress pushingbox.com
Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: fiedel am 16 Januar 2013, 14:29:22
Hi,

this should be no problem. Just make a little shell- bash- php- or whatever script wih these GETs or POSTs, that works into the linux- bash. Then setup your notify in fhem and call the shellscript like this:

{system("/path to your script/yourscript.sh")}

First try to enter this line in the fhem command field and press the enter key!

Note: The curly brackets you need also to try it into the fhem- command field. In the notify, it works this way:

define Doorbell_N notify fs20TK:on {system("/path to your script/yourscript.sh")}

Viel Erfolg!
Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: Lectere am 16 Januar 2013, 16:53:48
View more things, whats the best path to store your script, somewhare in the opt/fhem/ folder?

Also, what should be in the .sh script?

Vielen Dank Fiedel!


Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: fiedel am 16 Januar 2013, 18:45:23
You could store it into "/usr/share/fhem/" (or what your FHEM- Modpath is).

With the second question, i cannot help you a lot. I do´nt know the pushingbox- API, but at least, in the script there must be the call or command, that you want to send to pushingbox.com. I´m not very familiar with scripts, so maybe someone else can help you more. However, here is a link with an example, that shows you roughly, what i mean:

http://tech.thejoestory.com/post/22796434169/pushingbox-com-web-service (//tech.thejoestory.com/post/22796434169/pushingbox-com-web-service)

Best regards

fiedel
Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: fiedel am 16 Januar 2013, 21:07:49
I found another example how to do in FHEM!
It´s in german and shows how to send a temperature, but it´s very close to what you are looking for:

http://merlin2010.blogspot.de/2013/01/twitter-und-karotz-nachrichten-von-fhem.html#!/2013/01/twitter-und-karotz-nachrichten-von-fhem.html (//merlin2010.blogspot.de/2013/01/twitter-und-karotz-nachrichten-von-fhem.html#!/2013/01/twitter-und-karotz-nachrichten-von-fhem.html)
Titel: Aw: Is it possible to send messages using pushingbox.com to android?
Beitrag von: Lectere am 16 Januar 2013, 21:21:49
Danke Fiedel!

I've got it working now!, I've placed the scripts in /opt/fhem/scripts.

I've just copied an existing .sh script, there needs to be something funny in the header to make it work.

Also you have to make sure, that the rights are correct. Otherwise they can't be executed.

Thanks a lot for your help!
Titel: Antw:Is it possible to send messages using pushingbox.com to android?
Beitrag von: xypzo am 24 November 2014, 11:08:04
Please help me out, this is excactly what I want to do.

I never wrote a .sh script in my life.

How would a simple .sh script look like for this request:

curl "http://api.pushingbox.com/pushingbox?devid=v0123456789ABCDE"
Titel: Antw:Is it possible to send messages using pushingbox.com to android?
Beitrag von: fiedel am 24 November 2014, 17:25:35
Hi xypzo,

if you follow my last weblink above, you don´t need do write a script. Just try to understand what he shows and set it up the same way into fhem. Then you sould be able to send messages from fhem.
If you really need a sh.-script, better read a little linux beginners guide (http://ryanstutorials.net/linuxtutorial/) first, to learn how to manage files and folders, setup rights, owners an so on. And a little shellscript tutorial (http://www.howtogeek.com/67469/the-beginners-guide-to-shell-scripting-the-basics/).