Author Topic: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway  (Read 5395 times)

duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
What:  If you ever wanted a cheap, portable, dedicated “box” which would announce by voice certain status changes from Felix’s excellent moteino/raspberry pi gateway, then the approach below might be of interest.  For example, if the garage door is opening, this device could say something cleaver like “The garage door is opening”. 

Why:   I have my primary cell phone set up to receive a SMS text message from the Gateway for certain critical conditions from the Gateway (like my water leak detector).   These messages need to get to me even if I am away from my house (as long as I have cell service). Verizon claims they have me covered :)   However, for less critical announcements, what I wanted was a small device which I could stick in the corner of a room which could speak. 

How:  The approach I got working simply uses an a old cell phone without cell service to speak a phrase based on receiving a HTTP Post Request with a single trigger word.  No other hardware is required.  The software is very simple.  The Gateway to phone communication remains on your local wifi network and the messages never depend on external SMS or email servers.   For me, the phone is a dedicated box for this task.  By the way, cell phones are amazing devices for repurposing.  There is no way for a do-it-yourselfer to build something with as many technical features for such a low price.  If you do not have an old unused phone, a new pre-paid phone can be found at local Walmart or grocery stores for under $20, or sometimes under $10 on a sale.   Unlocking or rooting the phone is NOT required for this project to work.  Installing two Google Play Store apps alleviates the need to write any software for the phone.
I tried to provide enough steps below to make duplicating this an easy project. 

BEGIN CELL PHONE SETUP

1.  Reset old phone to factory and set up WiFi to your network then set up Gmail to your account.  Don’t use a primary Gmail account; make one specifically for these kinds of electronics activities.  If you don’t have an old unused phone I would recommend buying a new GSM based prepaid phone with android 4.4.2 or higher.  Remove the SIM card before turning it on since the phone does not need to be activated. 

2.  Settings   >  Sound   >  notifications  max   ,  all others   low as possible   

3.  Settings   >  Language and Input  >  Text-to-speech options    pick one for your phone

4.  Install Tasker by Crafty Apps EU,   $3 to buy (from the google play store) https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm     This app allows you to set up multiple profiles, each to do certain tasks (say something) based on contexts being met (receiving a trigger word from the Gateway).   Tasker is very powerful, but I stayed in beginner mode (so far).

5.  Install Tasker Network Event Server  (TNES) by TActHab (from the google play store), https://play.google.com/store/apps/details?id=bidoismorgan.httpevent    This free app has a HTTP server that can handle GET and POST requests on port 8765.   This is a Tasker plug-in which allows Tasker to trigger events when receiving messages over the local network from the Gateway. 

6.  Here is an example of how I set up a Tasker profile to say “You got mail” when TNES receives a new a post request message with the single word “mail”.    I set up a few different Profiles, one for each task, such as “open” to announce the garage door was opening.   I installed this on two phones: an old Verizon Samsung Galaxy S3 running Android 4.4.2 (Kit-Kat)  and a new ATT  Go Phone, ZTE Maven Z812, running android 5.1 (Lollipop).   

