Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Multiple Relays Spanned Across Nodes

Multiple Relays Spanned Across Nodes

Scheduled Pinned Locked Moved Troubleshooting
4 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tbully
    wrote on last edited by
    #1

    Hello All -
    I ran in to an interesting issue over the weekend that I'm hoping I can get some help with.

    I have two identical nodes/sensors. Each Arduino has a water pulse meter and a relay (to control an actuator/valve).

    I used the same forloop logic found in the relay example at: http://www.mysensors.org/build/relay

    However, the relay was not discovered/added by Vera on the second node. The only way I could get it to include was if I started the forloop with sensor=2. This will give the first relay on the second node an ID of "2". This seemed like an odd necessity to me as it was coming from a different sensor/node.

    Is this expected behavior?

    for (int sensor=2, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
    // Register all sensors to gw (they will be created as child devices)
    gw.present(sensor, S_LIGHT);
    // Then set relay pins in output mode
    pinMode(pin, OUTPUT);
    // Set relay to last known state (using eeprom storage)
    digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
    }

    All is well and both nodes are up and functioning. It just seemed like an ugly way to handle this situation and could cause trouble down the road as I add relays/sensors.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tbully
      wrote on last edited by
      #2

      Any thoughts? It's working OK with this hack but will not scale if I start adding more (10+) relays.

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #3

        Are you sure you hadn't previously deleted a device with the same id/child id?

        Vera sometimes keeps deleted devices in some hidden cache which is not cleared until you hard-reboot the box. If you try to add a new device with the same id it won't succeed until this cache is cleared.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tbully
          wrote on last edited by
          #4

          @hek I've rebooted several times over the past few days while working on other sensors. However, your idea sounds valid.

          So you're saying that I should be able to have multiple sensors running the example relay sketch on my network without issue, correct?

          This should be fine because each individual node/arduino gets it's own ID so the relays on each Arduino should not conflict with its neighbors.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          16

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular