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
E

ewgor

@ewgor
About
Posts
80
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 💬 Building a Raspberry Pi Gateway
    E ewgor

    Hi there,
    I'm trying to make a gateway on my pi and since the begining i'm stuck!
    Using this: git clone https://github.com/mysensors/MySensors.git
    i get: fatal: unable to access 'https://github.com/mysensors/MySensors.git/': Could not resolve host: github.com
    I tried with sudo too! am i the only one getting this?

    Announcements

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    I see, i need to search for help on another forum ...
    Many thanks to TimO who helped me a lot.

    My Project

  • Array Relay Button Actuator
    E ewgor

    Wow ! this is what i was looking for ... Could anyone please share with us some Openhab settings for this wonderful Arduino sketch?
    How can we assign in OH buttons to correspond to the physical buttons on the breadboard ?

    Looking for any answer.

    Thanks all!

    General Discussion

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    Hey guys, i found the solution here array-relay-button-actuator but now the OH part comes 'couse this is different solution. How can i add CHILD_ ID's in this case to create more buttons in OH? i mean how to make difference between the two relays in OH?

    Can somebody please help me? This is what i was looking for.

    Thanks :scream:

    My Project

  • Serial Gateway connection to Openhab
    E ewgor

    @TimO i solved following your tutorial here with dmesg and checking for what usb name rpi have for the gateway. Still not did those steps for a permanent usb but its on going.
    Thanks!

    OpenHAB development ope

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    Guys, i tried this sketch above and now it can be uploaded but its not working well.
    The system reacts like this: the first button ( old one) turns the led on / off on the breadboard but its not refreshing the OH button on the webpage and i get some i get some WARN on the server like this:

    2015-09-11 19:02:29.052 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: ON
    2015-09-11 19:02:29.073 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: ON
    2015-09-11 19:02:29.085 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: ON
    2015-09-11 19:02:30.701 [INFO ] [runtime.busevents             ] - Arduino state
     updated to 0;0;3;0;9;read: 22-22-0 s=1,c=1,t=2,pt=2,l=2:0
    0;0;3;0;9;send: 0-0-22-22 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    22;1;1;0;2;0
    0;0;3;0;9;read: 22-22-0 s=2,c=1,t=2,pt=2,l=2:0
    0;0;3;0;9;send: 0-0-22-22 s=2,c=1,t=2,pt=2,l=2,st=fail:0
    22;2;1;0;2;0
    0;0;3;0;9;read: 22-22-0 s=2,c=1,t=2,pt=2,l=2:0
    0;0;3;0;9;send: 0-0-22-22 s=2,c=1,t=2,pt=2,l=2,st=fail:0
    22;2;1;0;2;0
    0;0;3;0;9;read: 22-22-0 s=2,c=1,t=2,pt=2,l=2:0
    0;0;3;0;9;send: 0-0-22-22 s=2,c=1,t=2,pt=2,l=2,st=ok:0
    22;2;1;0;2;0
    
    2015-09-11 19:02:30.719 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: OFF
    2015-09-11 19:02:30.742 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: OFF
    2015-09-11 19:02:30.755 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: OFF
    2015-09-11 19:02:30.761 [WARN ] [.model.script.actions.BusEvent] - Item 'null' d
    oes not exist.
    Light Item: null Light: OFF
    

    I don't understand why i get so many things on the server pressing once on and once off!
    The second button is completely dead, it doesn't do anything on the breadboard or on the web.
    I think the Arduino sketch has some bugs somewhere even it can be compiled. Maybe something inside is wrong or maybe this is not the right way to multiply relays and buttons.
    Please see bellow my OH settings.
    Items:

    String Arduino "Arduino" { serial="COM4@115200" }
    Switch           lightBar01                          "Lumina dormitor"
    Switch           lightBar02                          "Lumina hol" 
    

    Sitemap:

    sitemap demo label="Acasa"
    {
       Frame label="Lumini" {
                Switch item=lightBar01 label="Lumina dormitor"
    			Switch item=lightBar02 label="Lumina hol"
        }
    

    Rules:

    import org.openhab.core.library.types.*
    import org.openhab.core.persistence.*
    import org.openhab.model.script.actions.*
    import org.joda.time.*
    import java.util.*
    import org.eclipse.xtext.xbase.lib.*
    import org.openhab.core.items.*
    
    
    var String ArduinoUpdate = ""
    var String sketchName = ""
    
    var int V_TEMP = 0
    var int V_HUM = 1
    var int V_LIGHT = 2
    var int V_DIMMER = 3
    var int V_PRESSURE = 4
    var int V_FORECAST = 5
    var int V_RAIN = 6
    var int V_RAINRATE = 7
    var int V_WIND = 8
    var int V_GUST = 9
    var int V_DIRECTION = 10
    var int V_UV = 11
    var int V_WEIGHT = 12
    var int V_DISTANCE = 13
    var int V_IMPEDANCE = 14
    var int V_ARMED = 15
    var int V_TRIPPED = 16
    var int V_WATT = 17
    var int V_KWH = 18
    var int V_SCENE_ON = 19
    var int V_SCENE_OFF = 20
    var int V_HEATER = 21
    var int V_HEATER_SW = 22
    var int V_LIGHT_LEVEL = 23
    var int V_VAR1 = 24
    var int V_VAR2 = 25
    var int V_VAR3 = 26
    var int V_VAR4 = 27
    var int V_VAR5 = 28
    var int V_UP = 29
    var int V_DOWN = 30
    var int V_STOP = 31
    var int V_IR_SEND = 32
    var int V_IR_RECEIVE = 33
    var int V_FLOW = 34
    var int V_VOLUME = 35
    var int V_LOCK_STATUS = 36
    var int V_DUST_LEVEL = 37
    var int V_VOLTAGE = 38
    var int V_CURRENT = 39
    var int msgPresentation = 0
    var int msgSet = 1
    var int msgReq = 2
    var int msgInternal = 3
    var int msgStream = 4
    var int alarmArmor = 1
    
    // Internal Commands
    
    var int I_BATTERY_LEVEL = 0
    var int I_TIME = 1
    var int I_VERSION = 2
    var int I_ID_REQUEST = 3
    var int I_ID_RESPONSE = 4
    var int I_INCLUSION_MODE = 5
    var int I_CONFIG = 6
    var int I_FIND_PARENT = 7
    var int I_FIND_PARENT_RESPONSE = 8
    var int I_LOG_MESSAGE = 9
    var int I_CHILDREN = 10
    var int I_SKETCH_NAME = 11
    var int I_SKETCH_VERSION = 12
    var int I_REBOOT = 13
    var int I_GATEWAY_READY = 14
    
    // Mappings
    var HashMap<String, String> sensorToItemsMap = newLinkedHashMap(
        "101;1;"            -> "lightBar01",    // looks good
        "lightBar01"       -> "101;1;",
    	"101;2;"            -> "lightBar01",    // looks good
        "lightBar02"       -> "101;2;"
    )
        
    
    //receiving msg from mysensors gateway
    rule "Arduino sends to Openhab"
        when
            Item Arduino received update
        then
            var String lineBuffer =  Arduino.state.toString.split("\n")
            for (String line : lineBuffer) {
                var String[] message = line.split(";")
                var Integer nodeId = new Integer(message.get(0))
                var Integer childId = new Integer(message.get(1))
                var Integer msgType = new Integer(message.get(2))
                var Integer ack = new Integer(message.get(3))
                var Integer subType = new Integer(message.get(4))
                var String msg = message.get(5)
                if(msgType == 1 ){
                    if (subType == V_LIGHT){
                        var String state
                        var Integer statusInt = new Integer(message.get(5))
                        if(statusInt == 1) { 
                            state = "ON"
                            } 
                        else { 
                            state = "OFF" 
                            }
                        postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), state)
                        println ("Light Item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " Light: " + state )
                        }
    				if (subType == V_TEMP){
                        postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg)
                        println ("Temp item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " temp: " + msg )
                        }
    				if (subType == V_HUM){
                        postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), msg)
                        println ("Hum item: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " hum: " + msg )
                        }
                    }    
                // Internal Command
                if(msgType == 3){
                    if(subType == I_SKETCH_NAME){
                            println("Sketch name: " + msg )
                            sketchName=msg
                        }
                    if(subType == I_SKETCH_VERSION){
                            println("Sketch version: " + msg )
                            postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), sketchName+" " +msg )
                            sketchName=""
                        }
                    }
                }   
            }
    end
    rule "Light"
            when
                    Item lightBar01 received command
            then
                   if(receivedCommand == ON) {
                sendCommand(Arduino, "101;1;1;0;2;1\n")
            }
            if(receivedCommand == OFF) {
               sendCommand(Arduino, "101;1;1;0;2;0\n")
            }
    end
    rule "Light"
            when
                    Item lightBar02 received command
            then
                   if(receivedCommand == ON) {
                sendCommand(Arduino, "101;1;1;0;2;1\n")
            }
            if(receivedCommand == OFF) {
               sendCommand(Arduino, "101;1;1;0;2;0\n")
            }
    end
    
    

    Any suggestion will be kindly appreciated.
    Thanks!

    PS: I forgot to say that i added in the Arduino sketch the address of the node point:

    #define NODE_ID 101
    
    My Project

  • Custom power meter
    E ewgor

    Thank you for sharing this code.
    I modified your code only for a CT sensor which is connected to A0. The CT is connected to a 40 Watts lamp and this is what i get on Arduino serial monitor:

    sensor started, id 4
    send: 4-4-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
    send: 4-4-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
    send: 4-4-0-0 s=255,c=3,t=11,pt=0,l=18,st=ok:Energy Meter x 3v2
    send: 4-4-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.2
    send: 4-4-0-0 s=0,c=0,t=13,pt=0,l=0,st=ok:
    send: 4-4-0-0 s=0,c=1,t=24,pt=7,l=5,st=ok:0.1
    

    what is the last value (0.1)? Amps? if i turn off the lamp the i get 0.0!
    In your sketch i see you calculate the real power, power factor, Vrms (volts?) and Irms (Amps?)

        float apparentPower   = emon1.apparentPower;    //extract Apparent Power into variable
        float powerFactor     = emon1.powerFactor;      //extract Power Factor into Variable
        float supplyVoltage   = emon1.Vrms;             //extract Vrms into Variable
        float Irms            = emon1.Irms;             //extract Irms into Variable
    

    why is displaying in the serial monitor only one value which i assume is Irms?

    I would like to calculate only the power and to export this to openhab but.....i dont know how :(

    Troubleshooting

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    @TheoL thanks man, I'll try it right now, thanks again.

    My Project

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    @TimO still doesnt want to compile :(
    this is the last error:

    sketch_sep10b.ino:81:3: error: expected unqualified-id before 'if'
    Error compiling.
    
    

    Thanks!

    My Project

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    Wow! thanks for your time to fill this sketch! appreciate that.

    I tried your sketch and after cleaning some small mistakes i got these errors and i don't know how to lose them.
    this is how the sketch looks:

    #include <MySensor.h>
    #include <SPI.h>
    #include <Bounce2.h>
    
    #define RELAY_PIN  4  // Arduino Digital I/O pin number for relay 
    #define RELAY_PIN2 5 //######## ADD THAT ######
    #define BUTTON_PIN  3  // Arduino Digital I/O pin number for button 
    #define BUTTON_PIN2 6 //######## ADD THAT ######
    #define CHILD_ID 1   // Id of the sensor child
    #define CHILD_ID2 2 //######## ADD THAT ######
    #define RELAY_ON 1
    #define RELAY_OFF 0
    
    Bounce debouncer = Bounce(); 
    Bounce debouncer2 = Bounce(); //######## ADD THAT ######
    int oldValue=0;
    int oldValue2=0; //######## ADD THAT ######
    bool state;
    bool state2; //######## ADD THAT ######
    MySensor gw;
    MyMessage msg(CHILD_ID,V_LIGHT);
    MyMessage msg2(CHILD_ID2,V_LIGHT); //######## ADD THAT ######
    
    void setup()  
    {  
      gw.begin(incomingMessage, AUTO, true);
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Relay & Button", "1.0");
    
     // Setup the button
      pinMode(BUTTON_PIN,INPUT);
      pinMode(BUTTON_PIN2,INPUT); //######## ADD THAT ######
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN,HIGH);
      digitalWrite(BUTTON_PIN2,HIGH); //######## ADD THAT ######
      
      // After setting up the button, setup debouncer
      debouncer.attach(BUTTON_PIN);
      debouncer2.attach(BUTTON_PIN2); //######## ADD THAT ######
      debouncer.interval(5);
      debouncer2.interval(5);//######## ADD THAT ######
    
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID, S_LIGHT);
      gw.present(CHILD_ID2, S_LIGHT);//######## ADD THAT ######
    
      // Make sure relays are off when starting up
      digitalWrite(RELAY_PIN, RELAY_OFF);
      digitalWrite(RELAY_PIN2, RELAY_OFF); //######## ADD THAT ######
      // Then set relay pins in output mode
      pinMode(RELAY_PIN, OUTPUT);
      pinMode(RELAY_PIN2, OUTPUT); //######## ADD THAT ######   
          
      // Set relay to last known state (using eeprom storage) 
      state = gw.loadState(CHILD_ID);
      state2 = gw.loadState(CHILD_ID2); //######## ADD THAT ######
      digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
      digitalWrite(RELAY_PIN2, state2?RELAY_ON:RELAY_OFF); //######## ADD THAT ######
    }
    
    
    /*
    *  Example on how to asynchronously check for new messages from gw
    */
    void loop() 
    {
      gw.process();
      debouncer.update();
      debouncer2.update(); //######## ADD THAT ######
    
      // Get the update value
      int value = debouncer.read();
      if (value != oldValue && value==0) {
          gw.send(msg.set(state?false:true), true); // Send new state and request ack back
      }
      oldValue = value;
    } 
    
      int value2 = debouncer2.read(); 
      if (value2 != oldValue && value==0) { 
          gw.send(msg2.set(state?false:true), true); 
      }
      oldValue2 = value;
    }
     
    void incomingMessage(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.isAck()) {
         Serial.println("This is an ack from gateway");
      }
    
      if (message.type == V_LIGHT) {
         // Change relay state
         state = message.getBool();
         if(message.sensor == 1) { //######## ADD THAT ######
           digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
           gw.saveState(CHILD_ID, state);
         } else if(message.sensor == 2) { //######## ADD THAT ######
           digitalWrite(RELAY_PIN2, state?RELAY_ON:RELAY_OFF); //######## ADD THAT ######
           // Store state in eeprom ######## ADD THAT ######
           gw.saveState(CHILD_ID2, state); //######## ADD THAT ######
        }
        
         // Write some debug info
         Serial.print("Incoming change for sensor:");
         Serial.print(message.sensor);
         Serial.print(", New status: ");
         Serial.println(message.getBool());
       } 
    }
    

    and those are the errors:

    
    sketch_sep09a.ino:81:3: error: expected unqualified-id before 'if'
    sketch_sep09a.ino:84:3: error: 'oldValue2' does not name a type
    sketch_sep09a.ino:85:1: error: expected declaration before '}' token
    Error compiling.
    
    

    About the OH rules i made them like this:

    rule "Light"
            when
                    Item lightBar02 received command
            then
                   if(receivedCommand == ON) {
                sendCommand(Arduino, "101;1;1;0;2;1\n")
            }
            if(receivedCommand == OFF) {
               sendCommand(Arduino, "101;1;1;0;2;0\n")
            }
    end
    

    what do you think? do i still need to modify something?

    Thank you a lot!:pray:

    My Project

  • [Tutorial] openHAB with serial gateway
    E ewgor

    Hi! Can somebody please help here? I got stuck with my openhab server on my raspberry!
    By now I was starting the server by:

    Sudo /opt/openhab/start.sh
    

    But I wanted more, to make it auto start on reboot so in case of power failure to auto start when the power is back. Therefore I followed some tutorials found on the www and I got it done, now the server starts alone but I cannot do anything from web page or from my phone. I also can't see the temp and humidity on the web or phone!
    The question is how to stop this server? I tried different commands found on the internet but non of them can stop this invincible server I have lunched :)
    I tried to stop it, remove, delete... Nothing works!
    Is there any way to remove everything from my raspberry pi and to start it all over again with all the installation as for windows ? Format the partition, install the noobs again and so on?
    Thanks.

    OpenHAB

  • [Tutorial] openHAB with serial gateway
    E ewgor

    Hi TimO,
    I want to make a permanent USB setting for my Radberry and I follow your tutorial here.
    In my etc/udev/rules.d I have two documents: 40-scratch.rules and 99-input.rules and I don't know where to make the needed modifications as you show in this tutorial.
    The file you point to make the modifications has another name and I can't figure where to add the vendor, product and serial no for my arduino. Shall I make a new file called 99-usb-serial.rules and to write in it the ATTRS{idVendor} and the rest of them according to my dmesg as you say here above or to do that in one of the two files I have?
    Thanks!

    OpenHAB

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    Hello? TimO? :) are you there?

    My Project

  • Serial Gateway connection to Openhab
    E ewgor

    Hi,
    Can anyone help? I'm trying to move my server from my laptop to my raspberry pi 2 and I'm having problems.
    I changed the port in the items file with

    "String Arduino "Arduino" { serial="/dev/ttyUSB0@115200" }"
    

    And now the server receive the commands from my laptop or from my phone but it not sends the info to the node point and it not receive info from the node point too.
    If I start the server from my laptop with start.bat it works but when I start the server from my pi with
    Sudo /opt/openhab/start.sh it acts as I said above!
    Can anyone please help me understand what I'm missing?

    Thanks!

    OpenHAB development ope

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    Oh TimO i thought i'll never see you again here :) thanks for the answer.
    I'm using the RelayWithButtonActuator example on which i added the humidity and temperature part and its working well. I choose this example because in this way i can get in real time the light status in Openhab even the light is turned ON / OFF from physical button on the breadboard or from the Openhab button.
    The Openhab rules are already made with the V_LIGHT command not the V_TRIPPED.

    I cant figure out what to add in the Arduino sketch to add more relays and more buttons and to make it work in the setup or loop functions. Than, on the Openhab rules i tried to copy the only light rule i have right now and to change some of the numbers in the

    sendCommand(Arduino, "101;1;1;0;2;1\n") 
    

    but its not working :(

    If i'll get at least 5 buttons and 5 relays working in this way it would be perfect.

    Looking for any answer.

    My Project

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    @hek thanks for the answer. At least now i know i'm not alone :). Anyhow as far as i've seen by now only @TimO was the only one who answered me and gave me some info. It is possible that non of the heros, admins or other kind of this forum members to have a suggestion for me?
    Sorry if i was aggressive again!

    Good help :)

    My Project

  • A very beginner needs help - MySensors and OpenHab !
    E ewgor

    People i see that this post was seen by more than 2k times but nobody is answering! How is this possible? Nobody knows how to do it or everybody enjoy watching a noob asking for help? Common people at least off topic let's say hi each other!

    My Project

  • Custom power meter
    E ewgor

    @maglo18 I saw some words in your pictures that looks familiar like faza or analizator :)
    Can you share your latest Arduino sketch or if you have a complete tutorial about this project would be helpful.
    Thanks!

    Troubleshooting

  • Energy monitor from existing CT's
    E ewgor

    @gigaguy i was asking for help building a new and simple system using one ct sensor to get 3 values in openhab: instant power in watts, energy consumption up to date in kWh and the total energy consumption starting with the app upload in kWh. I don't want to see volts or amps!
    The problem is that I don't know how to combine the emoncms example with mysensors and than to create rules in openhab!
    As you have already a energy monitoring in your house you just need to find a way to combine all together in one app like openhab.

    My Project

  • Energy monitor from existing CT's
    E ewgor

    Here nobody too? Please help!

    My Project
  • Login

  • Don't have an account? Register

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