Tasker  >  Profiles  >  SetSort   >  User  >  +  >  Event  > Plugin  >  TNES  >  Configuration edit >    delete the Remote broker address (leave blank)   >   Event name:  sayMail   >   Filters: mail      >    [press top left < button TWICE to get back to  Enter Task  >   newTask  +    >  SayMail   >  +   >  Alert   >  Say   >   text   You got mail.      >   engine:  voice search   Samsung-text-to-speech-engine-engUSA      >  stream   notification   >   Respect Audio Focus  and Network  [check  both to enable]


END CELL PHONE SETUP     BEGIN MODIFICATIONS  TO GATEWAY

Add the following to metrics.js  Events  of  the raspberry Pi Gateway software by Felix.   I am still using version 6.

Code: [Select]
mailboxTasker : { label:'Got Mail-> Cell phone speak ', icon:'info', descr: Send http post so old cell phone can announce event', serverExecute:function(node) { if (node.metrics['M'] && node.metrics['M'].value == 'MAIL' && (Date.now() - new Date(node.metrics['M'].updated).getTime() < 2000))  exports.taskerRequest('mail'); } },

Add the following to metrics.js  after the end of the helper functions

Code: [Select]
//  this function sends an HTTP POST request to the  Tasker and TNES app web server 
//  running  on the two android cell phones
exports.taskerRequest = function(triggerWord) {
    request.post({
         headers: {'content-type' : 'application/x-www-form-urlencoded'},
         url:'http://192.168.1.60:8765',     // Galaxy S3
         body: triggerWord },
         function(error,response,body){ }
      );
    request.post({
        headers: {'content-type' : 'application/x-www-form-urlencoded'},
        url:'http://192.168.1.62:8765',     // ZTE Maven
        body: triggerWord },
        function(error,response,body){ }
    );
 
  }
 

END  MODIFICATIONS  TO GATEWAY

Don’t forget to add the EVENT to your Gateway web page.

**********
Some Notes:
**********

I used the term cell phone in the above write-up, but I’m sure you recognize this should work for many other android devices such as tablets, providing they have wifi, a speaker, and Android current enough to run the apps.   What about Apple Fanboys?   The short answer is I have no clue if there are similar apps for IOS and what their configurations might be. 

When you are on the TNES configuration page, notice the HTTP server address at the top of the page.  This is the cell phone local URL (actually of the TNES server).    It is a good idea to assign your cell phone with a static IP address in your WiFi router so it doesn’t change over time.  Also the TNES configuration filters work better in all lower case letters.

My old Samsung Galaxy S3 phone was picky on the text to speech engine selected in the TNES tasks.   If I chose the Google engine, there was a larger delay before the speech started (compared to the ZTE Maven) and about 10% of the time the S3 wouldn’t speak.  I guess a Samsung phone just likes a Samsung engine.

There are alternatives to TNES which are more popular,  like AutoRemote, but I found TNES easy to use and free.  https://play.google.com/store/apps/details?id=bidoismorgan.httpevent&hl=en 
How to use network events for Tasker with TNES plugin  http://thacthab.herokuapp.com/TNES.html

As an option, the Tasker app has a7 day trial version (direct download  http://tasker.dinglisch.net/index.html   However, to use the direct download, you have to enable Unknown Sources under you phones Security setting.  Also, you cannot pay the $3 from inside the app.  You have to uninstall the direct download and then install the $3 play store app.

Tasker is very powerful, but I did not use any advanced features.  If you want to do more with Tasker here may be a useful guide as well as a link to the reddit tasker forum:
http://www.pocketables.com/2013/05/beginners-guide-to-tasker-part-1-5-tasker-basics-new-ui.html 
https://www.reddit.com/r/tasker/
When in Tasker, the phone menu button brings up a dialog box for preferences, backup, etc.

One tool I used to debug this project was the Advanced RestClient extension to the Chrome browser on my PC.   The settings below allowed me to send a message to my cell phone.  So, when that part worked, then I could concentrate on getting the Gateway metrics.js syntax correct.
http://192.168.1.60:8765       >    POST    >   Headers:  Content-Type: application/x-www-form-urlencodedOne     >    Payload:     mail      [then press the Send button and your phone should trigger]

Actually, as a first step to make sure the android (TNES) is running, just paste the phone url, in my example that would be http://192.168.1.60:8765 , into any browser and press return.  This will display a very small Hello World web page served by TNES.

I have no risk in providing my actual IP address for my phone in this forum since it is local to my LAN only.   That address is not available from the WAN.   For these HTTP posts, what goes on in my LAN stays in my LAN.

I tried a couple simple tests.   I streamed a Netflix movie and monitored the Gateway Dashboard web page while sending multiple “mail” messages through the Gateway to the two phones.  No issues.  I powered off one phone and repeated.  Only one phone spoke, but no unexpected issues.  Powered off both phones, no unexpected issues.   Powered back on both phones and [after a couple minutes] they automatically ran Tasker and spoke as intended without any other button pushes.  Great.

Please post here if you find any major issues with my steps.   I would also be interested if you expand the capabilities.

*************
End of my post.   
-- -  Duane
*************
« Last Edit: February 03, 2016, 04:03:10 PM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5992
  • Country: us
    • LowPowerLab
Re: Repurpose an old GSM cell phone to speak for the Gateway
« Reply #1 on: February 02, 2016, 11:32:47 PM »
I have to come back to digest it all but good info here.
Adding GSM could be a critical detail in systems where alarms cannot depend on the internet and mains power.
Thanks for posting this.
« Last Edit: February 03, 2016, 04:13:59 PM by Felix »

duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
Re: Repurpose an old GSM cell phone to speak for the Gateway
« Reply #2 on: February 03, 2016, 12:31:42 PM »
Felix, although I totally agree with your GSM statement, just to be clear to everyone else, that would be a different application of this cell phone/ Tasker concept for a different requirement.    My write-up is simply using an old cell phone for a cheap and easy “speaker” for the gateway using a local LAN only.  This speaker can use a GSM or CDMA phone because it doesn’t actually utilize any cellular network. There are no monthly fees.  The phone does not have to be activated.   The original post did not have “GSM” in the title (it had another term, which is not necessary either).

You got me thinking, though.  If the requirement was as you say “critical in systems where alarms cannot depend on the internet and mains power”, this concept be could be expanded to send a SMS over the cellular network instead of speaking.   Looks like sending a SMS is a built-in Tasker task, so this change “should be” easy.  The key was getting the trigger word from the Gateway to the cell phone.

--- Duane

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5992
  • Country: us
    • LowPowerLab
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #3 on: February 03, 2016, 04:13:09 PM »
Duane,
Sorry for the GSM edit, i just initially scanned the post and saw the GSM keyword and quickly assumed it's got to do with enabling GSM backup/messaging for the gateway.

Thanks for sharing, great project. Somewhere in my mental pile of projects I want to get to is a house console comprising of a [Pi + LCD/monitor] that would display the web interface or perhaps a variant of it, which could also serve as an alarm arming/disarming interface along with showing surveillance, front door camera, latest events and other stuff you want to see live etc. This is somewhat at least complementary to that.

Overall a really nice detailed writeup. Would you consider editing this post for a guest blog entry? I can then post it on the blog. Any photos or whatever media would be a nice eye catcher, you could post that here or on imgur.com and use [ img ] tags. Let me know...

duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #4 on: February 04, 2016, 04:12:37 PM »
Felix,  I appreciate your invitation for a blog post.  To achieve the “eye catcher” quality of your past blogs is probably not something I can do in the near term.   I am willing to make any clean-up changes to the wording or structure of the post if you can provide guidance.   At some point if and when you think it is appropriate, maybe I could post a little link to this post in the Tasker forums and also on the android Google  Play Store Tasker and TNES apps feedback.  There are many real experts for the android Tasker app and I have a feeling they would not only find this moteino/PiGateway/cellPhone combination interesting, they might post some useful capabilities for us all.
   - - Duane

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5992
  • Country: us
    • LowPowerLab
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #5 on: February 05, 2016, 11:47:55 AM »
I would like to find folks that have a desire to post stuff/projects on the blog, and want to invest some effort into doing it nicely, with photos, details, code, video. I am even willing to sponsor hardware and subsidize store credit or cash if it makes sense. Just not sure how to undertake this initiative.
If I ever post other projects I dont want to do a copy paste, instead I want the character and feel of the original owner to be transparent in the posting, that is why I hinted at you making any changes.
Otherwise please feel free to share in other forums where you think this might be useful and have an impact.
Good work, thanks again

duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #6 on: February 17, 2016, 06:27:27 PM »
Felix,  You may use the attachment as you deem appropriate.   No pay is necessary for me.  Many thanks to you and everyone whose ideas, questions, answers, and code I used in my own moteino home projects.

Below is the content of the DOCX, split in 2 PARTS.
« Last Edit: February 18, 2016, 11:22:57 AM by Felix »

duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #7 on: February 18, 2016, 11:16:00 AM »

[Old Cell phone for Cheap & Easy PiGateway Audio/Visual Output, SMS Backup, and More – Part 1

This is the first of a two part post which describes an approach using an old cell phone to perform some very useful functions based on receiving a trigger word from the PiGateway over a local LAN.  Key points are:
   1.   Requires Felix’s PiGateway (or equivalent)
   2.   Requires an inexpensive pre-paid android phone or tablet , no root, no cell service (except if you want to send SMS)
   3.   No other hardware required
   4.   Requires two or three android apps from the Google Play Store
   5.   No software development needed
   6.   Fits into the “easy to implement” category

I will show you how to set up the following examples, but this approach can be used for many more capabilities.
   a.    Announce by voice messages from the PiGateway  (pseudo text-to-speech)
   b.   Provide a large visual indication using the phone screen
   c.    Provide a method of sending critical SMS text messages when there is no internet (See the next-to-last paragraph in Part 2.)

Using Felix’s Framework diagram, I added my depiction of how this approach works:



Below are a couple photos of my dedicated phone (not my primary phone) showing both the garage door is open and I have mail.




First let me explain how I got started.   What I wanted was a small device which I could stick in the corner of a room which could speak based on my PiGateway messages.   After some research, I was surprised to discover this is not a trivial task if you want cheap, easy, portable, looks good, and long range. 

The approach I got working simply uses an a old cell phone without cell service to provide a pseudo text-to-speech output based on receiving a HTTP Post Request with a single trigger word.  Since this worked so well for me, I expanded it to include a large visual display.  The PiGateway to phone communication remains on your local wifi network and the messages never depend on external SMS or email servers.   For me, the phone is a dedicated box for this task.  By the way, cell phones are amazing devices for repurposing.  There is no way for a do-it-yourselfer to build something with as many technical features for such a low price.  If you do not have an old unused phone, a new pre-paid phone can be found at local (USA) discount stores or grocery stores for under $20, or sometimes under $10 on a sale.  I recommend a GSM based prepaid phone with android 4.4.2 or higher.  Remove the SIM card before turning it on since the phone does not need to be activated, unlocked, or rooted. 

I tried to provide enough steps below to make duplicating this an easy project. 
BEGIN CELL PHONE SETUP

Prepare the cell phone.
1.  Reset old phone to factory and set up WiFi to your network then set up Gmail to your account.  Don’t use a primary Gmail account; make one specifically for these kinds of electronics activities.

2.  Settings   >  Sound   >  notifications  max   ,  all others   low as possible   

3.  Settings   >  Language and Input  >  Text-to-speech options    pick one for your phone

4.  Set your phone so the display is always on (settings  >  display  >  Sleep never).    Note in Android 5, this feature has been removed, so install Stay Alive! by SyNetDev from the Play Store.

5.  Turn on developer options  (settings  >  about  >  press Build number a few times until on).   Enter Developer options and check Stay awake.

6.  Install Tasker by Crafty Apps EU,   $3 to buy (from the google play store) https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm     This app allows you to set up multiple profiles, each to do certain tasks (say something) based on contexts being met (receiving a trigger word from the PiGateway).   Tasker is very powerful, but I did not use any advanced features. 
There are many guides and forums if you search the internet. 

7.  Install Tasker Network Event Server  (TNES) by TActHab (from the google play store), https://play.google.com/store/apps/details?id=bidoismorgan.httpevent    This free app has a HTTP server that can handle GET and POST requests on port 8765.   This is a Tasker plug-in which allows Tasker to trigger events when receiving messages over the local network from the PiGateway.  There are alternatives to TNES which are more popular,  like AutoRemote, but I found TNES easy to use and free. 

8.  Set up Tasker Preferences.   Press the top three small vertical squares in upper right corner of Tasker.  Press   Preferences.   Under UI, remove Beginner mode.  Under Misc, check Allow External Access.

9.  Get the phone to say something.    In each Profile, we configure a Task Event  based on the TNES plugin trigger and then Task Actions to speak, change the color of a rectangle, or display a popup.   Here are the detailed steps for sayMail .

 Profiles  +  >  Event  > Plugin  >  TNES  >  Configuration edit >    delete the Remote broker address (leave blank)   >   Event name:  sayMail   >   Filters: mail      >    press top left  button twice to exit back to  create a new task name SayMail   >  check

 +  to add first action  >  Alert   >  Say   >   text   You got mail.      >   engine:  voice search   Samsung-text-to-speech-engine-engUSA      >  stream   notification   >   Respect Audio Focus  and Network  [check  both to enable]  > top left to exit

Here are some screen shots.



         
10.  Test.   Now that we have this small piece set up, let’s see if it works.  When you were in the TNES configuration edit page above,  you may have noticed the HTTP server address at the top of the page.  This is the cell phone local URL (actually of the TNES server).    At some point, it is a good idea to assign your cell phone with a static IP address in your WiFi router so it doesn’t change over time. 
One tool I use to debug the incremental build-up of this project is the Advanced RestClient extension to the Chrome browser on my PC.   The settings in the screen shot below allow me to send a message to my cell phone without worrying about the proper PiGateway syntax.  I have no risk in providing my actual IP address for my phone here since it is local to my LAN only.   That address is not available from the WAN.   

If you have problems with this or to make sure the android (TNES) is running, just paste the phone url, in my example that would be http://192.168.1.60:8765 , into any browser and press return.  This will display a very small Hello World web page served by TNES.




11.  Set up other voice actions.   Once you are happy with the way the first profile works, you can repeat similar steps for the other profiles, changing as appropriate for the voice actions desired.   You can refer to the table in Part 2.

Go to Part 2 to continue setup and further discussion.


duane1

  • Newbie
  • *
  • Posts: 9
  • Country: us
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #8 on: February 18, 2016, 11:17:51 AM »
Old Cell phone for Cheap & Easy PiGateway Audio/Visual Output, SMS Backup, and More – Part 2

12.  Determine other Profiles/Tasks/Scenes for Tasker
I wanted the normal state of the phone display to be all black.  Then when a PiGateway trigger words are received, I want to be able to hear the voice description and clearly see the display change via different colors visible from across a large room.  My requirements are for two steady state conditions (mail and garage door) plus a transient condition of someone tripping the safety sensor of my garage door.  See table below.




13.  Set up Tasker scenes for the three colored rectangles.  You can skip this if you only desire a voice output.  I use one scene containing two rectangles and two text elements, one each for the garage open and the mail.  I set up a second scene with a pop-up with a 10 second timeout to display the garage door safety sensor being tripped.   Initially the rectangles are colored black and since the background and text are black, the phone display appears all black.  Based on receiving the correct trigger word, the rectangle color is changed from black to another color, which provide a good visual and the black text appears.  Here are more detailed steps:

In Tasker press Scenes.   Make a scene called Display1 and size it to fill most of the display area.  Then long click inside of the Display1 to add an element, select Rectangle.  Keep the default name Rectangle1.  Change color to black (magnifying glass/slider to max intensity/touch bottom right corner/press OK)

Press top left arrow to exit editing that element. Use your finger to resize and move the rectangle to top of display, full width, 2/3 of display height.  This can be a little tricky to do on a small phone.

Press the + symbol on bottom center to add another rectangle to Display1.   Color black.  Place Rectangle 2 on the bottom 2/3 of Display1.

Press the + symbol on bottom center to add text (Text1) to Display1.   Change the Text field to Got Mail. Text Size 50.  Temporarily, change the text color to white so it will show up over any colored background.  Once you are satisfied with the final layout, simply go back in and change the text to black. Press top left arrow to exit editing that element.  Back on the Display1, position Text1 over Rectangle1. To make Display1 background black, select Display1, press the three small vertical squares in top right, select preferences, then change the background color to black.

Repeat to add Text2 to Rectangle2, Text field Garage Open.

Once Display1 is set up, we are ready to setup a second display for the pop-up.   In Scenes, press + on bottom to add another display, Display2.   Size and position to full width in the middle 2/3 of the phone.  Exit scene editor.  Select  Display2 to edit.  Press the three small vertical squares in top right corner.  Select  Properties, and change background color to yellow.  Then exit properties (top left).  Long Click to add text.   Change the text field to Garage entry.  Notice the default name is Text1.  That is ok, because it is Text1 of Display2, separate from Text1 of Display1.   The scenes are now set up.

14.   Add to the Profiles.    Since we already have the task actions to speak for each profile, we need to add the task action to display the rectangles.  Here are the detailed steps for sayMail   

  +  >  Scene >  Element Back Color  >  Scene Name   search select Display1  >   Element   search select Rectangle1   >   Color and End Color   select blue  >  exit edit > exit task
You can repeat similar steps for the other profiles, deleting or changing as appropriate for the actions and visual effects desired.   The popup is slightly different, so here are the detailed steps for the action.

SaySafety +   >  Alert   >  Popup  >  Text  Garage Entry   >  Layout  Display2  >  Timeout (seconds)  10

15.  Always run Event.   We need to add one more Event to make Tasker always run.   After you perform the steps below to do this, the phone display will be completely black.  Pressing any of the normal phone buttons will bring up a new window which will immediately activate this Event in Tasker and turn the display black.  This seems like an infinite loop.  To exit, pull down from the top of the display.  Select Tasker.  Temporarily turn off this Event if you are editing in Tasker.
Tasker  > Profiles  >   + to add new Event  > UI  >New Window  >  no changes, just press top left to exit ,   OK to accessibility enable  >  Accessibility On  >  top right slider to 1  >  Exit >   >  Tasker On  top right slider to 1  >  Exit >    New Task >  leave name blank, just press check mark  >  +  Scene  >  Show Scene  >  search and select Display1  >  Display as Activity, Full Display No Bar > Animation None  >  uncheck  show exit button   > top left to exit
I like to turn off auto updates for all the apps on the phone since this is a dedicated device and I don’t want it busy downloading an update when it needs to be receiving a message from the PiGateway.   Open Google Play > tap the hamburger icon (three horizontal lines) on the top-left  >  Settings >  Auto-update apps  >  select Do not auto-update apps.
I like to back all this up so I won’t have to type it in again if my phone gets corrupted.  First, you can backup to your phone.   Tasker  >  top three vertical squares in upper right  > Data  > Backup  > I like to add the date in the filename.   Second, I like to backup to an external device, Google Drive.  Tasker  >  top three vertical squares in upper right  > Data  > Share > Drive  >  I like to add the phoneName and the date in the filename.       

END CELL PHONE SETUP     BEGIN MODIFICATIONS  TO GATEWAY

16. Add the following to metrics.js  Events  of  the raspberry Pi Gateway software by Felix.   I am still using version 6.

Code: [Select]
mailboxTasker : { label:'Got Mail-> Cell phone speak ', icon:'info', descr: Send http post so old cell phone can announce event', serverExecute:function(node) { if (node.metrics['M'] && node.metrics['M'].value == 'MAIL' && (Date.now() - new Date(node.metrics['M'].updated).getTime() < 2000))  exports.taskerRequest('mail'); } },

Repeat the above for all of the events.   Add the following to metrics.js  after the end of the helper functions

Code: [Select]
//  this function sends an HTTP POST request to the  Tasker and TNES app web server 
//  running  on the two android cell phones
exports.taskerRequest = function(triggerWord) {
    request.post({
         headers: {'content-type' : 'application/x-www-form-urlencoded'},
         url:'http://192.168.1.60:8765',     // Galaxy S3
         body: triggerWord },
         function(error,response,body){ }
      );
    request.post({
        headers: {'content-type' : 'application/x-www-form-urlencoded'},
        url:'http://192.168.1.62:8765',     // ZTE Maven
        body: triggerWord },
        function(error,response,body){ }
    );
 
  }
 

END  MODIFICATIONS  TO GATEWAY

Don’t forget to add the EVENT to your Gateway web page.


Is it Robust?   I tried a couple simple tests.   I streamed a Netflix movie and monitored the Gateway Dashboard web page while sending multiple “mail” messages through the Gateway to the two phones.  No issues.  I powered off one phone and repeated.  Only one phone spoke and displayed, but no unexpected issues.  Powered off both phones, no unexpected issues.   Powered back on both phones and [after a couple minutes] they automatically ran Tasker and spoke and displayed as intended without any other button pushes.  This turned out to be a very useful device which I use daily and it meets my needs.  As always, your requirements may vary.

Send SMS texts for critical messages when internet is not available.   As you probably realize if you went through the steps above, Tasker, can provide many additional Task Actions which may be useful.  For example if you have moteino nodes and the PiGateway in a remote location without internet service (or if you just want a backup communication path for critical messages), then you can use this approach provided you have cellular service.  Even though I do not use this particular feature, I did verify it works.  I set up Tasker and TNES on my primary phone, disconnected my internet from my router, and it successfully sent a SMS text message to my wife’s phone when we got mail.   So this utilized only the cellular service and my local LAN with no internet available.  The Tasker Task for this is:
+   >  Phone  >  Send SMS  >  Number [the receiving cell number]  >  Message  [the critical text message to send] 

Future upgrade to reset the mail indicator?    No project is ever complete.  There are always more features to implement.  A mail reset is one I think would be of great value.  The garage door is no problem.  The display is on (green) when the door is open, and off (black) when the door is closed.  But what turns the mail display off?  For me, I have a physical button on my garage moteino which performs this function.  This is the purpose of  “sayButton” in the above description.  As a better alternative, the Tasker/TNES has the ability to easily send posts back to the PiGateway when the mail indicator on the phone is pressed.  However, the PiGateway would have to provide the necessary HTTP Request server and the hooks to pass parameters to/from the existing NodeJS functions.  That is beyond my capability at the present time, but maybe that would be a possible addition to a future version of the PiGateway software.

TomWS

  • Hero Member
  • *****
  • Posts: 1891
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #9 on: February 18, 2016, 02:57:22 PM »
Great documentation and application, Duane!

I've been wondering what to do with my old Android devices, now I know, thanks!  I already have Tasker so just need to add the server extension.  Also, I wasn't aware of the REST API in Chrome, very handy indeed!

Tom

jra

  • Jr. Member
  • **
  • Posts: 80
  • Country: us
Re: Repurpose an old cell phone to play sounds (ie "speak") for the Gateway
« Reply #10 on: February 19, 2016, 09:55:21 AM »
+1 great writeup!  My original Android drowned in a kayaking incident some years back.  Its replacement was repurposed as a DLNA media controller when it was retired.  My current phone is coming off contract this May but I was planing on using it until the battery goes south.  Your  application may give me some other ideas.