"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
Suggested Topics
-
Welcome
Announcements • 23 Mar 2014, 08:24 • hek 2 Apr 2014, 14:39 -
Status of my rv(camper) home automation system 2020-2025
My Project • about 10 hours ago • fsgraz about 8 hours ago -
Simulate Online-Recreating 'Flappy Bird' with Arduino Nano
My Project • 15 Jan 2025, 09:13 • Skylar Jones 15 Jan 2025, 09:13 -
Long time test done with soil sensor!
My Project • 7 Jan 2025, 09:13 • Nicklas Starkel 13 Jan 2025, 09:10 -
Water Meter or "How to get Home Assistant to send saved data to an Arduino"
My Project • 18 Oct 2024, 02:19 • OldSurferDude 18 Oct 2024, 02:19 -
Door chime
My Project • 9 Mar 2025, 10:06 • Paul Scarbro 13 Mar 2025, 00:15