Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. servo386
    3. Best
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by servo386

    • RE: Arduino Mega gw wired directly via USB to HASS.IO?

      Thank you so much! I've got the example "door open/door close" dummy sensor sketch succesfully talking to my HASS.IO.

      I'm literally going to type this sentence so that people might find this later in a forum search if they are looking like I was for an answer: direct to USB, wired USB, hass.io arduino mega, serial gateway no radio, local sensor no radio serial gateway usb.

      Sorry for that but i was tearing my hair out looking for this simple solution and could not find it.

      The trick is to comment out the RF radios (all of them). It wasn't clear to me that blanking out all the radios meant it would still do serial. The part to config on the HASS seemed clear to me (/dev/ttyACM0) but since I couldn't get the gateway part to work I had no idea if that was even right.

      Again, thanks so much.

      posted in Troubleshooting
      servo386
      servo386
    • RE: Arduino Mega gw wired directly via USB to HASS.IO?

      Thanks! I have successfully created TWO dummy doors now! lol

      This was instructive to understanding how the presentation of multiple local sensors looks like, since most examples show only one.

      My next task is to learn how to control a switch (ie two way communication)

      Here it is for anyone else for whom this might be helpful:

      #include <MySensors.h>
      
      #define OPEN_DOORONE 1
      #define CLOSE_DOORONE 0
      #define CLOSE_DOORTWO 0
      #define OPEN_DOORTWO 1
      #define DOORONE_ID 1
      #define DOORTWO_ID 2
      
      MyMessage msg1(DOORONE_ID, V_TRIPPED);
      MyMessage msg2(DOORTWO_ID, V_TRIPPED);
      
      
      uint8_t value_doorone = OPEN_DOORONE;
      uint8_t value_doortwo = OPEN_DOORTWO;
      
      void setup()
      {
      	// Setup locally attached sensors
      }
      
      void presentation()
      {
      	// Present locally attached sensors
       sendSketchInfo("JERTestDoorsss", "1.0");
       present(DOORONE_ID, S_DOOR);
       present(DOORTWO_ID, S_DOOR);
      }
      
      void loop()
      {
      	// Send locally attached sensor data here
      
        value_doorone = value_doorone == OPEN_DOORONE ? CLOSE_DOORONE : OPEN_DOORONE;
        send(msg1.set(value_doorone));
        sleep(2000);
        value_doortwo = value_doortwo == OPEN_DOORTWO ? CLOSE_DOORTWO : OPEN_DOORTWO;
        send(msg2.set(value_doortwo));
        sleep(2000);
        value_doortwo = value_doortwo == OPEN_DOORTWO ? CLOSE_DOORTWO : OPEN_DOORTWO;
        send(msg2.set(value_doortwo));
        sleep(2000);
        value_doortwo = value_doortwo == OPEN_DOORTWO ? CLOSE_DOORTWO : OPEN_DOORTWO;
        send(msg2.set(value_doortwo));
        sleep(2000);
        value_doortwo = value_doortwo == OPEN_DOORTWO ? CLOSE_DOORTWO : OPEN_DOORTWO;
        send(msg2.set(value_doortwo));
        sleep(2000);
        
      }
      
      posted in Troubleshooting
      servo386
      servo386