more G-Labs products

Author Topic: Controlling HG via email or text message  (Read 1946 times)

December 20, 2015, 02:24:59 PM
Read 1946 times

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
I've been messing about for trying to process commands via text message - you could also use it on email.

Its not exactly using NLP like some systems do but you should be able to alter it as you see fit for your systems.. Thought I would paste my code up here for others to play with.. its nothing clever but does what I need :)

You can also validate the phone number, this could be changed to email address but neither is perfectly "secure :)

"module 4 on" "module 4 off" etc will work.. as would "please would you turn on module 4"


December 20, 2015, 04:36:00 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I looked through the code but didn't see how this receives the message. Dou you need a local web server or something?

December 21, 2015, 11:17:54 AM
Reply #2

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
That doesn't have the code in it for receiving the message, I have basically merged the receive SMS code I had and this together and it works ok.. except I really need to re-write the SMS code so I can get the phone number out.

The event handler really messes things up, but at the time I never thought I could probably ignore the serial port helper..


December 21, 2015, 05:30:42 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
So in order for this to work you must have a SMS receive device connected to your HG server?  That's what I assumed, but when you indicated email, I was hopeful there was another way.

December 21, 2015, 11:17:37 PM
Reply #4

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Nah it will be possible to get it to work via email - Its on my list :)

What would you be using for email?

December 22, 2015, 04:12:24 PM
Reply #5

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I used to use Google Voice with my AHP setup.  However, Google changed how things worked so I couldn't do that any more.  Basically, I would send a SMS to my GV account with the command and AHP would execute it (I used an AHK script with the SDK to interface the two).  Since sending an email can be done from a text message, I was hoping to be able to do that again.

I know HG has the Android app available, but it would be nice to have a way to send a message without logging into HG.  I used to be able to open the text program, type a couple words, hit send, and move on.  Now I have to wait for the connection which might be a problem depending on my location.  With SMS I can send the message even with no connectivity and then it will send when it gets signal and a confirmation could show up later when it went through.  I'm reasonably happy with how things work now, this is just a "nice to have" type feature for those times when I want to turn something on asynchronously.

December 23, 2015, 11:12:40 AM
Reply #6

[email protected]

  • *****
  • Information
  • Hero Member
  • Posts: 271
Kind of why I have done this.. also more as I leave the house and think, did I set the alarm? or turn the heating off as I'm away for the weekend, and like you say these have apps, but this is quicker..

I've also done it so that HG sends me a text message if my alarm fails to set on exit or goes off.. or I have a power cut :)

You could use the SMS code with 'any' 3g dongle with a valid sim I suspect.  I'm using http://www.ebay.co.uk/itm/GSM-SIEMENS-TC35-SMS-Board-LM2596-UART-Wireless-With-Antenna-Voice-Module-/371058278229?hash=item5664cbff55:g:Jl0AAOxyUylTQ2Ak
I like the look of these as I could possibly use the voice option later..

Just shove it some volts and connect to on-board serial on the PI.

If you dont have serial spare then the cp2102 usb ttl adapters work fine.. added benefit they were/are supported in the ARM version of windows 10 for the PI - The FTDI chipset is now though in the latest builds.

Other reason I went this way was so I didn't have to rely on internet connectivity - IE if my internet goes down or the power goes off (UPS and battery backed PSU's keep stuff up)  I can get notification and or possibly restart the router by sending commands to run predetermined steps.