Programming a SwitchMote PSU for a Load

Started by LaneF, October 22, 2015, 08:24:47 PM

Felix

Quote from: LaneF on November 04, 2015, 01:39:05 PM
One funny thing I found out was that the encryption didn't work.  Not that the code didn't work but a little factoid I learned.  In the Switchmote config file it asks for your Motenio password, mine happens to end with the character " ) " .  Guess what the only special character you can't end your encryption with?  It takes that as the end of the password and doesn't include it.  I had to re-flash my PI Motieno Gateway, my Garagemote and WeatherMote with a new one that doesn't use the last character as " ) ".  Lesson learned, the hard way.

This is the reason why, look in SwitchMoteConfig.ino:

    case 'e':
      if (c >= ' ' && c <= '~') //human readable chars (32 - 126)

LaneF

Sorry Felix - I recognize the characters, but I have no idea what that means:

    case 'e':
      if (c >= ' ' && c <= '~') //human readable chars (32 - 126)


LaneF

Felix

Again, if you look at the larger picture, you will notice that the Config sketch expects a certain range of characters for the ENCRYPTION KEY.
That range is: c >= ' ' && c <= '~' //human readable chars (32 - 126) in the ASCII table

Ie between space and tilda, and that would include parentheses:


LaneF

Felix -
I tried your fix.  I ran the Switchmote Sketch (non R1 ver) from GitHub and confirmed my encryption.  Everything balances out and the SwitchMote PSU1 connects to the Motenio Gateway  *** 1 time*** (see below @ 3:23.04pm #4) then nothing.  This node #4 won't come up on my Gateway display but it shows as recognized in the Serial Monitor window.  Why one place and not the other.  Also, is this mote supposed to "ping" every now and again so you know it's alive?  Is there a "action" button I can put on the Gateway under the Switchmote to make it just turn on and off since it's not a light switch but a "load"?

Quote
3:24:27 PM : {"_id":2,"updated":1446848667077,"type":"WeatherMote","label":"Temperature Sensor ","descr":"###### Foyer","rssi":52,"metrics":{"V":{"label":"V","value":4.86,"unit":"v","updated":1446848667077},"F":{"label":"F","value":76.6,"unit":"°","updated":1446848667077,"pin":1,"graph":1},"H":{"label":"H","value":38,"unit":"%","updated":1446848667077,"pin":0,"graph":0},"P":{"label":"P","value":25.98,"unit":"\"","updated":1446848667077,"pin":1,"graph":1},"START":{"label":"START","value":"Started","updated":1446436019407}}}
3:23:04 PM : {"_id":2,"updated":1446848528025,"type":"WeatherMote","label":"Temperature Sensor ","descr":"###### Foyer","rssi":55,"metrics":{"V":{"label":"V","value":4.86,"unit":"v","updated":1446848528025},"F":{"label":"F","value":76.55,"unit":"°","updated":1446848528025,"pin":1,"graph":1},"H":{"label":"H","value":38,"unit":"%","updated":1446848528025,"pin":0,"graph":0},"P":{"label":"P","value":25.98,"unit":"\"","updated":1446848528025,"pin":1,"graph":1},"START":{"label":"START","value":"Started","updated":1446436019407}}}
3:23:04 PM : {"_id":4,"updated":1446397958993,"label":"SwitchMote (1x PSU)","rssi":77,"metrics":{},"type":"SwitchMote","events":{}}
3:23:04 PM : {"_id":3,"updated":1446848321923,"type":"GarageMote","label":"Garage","descr":"Double Garage Doors","rssi":71,"metrics":{"Status":{"label":"Status","value":"CLOSED","updated":1446848321923,"pin":1,"graph":1}}}
3:23:04 PM : Connected!

Thanks
LaneF

LaneF

Update:
I think the line in the Serial Monitor on the Gateway that refers to the Node#4 is not a 433HW transmission, I think it's just the remnants or read off the Gateway itself from a "Blink Tx/Rx" test Sketch from 5d?hrs ago.  The reason it says Switchmote  and PSU1 is because after I ran the Tx/Rx test I simple relabeled it in the Gateway.  Summary, I don't think the Switchmote is Tx or Rx.  Nothing from Node #4 shows coming through the Pi Serial Port using Minicom.  I re-verified the EPROM initial settings, Network, Node, Gateway it all matches. What about Parity, Baud etc in the SwitchMote Config settings, I didn't change them, do I need to?
Quote3:23:04 PM : {"_id":4,"updated":1446397958993,"label":"SwitchMote (1x PSU)","rssi":77,"metrics":{},"type":"SwitchMote","events":{}}
At the end of an ACK Tx/Rx shouldn't the Gateway Serial Monitor show a "updated":144686122###" after each successful exchange?

Thanks LaneF

Felix

Ok so apart from the password issue, I take things are starting to work out for you?
I would encourage you to think of ways you can debug the code and try to get a little familiar with it. That way you know what your device is doing and will get a sense of where to look when/if things don't work the way you thought they would.
Serial.print statements can help a lot here, they are basic but for beginners they are much easier to use that advanced techniques like JTAG debugging etc (JTAG is only available on atmega1284 aka MoteinoMEGA).