Switchmote is working mechanically but I am unable to control switch settings from the gateway and the swithmote event does not work.
I see from the gateway log that the command is being sent and looking at the switchmote sketch it appears the message being agrees with what is expected.
I see from other posts there could be a versioning problem, but I think my versions are compatible.
How can I debug this further?
gateway.sys.log
[12-14-16_17:32:57.462] [LOG] NODEACTION: {"nodeId":50,"action":"BTN0:1"}
[12-14-16_17:32:57.466] [LOG] >: GTWCMD:50:BTN0:1^M
A few things to check:
- that your SM can receive messages (in range, transmit settings correct etc)
- are you running the latest code of everything (switchmote (https://github.com/LowPowerLab/RFM69/blob/master/Examples/SwitchMote/SwitchMote.ino), gateway app (https://github.com/LowPowerLab/RaspberryPi-Gateway))?
- use the terminal to send a raw command, here's and example and response:
(http://i.imgur.com/Lp2qtcu.png)
- Your log message contains an extra token (^M) which if sent to the SM will be discarded:
[12-14-16_17:32:57.466] [LOG] >: GTWCMD:50:BTN0:1^M
Can you check where that's coming from?
The logic that does the SM's BTNx:y checking is around this line in the sketch (https://github.com/LowPowerLab/RFM69/blob/master/Examples/SwitchMote/SwitchMote.ino#L337).
FWIW the SM sketch linked above was recently released and contains the config utility so now it's a single sketch, no need for separate config sketch.
^M is a DOS carriage return character. I see it throughout the log. For example, the following line is from a weathershield node
[12-15-16_16:06:06.880] [LOG] >: [10] BAT:4.01v F:2784 H:38 P:0.00 [RSSI:-73][ACK-sent]^M
Is that something that would be written by the gateway sketch,the moteino sketch, or would it come from gateway.js?
I am a database administrator by trade. I see this control character when a text file, ususally source code, is written in Windows as a DOS text file and transmitted to a unix system.
Weird, I've never seen "^M" as a newline in windows or linux.
What text viewer are you using?
MAC terminal session on the pi gateway.
I think the ^M is just in the log output. You are probably correct that it is a character encoding issue on MAC terminal.
Now to debug, how can I trap what is actually getting to the switchmote and debug what happens there.
Should the gateway command work to toggle the button when switchmote is powered through FTDI where I could send serial output to debug whether the action method is getting called?
Then if no command gets to the switchmote it is probably a gateway / mighty hat issue not sending the command correctly?
Question:
Does the gateway use serial to send commands to switchmote when responding to button clicks on the nodeDetails page?
This fell off my radar :-[
The gateway can only talk wirelessly to a switchmote.
Serial is only between the gateway and the host computer.