We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

How To Send a command from Omega2+ to another via Network

  • Hi Everybody,
    I have one omega2+ with a sensor that will give +3.3v to GPIO.
    I have other 3 Omega2+ with relay expansion that are used to control Plugs using the relay.
    all 4 controllers are connected to the same WIFI network.

    how can I send command from the Master Controller (the one connected to the sensor) to switch on all the 3 relays on the other controllers via the network (when the sensor give +3.3v signal to GPIO)?

    Thank you in advance.

  • too much help in here, shifted to particle photon ...........

  • @Wyvern-IQ
    Broadcasting UDP package(s) might be an option for you.
    Here you are some python drafts (a working demo ;-).
    Probably your favorite programming language has similar capabilities too.

    (when the sensor give +3.3v signal to GPIO)

    I think this means a digital High level.


    # importing packages
    import sys, time, onionGpio
    from socket import *
    # using GPIO0 as input
    gpioNum = 0
    gpioObj = onionGpio.OnionGpio(gpioNum)
    # sender
    s = socket(AF_INET, SOCK_DGRAM)
    s.bind(('', 0))
    s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
    # reading the sensor once a second
    while 1:
        state = gpioObj.getValue()
        if (int(state) == 1):
            for i in range(0,3):
                s.sendto(state, ('<broadcast>', 50000))


    # importing packages
    import sys
    from OmegaExpansion import onionI2C
    from OmegaExpansion import relayExp
    from socket import *
    # Relay Expansion device address is 0x20
    addr = 0
    channel = 0
    # listener
    s = socket(AF_INET, SOCK_DGRAM)
    s.bind(('', 50000))
    while 1:
        state, wherefrom = s.recvfrom(1500, 0)
        relayExp.setChannel(addr, channel, state)

    Unfortunately I have no Relay expansion.
    Please take a high resolution (macro) photo from its SMD area if you can and share with us.

  • Hi,

    You can use ssh to run command on another Omega.

    sshpass -p "PASSWORD" root@REMOTE_IP COMMAND

    PASSWORD - default is onioneer
    REMOTE_IP - remote device address
    COMMAND - app/script etc. to run on remote device (you can use parameters to enable/disable relay)

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.