SwitchMote with GarageMote_base Gateway Buttons dont switch from RED to GREEN

Started by megasis, May 01, 2015, 08:52:38 PM

megasis

I finally have my GarageMote working from my iPhone or any PC Web Browser, I can now check if I left the Door Open while driving to Work.   8)

Now, I moved to the next node of my MoteinoNetwork, the SwitchMote, so I connected my spare Moteino/Flash/RF69_915MHz on a bradboard and replicated the 3 buttons SwitchMote connection, with No High Voltage section, just a LED that turn ON/OFF.

I installed the Switch Mote Config Sketch first and set the values as shown below (Except the Key):

-----------------------------------------------
   Moteino-RFM69 configuration setup utility
-----------------------------------------------
f - set frequency (current: 915mhz)
i - set node ID (current: 23)
n - set network ID (current: 250)
w - set RFM69 type (current: W/CW)
e - set encryption key (current: SuperSecretWords)
d - set description (current: SMSTAIRS)
s - save CONFIG to EEPROM
E - erase whole EEPROM - [0..1023]
S - erase SYNC data [64..93]:[0,0,0,0,0,0,0,0,0,0]
r - reboot
ESC - return to main menu

Then I installed the SwitchMote sketch and this is what it shows on the Monitor:

===============================================
NODEID:23
NETWORKID:250
EncryptKey:SuperSecretWords
isHW:0
SYNC_INFO: 0......0
Listening for ON/OFF commands...

btn[0]:6 - TOP:OFF
btn[1]:5 - MAIN:OFF
btn[2]:4 - BOTTOM:OFF
=====================================

And then I connected to the Breadboard and test it with the GarageMote Base and pushed the buttons.

This is from the log on the my Gateway page:
=============================================
8:26:29 PM : [23] BTN1:1   [RSSI:-27][ACK-sent]
8:26:26 PM : [23] BTN0:0   [RSSI:-26][ACK-sent]
8:26:25 PM : [23] BTN0:1   [RSSI:-26][ACK-sent]
8:26:23 PM : [23] BTN2:0   [RSSI:-33][ACK-sent]
8:26:22 PM : [23] BTN2:1   [RSSI:-30][ACK-sent]
8:26:16 PM : [23] BTN1:0   [RSSI:-27][ACK-sent]
8:26:09 PM : [23] BTN1:1   [RSSI:-28][ACK-sent]
8:26:01 PM : [11] CLOSED   [RSSI:-50][ACK-sent]
8:26:01 PM : STS ... ok ...
8:26:01 PM : getting status...
8:25:55 PM : [11] CLOSED   [RSSI:-50][ACK-sent]

As  you can see, the communication works, the breadboard behaves as a 3 Switchs Moteino,
never the less, in the Gateway page never none of the buttons (LAB STAIRS FRONT GARAGE or LOBBY) changed from RED to GREEN.  :-\
I'm not sure how can I map my SwitchMote with one of the Buttons on the Gateway.

Any help would be nice, thanks in advance.

Maximo

Felix

Sounds like you're trying to simulate a SwitchMote on breadboard.
At the moment the new gateway interface is pending release so I would wait for that instead of using the old hardcoded one. Even with that one if you look at the code it should be pretty obvious where the buttons are mapped by hardcoding the values and node IDs etc.

megasis

Felix,
I'm not planning on using my version of SwithcMote Breadboard at all in my house, I made it so I can understand how multiple nodes work, like a workbench, before I spend more buying the real things.  :)

I just want to know how can I integrate several Moteino nodes together with the my Pi Gateway-Garage Mote, as it is the one thing that Works Great!!! and I can  to control from my Phone.

Once I had that extra Moteino Node working, I promise, I'll buy the real thing as I don't want to risk my home with less that the real SwitchMote. 

I've been looking all over the files, and the only place I found reference to IDs is on the index.php, I've tried to map the IDs based on that but that doesn't work and I haven't found any other place where those IDs are hard-coded.

I was hopping I could get a clue where I need to put what for this second Moteino node can communicate with the Pi Gateway and controll or read realtime status (like GREEN RED buttons) or any other data.

I'm looking forward for the new version, looks very powerful, expandable and flexible, but in the mean time....., It would be nice to know how can I put this to work.  :-\

I love electronics and this is something I'm really enjoying, and the fact my Garage Opens using my phone, I have green light from my wife to continue playing.  8)

Thanks again for your time and your amazing Moteinos.

Maximo

Felix

