Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. shasha
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    shasha

    @shasha

    1
    Reputation
    14
    Posts
    801
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    shasha Follow

    Best posts made by shasha

    • How to receive data on openhab using UDP ? (solved)

      Hello !

      Here is the problem I am facing :

      I have an arduino node communicating using UDP. It sends on port 600 receives on port 500.
      I would like to be able to send and receive data to this node from the openhab.

      Sending data has been straight forward. It works nicely. On the other hand I did not manage to get
      any data from this node. I tried various changes in the config file and in the way to do the incoming
      binding but I still got warnings. Here are some information on my setup :

      items setup :

      String fromUDPnode "fromUDPnode" {udp="<[192.168.0.9:500:'REGEX((.*))']"}
      String toUDPnode "toUDPnode" {udp=">[192.168.0.9:500:'REGEX((.*))']"}
      
      

      config :

      udp:itemsharedconnections=true
      udp:bindingsharedconnections=true
      udp:directionssharedconnections=false
      udp:addressmask=true
      udp:postamble=
      udp:blocking=false
      udp:refreshinterval=250
      udp:port=600
      

      and here are the warnings I get :

       [WARN ] [AbstractDatagramChannelBinding] - Received data 10;59;1;0;23;0
               from an undefined remote end /192.168.0.9:500. We will not process it
       [WARN ] [AbstractDatagramChannelBinding] - No channel is active or defined for the data we received from /192.168.0.9:500. It will be discarded.
      

      seems openhab receives the data but discard them ...

      any clue on how to solve this issue ?

      Thanks

      posted in Troubleshooting
      shasha
      shasha

    Latest posts made by shasha

    • How to receive data on openhab using UDP ? (solved)

      Hello !

      Here is the problem I am facing :

      I have an arduino node communicating using UDP. It sends on port 600 receives on port 500.
      I would like to be able to send and receive data to this node from the openhab.

      Sending data has been straight forward. It works nicely. On the other hand I did not manage to get
      any data from this node. I tried various changes in the config file and in the way to do the incoming
      binding but I still got warnings. Here are some information on my setup :

      items setup :

      String fromUDPnode "fromUDPnode" {udp="<[192.168.0.9:500:'REGEX((.*))']"}
      String toUDPnode "toUDPnode" {udp=">[192.168.0.9:500:'REGEX((.*))']"}
      
      

      config :

      udp:itemsharedconnections=true
      udp:bindingsharedconnections=true
      udp:directionssharedconnections=false
      udp:addressmask=true
      udp:postamble=
      udp:blocking=false
      udp:refreshinterval=250
      udp:port=600
      

      and here are the warnings I get :

       [WARN ] [AbstractDatagramChannelBinding] - Received data 10;59;1;0;23;0
               from an undefined remote end /192.168.0.9:500. We will not process it
       [WARN ] [AbstractDatagramChannelBinding] - No channel is active or defined for the data we received from /192.168.0.9:500. It will be discarded.
      

      seems openhab receives the data but discard them ...

      any clue on how to solve this issue ?

      Thanks

      posted in Troubleshooting
      shasha
      shasha
    • RE: How to create new icons for openhab ? (Solved)

      So it does work !

      I was not activating the item so the closed icon was not displayed on the screen. As soon as I was updating the state
      to open or closed the icon was here !!

      So it has to do with the fact that when the app starts the state of the item is not known and the system is unable to
      select the proper icon.

      So I added an other icon with no state this time "motion.png" this one is displayed on start up !!!.

      Several icons are needed :
      a generic one "myicon.png" to be used when the state is not known
      various icons "myicon-statex.png" to be used when the icon is in the x state

      Shasha

      posted in OpenHAB
      shasha
      shasha
    • How to create new icons for openhab ? (Solved)

      Hello!

      I would like to create icons for openhab. For instance I want a motion detector icon.

      what I did is I created 2 icons files motion-open.png and motion-closed.png 32x32 that
      I put in the openhab/webapps/images directory

      Then in my items file I specify the <motion> option to tell I want to use this icon.
      These are the only information I found in the wiki.

      This does not seem to work.

      anything I should pay attention to so the app will display this icon ?

      many thanks

      posted in OpenHAB
      shasha
      shasha
    • RE: openhab sendCommand problem with serialbinding (Solved)

      Thank you for the info

      so all the sendCommand to Arduino I will initiate will be seen again when using a trigger like "Arduino received update".

      The workaround I was thinking is the one you suggested. That is to say to check the payload of the incoming message.

      So this problem is solved !

      Thank you !

      posted in OpenHAB
      shasha
      shasha
    • openhab sendCommand problem with serialbinding (Solved)

      Hello

      I did not find the solution for the loopback problem:

      when I use sendCommand with serialbinding the message is sent to the gateway.
      but at the same time this message is presented as an incoming message to openhab.

      so this message is processed again and creates a deathloop.

      I tried to move the sendCommand from the processing incoming message rule to a separate one
      but the problem is the same. With this new code I use cron so the message does not come immediately
      but the loop is still here.

      I could set up a workaround but I would like to know if there is a clean solution ?
      Is it the way the rule are working ? Is it due to serialbinding ? I tried to have a look at the serial binding code
      but did not find what could create the loopback.

      Help help thank you for your support !

      here is the code :

      //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)
            
                  // Internal Command
                  if ( msgType == C_INT ){
                       if(subType == I_TIME ){ 
                              println("Time request from node : " + nodeId)   
                              timeToNodeId = nodeId
                              sendTime = 1
                        }              
                  }
              }
      end
      //
      //
      //
      rule "send time"
      when
                     Time cron "0 * * * * ?"
      then
                     if (sendTime == 1) {
                         var Integer time2 = now().getMillis()/1000 +7200
                         sendCommand(Arduino, timeToNodeId+";255;3;0;1;" + time2+"\n") 
                         sendTime = 0 
                     }       
      end
      
      posted in OpenHAB
      shasha
      shasha
    • RE: Difficulties with openhab

      Regarding the time variable question I made some progress :

      var Integer time = now().getMillis()/1000    // I get the millisecondes then divide by 1000 hence the seconds
      println(nodeId +";255;3;0;1;" + time +"\n"    //  print to see the command to send
      

      this works fine I go the time in seconds from 1970. But I need to consider the timezone and the summer time.
      So I added :
      time = time + 7200 and then I get
      [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Arduino sends to Openhab': Could not invoke method: org.eclipse.xtext.xbase.lib.IntegerExtensions.operator_plus(int,int) on instance: null

      wow !!! for a simple add any clue ?

      well I decided to add the 7200 that way : var Integer time = now().getMillis()/1000 +7200
      and it works. very very strange. so now the code is :

      var Integer time = now().getMillis()/1000 + 7200    //convert the millis & add the offset for time zone and summer time
      println(nodeId +";255;3;0;1;" + time +"\n"    //  print to see the command to send
      

      The major problem is still the death loop with the
      sendCommand(Arduino, nodeId +";255;3;0;1;" + time+"\n")

      have you noticed this? seems there is a loopback in the serialbinding. Configurable maybe ?
      I will try to get some doc on this binding. At least the code could give an idea. I will look for it.

      posted in Troubleshooting
      shasha
      shasha
    • RE: Difficulties with openhab

      Here are the two pieces of code :

                        if (subType == V_TRIPPED) {
                          var String tripped="OFF"
                          if (msg=="1"){
                              tripped="ON"
                          }
                          postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), tripped)
                          println ("Unit: " + sensorToItemsMap.get( nodeId + ";" + childId + ";") + " etat: " + tripped )
      
      

      ah seems you solved one of my problems. If I change ON to OPEN and OFF to CLOSED it works !

      if(subType == I_TIME){ 
                              println("Time request" )  
                              sendCommand(Arduino, nodeId +";255;3;0;1;" + "1496700000\n")  // dummy time value
                          }
      
      posted in Troubleshooting
      shasha
      shasha
    • Difficulties with openhab

      Hello,

      I am trying to use openhab (v1.7) with a serialgateway. hum ... not easy.

      I defined an item file, a sitemap file and a rule file.

      I discovered that we need to code manythings in this rule file.

      So far I have several questions :

      1. when I want to do a postUpdate like : postUpdate(sensorToItemsMap.get( nodeId + ";" + childId + ";"), tripped)

      I got this warning message :
      [WARN ] [.c.i.events.EventPublisherImpl] - given new state is NULL, couldn't post update for 'detecteur_hall'

      where does this error come from ? all the parameters are defined and not NULL ....

      1. I am trying to send a message to the gateway like :
        sendCommand(Arduino, nodeId +";255;3;0;1;" + "1496700000\n")

      I want to send the time in response to a time request
      the message is sent to the node great !!! BUTTTTTTTTTTT at the same time it gets to openhab
      then it is processed by the "Arduino sends to Openhab" rule. So it is decoded as a time request and
      sends it again ... here comes the death loop !!!

      Any idea on how to send a message to the network that will not be presented as an incoming message ?
      what do I do wrong here ?

      the Arduino string name has been defined the items file !

      1. is there a time variable containing the time that could be addressed from the rules ?
        haha seems the function now() returns a time value I will continue checking this !

      Thanks for your help.

      posted in Troubleshooting
      shasha
      shasha
    • RE: How to use MyMessage .setDestination ??

      hum you are right !!

      thank you !

      posted in Troubleshooting
      shasha
      shasha