Google Voice SMS Plugin

Posted on
Thu Feb 09, 2012 2:02 pm
dmeeker@mac.com offline
Posts: 85
Joined: Aug 26, 2011

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

I wrote that wrong.
You should make a new device in indigo and assign a google voice number to it.

Then, choose that device when you make the trigger.

Sorry for the confusion.

The docs for the plugin are pretty straightforward.


dave

Posted on
Fri Feb 10, 2012 5:41 pm
eme jota ce offline
Posts: 618
Joined: Jul 09, 2009
Location: SW Florida

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Thanks for the reply dmeeker,

After trying several combinations of setup, I have it working. Very cool plugin.

Thanks for adding this to the community Chris!

For anyone else having a little difficulty setting it up. Here's what worked for me. Generally following the directions in the first post of this thread, but:

    In the initial setup, I used the Google login & password of the new GV account that will be dedicated to Indigo, but input the telephone number of another, different GV account I commonly use for texting and making / receiving calls.

That let's me send "authorized" texts to Indigo from my regular GV account, but texts are sent back to me from the new GV account that I setup for Indigo.

The error I had been making was inputting the new GV account's login, password, and phone number in the first part of the directions.
Last edited by eme jota ce on Wed Feb 15, 2012 9:23 am, edited 1 time in total.

Posted on
Wed Feb 15, 2012 8:25 am
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

.

.
Last edited by Dewster35 on Fri Feb 24, 2012 1:34 pm, edited 1 time in total.

Posted on
Thu Feb 16, 2012 10:37 am
eme jota ce offline
Posts: 618
Joined: Jul 09, 2009
Location: SW Florida

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Chompy wrote:
Is there any way to keep this plugin connected to Google Voice? I am having issues with the plugin disconnecting after a period of inactivity.

I attempted to setup a timer to reload the plugin, but I'm not sure how to go about doing so.



Did you find a solution?
I just added a schedule to disable, then enable the SMS device. Not sure if that will address the connection being dropped. Currently, reloading the Google Voice SMS plugin manually fixes it.

Posted on
Fri Feb 17, 2012 11:17 am
eme jota ce offline
Posts: 618
Joined: Jul 09, 2009
Location: SW Florida

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

I've pulled together a script to periodically reload this plugin because otherwise it seems to loose the ability to receive texts (but can still send them). The small script is based upon Jay, Matt's and Berkinet's discussions.

Code intended to periodically reload the Google SMS plugin:
Code: Select all
plugin = indigo.server.getPlugin("com.chrisandlynette.indigoplugin.googleVoiceSMS")
if plugin.isEnabled():
   plugin.restart()


It works ... unleashing all the received text triggers that accumulated while the plugin's connection to receive texts went dormant, but I running the script from within Indigo shows several errors in the log:
Code: Select all
Feb 17, 2012 10:45:38 AM
  Reloading plugin "Google Voice SMS 1.1.0"
  Stopping plugin "Google Voice SMS 1.1.0" (pid 5005)
  Error                           because embedded scripts execute sequentially they must complete their execution within 10 seconds.
  Error                           modify the script to exit quickly or convert it to an external file (not embedded).
  Stopping embedded script executor host (pid 5464)
  Script Error                    embedded script: ServerCommunicationError -- timeout waiting for server response
  Script Error                    Exception Traceback (most recent call shown last):

     embedded script, line 3, at top level
StandardError: ServerCommunicationError -- timeout waiting for server response

  Error                           process (pid 5005) failed to quit after polite request -- forcing it to quit now
  Starting plugin "Google Voice SMS 1.1.0" (pid 5522)
  Plugin "Google Voice SMS" disconnected
  Plugin "Google Voice SMS" connected
  Plugin "Google Voice SMS 1.1.0" started
  Google Voice SMS                Logging in to your Google Voice account.
  Google Voice SMS                Successfully logged in to: zzzzzxxxxxxzzzz@gmail.com
  ...


Pasting that script into TextWrangler, saving it as" GoogleSMSReload.py" file and executing the file from Indigo seems to reload the plugin without error in the log.

Not sure how often it should run, though.

Posted on
Wed Feb 22, 2012 5:40 pm
Andy B. offline
Posts: 2
Joined: Feb 22, 2012

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

I've been using the script posted by "eme jota ce" to reload the Google Voice SMS plugin with great success. Has anyone figured out the maximum time interval to run the script? I have the script run every 1 hour, but didn't know if anyone has had success running it less often.

I made a python script to parse SMS messages, make the appropriate change called for in the SMS, and send an SMS reply. My motivation was to have one trigger for SMS messages instead of having a bunch of separate triggers based on the contents of the SMS message. e.g. "set temp to ##" will change my thermostat heat setpoint to ##, no matter the number, so then I don't have to have a separate trigger for 68, 69, 70... It also takes into account slightly different wording of various commands e.g. "set temp to 70", "set temperature to 70", and "set heat to 70" all change the setpoint of the thermostat to 70.

To do this:
1. Add a variable called "messageText", and note the variable ID which will be used in the python script in step 3.

2. Edit the plugin.py file for the Google Voice plugin (/Library/Application Support/Perceptive Automation/Indigo 5/Plugins/GoogleVoiceSMS.indigoPlugin/Contents/Server Plugin/plugin.py) to add the line below that starts "indigo.variable... " which updates the Indigo variable messageText with the received SMS message text:
Code: Select all
   def verifyDevice(self, device, cell, msg, time):
      smsNumber = device.pluginProps['address']
      if smsNumber == cell[2:12]:
         indigo.server.log("Time: "+time+"  From: "+cell+"  MSG: "+msg+"  *authorized*")
         device.updateStateOnServer(key="receivedText", value="") # cleared in case the same message is received
         device.updateStateOnServer(key="receivedText", value=msg.lower().strip().strip('.'))
         indigo.variable.updateValue("messageText", msg.lower())  ## add this line to update messageText variable
         verified = True


3. Create a trigger that runs whenever the SMS received text has any change. Save the following code to a file (mine's called processSMS.py) and set the action of this trigger to run the file:
Code: Select all
#variable containing SMS message
message = indigo.variables[680980532].value

#define thermostat device
myThermostat = indigo.devices[53622306]

#set the Id of your phone
myPhoneId = 839260238

########################################
# change variables above
########################################

#get current ambient temperature
currTemp = str(int(myThermostat.temperatures[0]))

#instantiate the Google Voice Plugin
googleVoiceId = "com.chrisandlynette.indigoplugin.googleVoiceSMS"
googleVoicePlugin = indigo.server.getPlugin(googleVoiceId)

text = ""

#function for sending SMS messages via Google Voice Plugin
def sendSMS(text):
   indigo.server.log("Sending message: " + text)
   if googleVoicePlugin.isEnabled():
      googleVoicePlugin.executeAction("sendSMS", deviceId=myPhoneId, props={'smsMessage':text})

if "set temp to" in message or "set temperature to" in message or "set heat to" in message:
   temperature = message.split()[3]

   #turn on heat if off
   if myThermostat.hvacMode != indigo.kHvacMode.Heat:
      indigo.thermostat.setHvacMode(myThermostat, value=indigo.kHvacMode.Heat)
      text += "Heat turned on. (was off) "

   #change setpoint
   if myThermostat.heatSetpoint != float(temperature):
      indigo.thermostat.setHeatSetpoint(myThermostat, value=eval(temperature))
      text += "Setpoint changed to " + temperature + ". "
   else:
      text += "Setpoint already " + temperature + ". "

   #send SMS confirmation
   text += "Current temperature is " + currTemp + "."
   sendSMS(text)

elif message == "heat off" or message == "heater off":
   indigo.thermostat.setHvacMode(myThermostat, value=indigo.kHvacMode.Off)

elif message == "current temp" or message == "current temperature":
   #SMS current temperature
   sendSMS("Current temperature is " +currTemp)


(Change the ID's above to those for your thermostat and messageText variable.)

This can obviously be expanded to other commands by adding more elif statements.
Last edited by Andy B. on Tue Feb 28, 2012 10:01 am, edited 5 times in total.

Posted on
Thu Feb 23, 2012 1:19 am
arreter offline
Posts: 1
Joined: Feb 23, 2012

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Thank you for this great plugin, I'm having problems getting the newest version (I have 1.1.0, when I download in the Indigo page it keeps being the same version and not the update with the variable change. How can I get the newer?

Posted on
Thu Feb 23, 2012 2:04 pm
eme jota ce offline
Posts: 618
Joined: Jul 09, 2009
Location: SW Florida

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Andy B. wrote:
I've been using the script posted by "eme jota ce" to reload the Google Voice SMS plugin with great success. Has anyone figured out the maximum time interval to run the script? I have the script run every 1 hour, but didn't know if anyone has had success running it less often.

I've been running the script every 4 hours. No problems over 6 days.

Posted on
Thu Mar 15, 2012 3:25 pm
jquestv2 offline
Posts: 18
Joined: Feb 09, 2009

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Chris,
great plug in! many thanks.
Just wondering if there is a way to be able to use two google accounts at the same time.
Thanks,
John

Posted on
Sat Mar 24, 2012 7:29 am
bmilesfl offline
Posts: 14
Joined: Dec 19, 2010
Location: Orlando, FL

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

I'm struggling to get this to work for me. Could someone possibly help me? This is a really cool Plugin and I'm hoping that I can get it to work.
Conceptually, I feel like I just need to set up a trigger event that is coming from my Google Voice account and then the Actions can be like any other action in Indigo.

Here is what I have set up for my trigger:
Trigger Pic.png
Trigger Pic.png (70.29 KiB) Viewed 7672 times


Then, I have the actions set to execute an Action Group, as shown below:
Action for Trigger Pic.png
Action for Trigger Pic.png (90.52 KiB) Viewed 7672 times


I can run the "Execute Actions Now" in the Indigo software and the Action (lights toggle correctly and SMS sent to my personal cell phone) work correctly.

Somehow, I'm also able to send text messages from within Google Voice (right back to the same google voice number) and my Indigo system properly executes the actions (i.e., toggles the lights and sends me a confirmation via SMS to my cell phone). However, I cannot send an SMS message from my cell phone to my Google Voice account and get the Indigo to recognize it. However, the SMS text does show up in Google Voice (in the trash folder). It just never resulted in any action within my Indigo system.

Here is a pic of my Trash folder from my Google Voice account:
google voice account pic.png
google voice account pic.png (123.55 KiB) Viewed 7672 times


And, here is a pic of my Device Status in Indigo:
Indigo Device Status Pic.png
Indigo Device Status Pic.png (97.02 KiB) Viewed 7672 times


Based on the above, it appears that there is something preventing me from sending SMS texts from my cell phone to Google Voice and getting the system to execute them. Again, thanks for any help anyone might have to help resolve or trouble-shoot this.

Posted on
Sat Mar 24, 2012 7:47 am
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Your trigger needs to be YOUR phone... not the number for the house. It sounds odd... but it's for verification so that anyone can't send a text to your house number and jigger with your lights. Otherwise everything else should work. I have a few commands that I do and then a handshake in the form of a text message back to my personal phone that the action occurred.

Posted on
Sat Mar 24, 2012 8:07 am
bmilesfl offline
Posts: 14
Joined: Dec 19, 2010
Location: Orlando, FL

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Thank you for the reply. I made that change, as you suggested and I still have all of the above symptoms described earlier. It seems that no personal cell initiated commands to my Google Voice number initiates any action within Indigo. And, I notice that any commands (i.e., text) I send from my personal cell to my Google Voice number, never shows up in Indigo with the revised "receivedText" variable reflecting that new text. The messages do appear in my Google Voice trash bin though. Somehow, I'm not getting the commands to come from Google Voice to Indigo. Again, thanks for the reply and the help.

Posted on
Sat Mar 24, 2012 8:11 am
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Are you seeing it in the event log? Also.. I know I was pulling my hair out because as pointed out above, the plugin should be disabled and reloaded every 4 hours. It will still send you texts, but it won't see them coming in to perform actions with. I would just try to manually disable the plugin and then re enable it to, then run it again. Copy and paste your event log into a post if you are still having troubles.


Google Voice SMS Time: 10:13 AM From: +MY PERSONAL CELL NUMBER: MSG: Turn alarm on *authorized*
Trigger Alarm On from Dave
Trigger KPL Button 3 - Alarm on - Button On
Trigger Alarm Entry On
Google Voice SMS Sending 'Alarm entry has been turned on' to MY PERSONAL CELL NUMBER
Sent INSTEON "PowerLinc Interface" on to 100% (instant) (group/scene 15)
Google Voice SMS Message sent successfully.

The above is what I see in my event log... "Turn alarm on" text string turns on the alarm, turning the alarm on lights up a KPL button throughout the house for the alarm, once the alarm turns on, it sends a message that says the alarm was turn on back to my cell number so I know the action was executed.

Update:
I should note too... I know it sounds backwards, but the command you send from YOUR cell phone to the house number will show up as the last received text in YOUR cell phone indigo device... not the house. Again, I got turned around on all that too... add to the fact that you get disconnected from the google voice account after a period of time and this is a hard one to get your head wrapped around. I can say since I got it working, it has worked flawlessly ever since. Big wife approval factor too!

Posted on
Fri Mar 30, 2012 8:49 am
jtm997 offline
Posts: 11
Joined: Jun 02, 2011

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

What a great plugin! It took me some time to get things worked out but I have it working. My toughest problem was corrected after re-reading Chompy's issue on page 1.

I have a couple questions.

What is the difference between a Trigger and an Action Group? I do not know enough about this Indigo stuff to understand all I read.

As for adding lines of code for variable use, how do you get started editing the code. I learned many years ago (late 80's) to program in Pascal. That was a long time ago. Now that I have moved to Apple (first was a used apple 2E) I have not programed. Any guidance on how to get started would be greatly appreciated.

Jim

Posted on
Fri Mar 30, 2012 9:23 am
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Google Voice SMS Plugin for Indigo 5 (SIRI support added

Jim,
A action group is a series of actions that you are firing together. An example, turn on a light, open your garage door and change a variable in indigo.

A trigger is the same as an action group, except instead of you manually firing off the action group, you set up a trigger (a motion detector turns on) and that executes the action group. You can also setup conditions for the trigger such as only if it's nighttime, or any other number of conditions... the options are pretty extensive.

From the programming side of things, Python is recommended when dealing with indigo, but there are also a lot of apple script used as well. Simply search the forums and you'll find a lot of examples. If you're starting from scratch, I would try to make a few simple scripts like turning a light on or off by executing the script... then build upon that to get more sophisticated. For a vast majority of my home automation I'm strictly using indigo... it's quite powerful to the point where in most applications you won't NEED to write a script to get done what you want. There are times however when it is more efficient to write a script than to have everything being handled by Indigo.

Hope that helps...

Page 5 of 21 1, 2, 3, 4, 5, 6, 7, 8 ... 21

Who is online

Users browsing this forum: No registered users and 2 guests

cron