"interface" to my OPC-System



  • Hallo to all the specialists!
    I have a well running Moeller-Eaton Easy Relay home automation wit an OPC DA server.
    I also use IOBroker as a controler for all my MySensors-nodes.
    I looked for an software interface to connect both, but I didn't find one.
    Now I decided to connect them via an Arduino Mega as an ethernet-gateaway.
    So I need only a lot of outputs and inputs with two states.
    I found the example-sketch "Relais Actuator", which is very helpful for such a lot of identical outputs.
    But I found no way to add lines for the inputs as easy as the outputs.
    I added:

    #define BIN_1  31  // Arduino Digital I/O pin number for first switch (second on pin+1 etc)
    #define NUMBER_OF_BIN 28 // Total number of attached switches
    #define BIN_HIGH 1  // GPIO value to write to turn on attached switch
    #define BIN_LOW 0 // GPIO value to write to turn off attached switch
    

    In "void before" i added

    for (int sensor=16, pin=BIN_1; sensor<=NUMBER_OF_BIN; sensor++, pin++) {
            // Then set relay pins in output mode
            pinMode(pin, INPUT);
            digitalWrite(pin, HIGH);
            // Set switch to last known state (using eeprom storage)
            digitalWrite(pin, loadState(sensor)?1 :0);
            }
    

    in void presentation I addes

    for (int sensor=16, pin=BIN_1; sensor<=NUMBER_OF_BIN; sensor++, pin++) {
            // Register all sensors to gw (they will be created as child devices)
            present(sensor, S_DOOR);
        }
    

    The childs appear in "objects" without any state.
    I have no idea, how to send the states to the controler for further use in IOBroker.
    I don`t know how to create a message-container and send the states.
    If anybody could help me to finish my projekt, I were very happy!
    JOPBE


Log in to reply
 

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