Maximo,
There is a reference to the switchmote IDs in the gateway.js at the end of it:

  status='';
  if (data.indexOf("[21] SSR:0") != -1 || data.indexOf("[21] BTN1:0") != -1) status = "21:SSR:0";
  if (data.indexOf("[21] SSR:1") != -1 || data.indexOf("[21] BTN1:1") != -1) status = "21:SSR:1";
  if (data.indexOf("[23] SSR:0") != -1 || data.indexOf("[23] BTN1:0") != -1) status = "23:SSR:0";
  if (data.indexOf("[23] SSR:1") != -1 || data.indexOf("[23] BTN1:1") != -1) status = "23:SSR:1";
  if (data.indexOf("[25] SSR:0") != -1 || data.indexOf("[25] BTN1:0") != -1) status = "25:SSR:0";
  if (data.indexOf("[25] SSR:1") != -1 || data.indexOf("[25] BTN1:1") != -1) status = "25:SSR:1";
  if (data.indexOf("[26] SSR:0") != -1 || data.indexOf("[26] BTN1:0") != -1) status = "26:SSR:0";
  if (data.indexOf("[26] SSR:1") != -1 || data.indexOf("[26] BTN1:1") != -1) status = "26:SSR:1";
  if (data.indexOf("[27] SSR:0") != -1 || data.indexOf("[27] BTN1:0") != -1) status = "27:SSR:0";
  if (data.indexOf("[27] SSR:1") != -1 || data.indexOf("[27] BTN1:1") != -1) status = "27:SSR:1";
  if (status.length >0)
  {
    io.sockets.emit('SM', status);  
  }


Please beware that I have updated the SwitchMote sketch since I posted the old gateway.js code. There might be some breakage, because the SM might be looking for different messages (ex. the SSR command is obsolete). So please make sure the SM will respond to the commands that are sent by the gateway.js script.

PS - Thanks for the feedback, glad you like my humble creations.
PS2 - The wife's blessing is essential! :D

megasis

Getting better, but still need something...

I found the gateway.js that has the code you mention in GitHub, I originally used the gateway.js code you put on the blog (not on GitHub) while following your instructions, so I pasted the code on the gateway.js I was using. This is how it looks now:



serial.on("data", function (data) {
  var status = '';
  if (data.indexOf(' OPEN ') != -1)  status = 'Open';
  if (data.indexOf(' CLOSED ') != -1) status = 'Closed';
  if (data.indexOf(' OPENING ') != -1) status = 'Opening';
  if (data.indexOf(' CLOSING ') != -1) status = 'Closing';
  if (data.indexOf(' UNKNOWN ') != -1) status = 'Unknown';
  if (status.length >0)
  {
    io.sockets.emit('MOTEINO', status);
  }

  status='';
  if (data.indexOf("[21] SSR:0") != -1 || data.indexOf("[21] BTN1:0") != -1) status = "21:SSR:0";
  if (data.indexOf("[21] SSR:1") != -1 || data.indexOf("[21] BTN1:1") != -1) status = "21:SSR:1";
  if (data.indexOf("[23] SSR:0") != -1 || data.indexOf("[23] BTN1:0") != -1) status = "23:SSR:0";
  if (data.indexOf("[23] SSR:1") != -1 || data.indexOf("[23] BTN1:1") != -1) status = "23:SSR:1";
  if (data.indexOf("[25] SSR:0") != -1 || data.indexOf("[25] BTN1:0") != -1) status = "25:SSR:0";
  if (data.indexOf("[25] SSR:1") != -1 || data.indexOf("[25] BTN1:1") != -1) status = "25:SSR:1";
  if (data.indexOf("[26] SSR:0") != -1 || data.indexOf("[26] BTN1:0") != -1) status = "26:SSR:0";
  if (data.indexOf("[26] SSR:1") != -1 || data.indexOf("[26] BTN1:1") != -1) status = "26:SSR:1";
  if (data.indexOf("[27] SSR:0") != -1 || data.indexOf("[27] BTN1:0") != -1) status = "27:SSR:0";
  if (data.indexOf("[27] SSR:1") != -1 || data.indexOf("[27] BTN1:1") != -1) status = "27:SSR:1";
  if (status.length >0)
  {
    io.sockets.emit('SM', status);
  }

  io.sockets.emit('MOTEINOLOG', data);
});

Now, the status of the light is updated fine (see attached screen shots SM_01 and SM_02) it change color every time I push the middle button, but it work only one way, from the SwitchMote to the Gateway, if I click the LAB On button on the page, nothing happens. (see screen shot SM_03) .

I will review the code again and play with it, somehow, let's see If I'm lucky

Thanks again, I'll keep you post, but if you know what's wrong.... don't wait and tell me :)

Maximo

Felix



Felix