GarageMote - Open/Close function not working [solved - need PiGateway sketch]

Started by jcook11, April 09, 2016, 08:58:29 AM

jcook11

I've got my Garagemote setup working except for one feature - the open and close buttons on the web interface are not causing the relay to trigger.  However it works when I test it without the raspberry pi webserver (sending 'GRGCLS' and 'GRGOPN' to the receiver node causes the relay to click on the transmitter node).  Any ideas for further troubleshooting?  The transmitter magnet sensor status makes it to the pi just fine - I can see the garage status working on the webpage.

DrEmil

I'm having the same problem. The node load fine but the open/close buttons do not execute the OPN/CLS action. I've completely rebuilt the interface from scratch (using the image) and same problem persists. It works if you use the debug mode command to pulserelay() via serial.

I'm sure I'm missing something simple... ideas anyone?

Felix

First please ensure you are running the latest sources for your mote.

Please note the commands are not GRGCLS and GRGOPN, but just CLS/OPN: https://github.com/LowPowerLab/RFM69/blob/master/Examples/GarageMote/GarageMote.ino
You may check the log either in the interface (terminal page) or on disk where you get all the traffic to and from the gateway (gateway.sys.log file). Clicking the UI buttons should trigger actions which result in a message being sent to your garageMote.

For instance if I click Refresh I see this in the UI termina log screen, this is the reply from the mote:

6:34:44 PM : {"_id":12,"updated":1460414081987,"type":"GarageMote","label":"Garage_SINGLE","descr":"garage mote","rssi":67,"metrics":{"Status":{"label":"Status","value":"CLOSED","updated":1460414081987,"pin":1,"graph":1}},"events":{"garageSMS":0}}

In the gateway.sys.log there is more detail, you can see the action request and the reply, the ACKs and the logging:

[04-11-16_18:34:41.949] [LOG]   NODEACTION: {"nodeId":12,"action":"STS"}
[04-11-16_18:34:41.953] [LOG]   >: GTWCMD:12:STS
[04-11-16_18:34:41.970] [LOG]   >: ACK:OK
[04-11-16_18:34:41.985] [LOG]   >: [12] CLOSED   [RSSI:-67][ACK-sent]
[04-11-16_18:34:41.988] [LOG]   post: /home/pi/gateway/data/db/0012_Status.bin[1460414081,0]
[04-11-16_18:34:41.999] [LOG]      [12] DB-Updates:1

jcook11

I'm pretty sure I'm running the latest sketches on the moteinos, as I've only had them for a few months, and looks like the last updates were about a year ago or more. 

Looking at the receiver mote, it is looking for "GRGOPN" for the open command (from the pi), for example:

if (inputLen >= 6)
  {
    if (input[0]=='G' && input[1]=='R' && input[2]=='G' && input[3]=='O' && input[4]=='P' && input[5]=='N')
    {
      Serial.print("OPN ... ");
      if (radio.sendWithRetry(GARAGENODEID, "OPN", 3))
        Serial.println("ok ... ");
      else Serial.println("nothing ... ");
    }
    if (input[0]=='G' && input[1]=='R' && input[2]=='G' && input[3]=='C' && input[4]=='L' && input[5]=='S')


Attached is a log snippet showing me clicking the 'refresh' and 'close' button on the webpage, with no response.  You can see that the garage mote (transmitter node) is working though when I move the magnets around.



jcook11

Well finally figured this out it looks like.  You have to use the PiGateway sketch on the base Moteino, not the GarageMote_base.  Since all I have been interested in thus far was the Garage Mote, it made sense to use GarageMote_base as the sketch.   

Felix

@jcook11,
Yes that is definitely the case, the base sketch was just a demo for when there was no gateway sketch, maybe I should even remove it to avoid confusion. Really sorry about that. I would encourage anyone who's using these sketches to get at least a little familiar with the code and understand the basics of what's going on, it's a valuable skill to have when issues arise and need to spot a code problem.