SMS for Plugboard V2

18 replies [Last post]
magill
Offline
Joined: 27 Apr 2012

Hi

I'm just finding my way and got my first lua script to trigger.

Anyone got a LUA script to send or receive sms in V2 plugboard.

thanks

John

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
I used this in v1, but

I used this in v1, but haven't touched it for a while.  If you're struggling I could take another look, I think the original script was fairly straight forward, have a look and if your not sure let us know,

Karl

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
First Steps

Hi John,

Here are the first steps you need to take to get the HAH to process text messages, I've just done this myself so I know it works.  If we can work through it together and find the right method I'll update the wiki to make it more useful.

So, firstly you need xFx Viewer, it's essential for anything you do on the HAH, I'm assuming Windows here, anything else and we'll have to look at xap-snoop.  Get xFx Viewer, get it running and then go into the next step, It's better to use version 3.x, NOT 4, here's the link http://www.edjo.pwp.blueyonder.co.uk/edward/xAP/downloads/xFx%20Viewer%20Installer.msi.

 

Next, telnet, ssh, whatever to the HAH and make sure your plugboard directory is empty, or at least rename any *Applet.lua files so they don't run, ie just remove the "Applet" bit.

Next, connect you phone to the HAH.  Then type dmesg from the telnet session, you should see something like :-

 

hub.c: USB new device connect on bus1/1, assigned device number 3
usbserial.c: FTDI 8U232AM converter detected
usbserial.c: FTDI 8U232AM converter now attached to ttyUSB0 (or usb/tts/0 for devfs)

Note the "attached to".  We're now going to start the SMS process manually, just to check everything.
Again, from the telnet session type :- xap-sms -s /dev/ttyUSB0 -i br0 -d 5
A lot of text will scroll up the screen, you're in debug mode, so it's just telling you what's going on.
Now send a text to the HAH!!
I sent "Relay 1 on" and got the following displayed :-
[inf][sms.c:67:processSerialMsg] Serial Rx:
[inf][sms.c:67:processSerialMsg] Serial Rx: +CMTI: "MT",1
[inf][getsms.c:23:fetchsms] trying to get stored message 1
[inf][modem.c:32:put_command] Serial Tx: AT+CMGR=1
[inf][modem.c:91:put_command] Serial Rx:
+CMGR: "REC UNREAD","+44???????????",,"12/05/06,20:12:30+04"
Relay 1 on
OK
If you've got this far, well done, the HAH has received the text and we can now move onto the next stage, getting the HAH to process the texts automatically.  You should also be able to see the message you sent in xFx Viewer as well.
Let me know when you get to here and we can start the next bit.
Good luck 
Karl

 

magill
Offline
Joined: 27 Apr 2012
SMS

Hi Karl
I have now acquired a USB cable that gets recognised as ttyUSB0
but I now get "segmentation fault"
Any idea what that means?


login as: root
root@10.0.0.30's password:
# xap-sms -s /dev/ttyUSB0 -i br0 -d

SMS Connector for xAP v12
Copyright (C) DBzoo, 2009-2010

Segmentation fault
#
John

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Command Syntax

You seem to be missing the debug level at the end of the line, the "-d " specifies debug, try "-d 5" to start, if that works and you want more detailed, read LOTS more information, then just increase the number.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Indeed you need a number

Indeed you need a number after -d but still the program should not SEGV like that.  I'll look into it.

Brett

magill
Offline
Joined: 27 Apr 2012
SMS for Plugboard V2

I can now see the outgoing string AT+CREG? which is a request for network status. There is no response from the modem. I have a home brew app in windows which works perfectly with this cable and modem. I wonder is it a baud rate problem? 9600 works in my app.

Derek if you read this can you check your spam mail, Ive sent you 5 emails with no response.
Also I have tried to post this as a reply, but I keep getting an error "Comment field is required"

brett
Offline
Providence, United States
Joined: 9 Jan 2010
xap-sms will open the modem

xap-sms will open the modem at 19200 baud, you can't adjust this.   I would need to make some code changes to allow the baud rate to be adjustable.

Brett

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Ping

>Derek if you read this can you check your spam mail, Ive sent you 5 emails with no response.

I'm still here! haven't seen any mail from you (and just spam in the old spam bin). i'll send you an email to the address that I've used previously.

Derek.

magill
Offline
Joined: 27 Apr 2012
send SMS

Thanks Brett
I think most phones will have auto baud rate detect. I'm using a modem which I have now forced to 19200 baud and I am now getting responses

from the device.
I have numerous USB-serial cables that aren't recognised and I read on the forum about loading drivers using
# insmod ftdi_sio
I have had no success.
John

brett
Offline
Providence, United States
Joined: 9 Jan 2010
If the serial cable isn't

If the serial cable isn't recognized then its not supported.  As this is a 2.4 kernel there are some later chips for which there is no driver.  You will be ok with PL2303 and some FTDI chips, all others your mileage may vary.  You should not have to load any modules into the kernel.   Check your # dmesg output if no driver is found well .... there you go.

I also added some code for allowing you to choose a different baud rate - that'll be in the next release.

Brett

magill
Offline
Joined: 27 Apr 2012
sms

Hi Karl

I'm getting somewhere now with SMS. Any chance of a bit of script to send or Rx a message? I attach photos of my PCB for the heating system.

John

AttachmentSize
P1020850.JPG 22.82 KB
P1020849.JPG 25.77 KB
derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Nice PCB

However, I'm not sure if you intend to put any hi volts near this one.

If there are any hi volts just be very, very careful with how you go. Earthing, proper enclosures, IP ratings, overload protection, protection for inquisitive youngsters with thin fingers, fire considerations, warning labels etc, etc.

The HAH team don't endorse direct connection of the Livebox or HAH PCB to anything that has high voltages. RF to a CE approved RF mains socket is our recommended route for handling mains.

Many folks know all this and do all the right things. It might sound like a bit of a cliche but if in doubt, do get a qualified electrician to certify your work.

Derek.

magill
Offline
Joined: 27 Apr 2012
Derek You're right about the
Derek You're right about the caution and I understand the dangers.I work in the business and have qualified electricians on hand. BTW I have now sent you a total of 14 emails all to an identical address. Don't know what is happening. John
magill
Offline
Joined: 27 Apr 2012
SMS for Plugboard V2

Hi
I'm still messing about with SMS and have been able to send SMS. However

when I send an SMS to Livebox and run in debug mode I see the incoming

message:

[inf][sms.c:67:processSerialMsg] Serial Rx:
[inf][sms.c:67:processSerialMsg] Serial Rx: : "SM",1
[inf][tx.c:19:xapSend] send

but the system just stops processing.
Anyone seen this before.
thanks
John

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
I'm getting a similiar

I'm getting a similiar problem :-

 

[inf][sms.c:67:processSerialMsg] Serial Rx: MT",1
[inf][tx.c:19:xapSend] send

If we compare it with a known working debug output like the one above :-

[inf][sms.c:67:processSerialMsg] Serial Rx:
[inf][sms.c:67:processSerialMsg] Serial Rx: +CMTI: "MT",1
[inf][getsms.c:23:fetchsms] trying to get stored message 1
[inf][modem.c:32:put_command] Serial Tx: AT+CMGR=1
[inf][modem.c:91:put_command] Serial Rx:
+CMGR: "REC UNREAD","+44???????????",,"12/05/06,20:12:30+04"
Relay 1 on
OK
It looks like the xap-sms isn't receiving the full AT command.  I'll build the release the Brett made and see if dropping the baud rate improves things.

 

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Baud

So, running 306.5 and changing the baud rate to 9600 seemed to make it drop more characters :-

[inf][sms.c:67:processSerialMsg] Serial Rx:
[inf][sms.c:67:processSerialMsg] Serial Rx: ,1

Increasing it 38400 didn't help either :-

[inf][sms.c:67:processSerialMsg] Serial Rx:
[inf][sms.c:67:processSerialMsg] Serial Rx: ",1

Is this more of a buffer problem in the code?

 

Karl

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Karl what happened between it

Karl what happened between it working and then not working?  These seems odd.  From the debug you just aren't recieving any data.  Or the data that you are getting is gibberish.

Brett

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
No Changes

Nothings significant, a couple of reboots, phone switched off and on, cables checked, usually stuff just to try and get it working.  John and I were going to document the steps to get him going and then update the wiki with a step by step implementation.

It does look like it's only getting part of the command, I've had a look at the code, but haven't yet got my head around C strings and pointers.  And of course, it isn't consistent, although it fails more than it works.  I sent about 20 messages last night and none of them worked.  The xap-sms "usually" gets something, but as you can see, it's only part of the AT command.  I don't have anything else connected to the USB, so I don't think there is any interference from anything else.

Hardware Info