openhab send message to mysensors, serial, mysensorbinding



  • Hi
    I have a openhab instance running on a linux machine.
    That openhab is connected to mysensor via a serial gateway.

    I have managed to receive data via the serial gateway.
    I have two powermeter sensors which request value from openhab during startup.

    So it seems that it is possible to send message from openhab to mysensors.
    receiving is not a problem.

    But I would like to send the same value in a rule also. How do I do that?
    The rule ..

    // nollställer pulsecounter varje midnatt
    rule "Midnight"
    when
        Time cron  "0 59 23 * * ? "
    then
          var Number zero = 0
          postUpdate(my_nibe_pulsecount,zero)
          //sendCommand(Arduino, my_nibe_pulsecount) or something similar???
               
          logInfo("logg"," reset pulscounters")
    end
    

    This is the Item i want to send from openhab to mysensors.

    Number  my_pulsecount "V_VAR1 (pulse count) [%d]" {mysensors="10;1;V_VAR1"}
    


  • After some testing I reporduce the command that I want be able to send from the rule in openhab to mysensor.

    I_LOG_MESSAGE: send: 0-0-5-10 s=1,c=1,t=24,pt=0,l=8,sg=0,st=ok:13237476
    

    So with this code it works !!

    my_nibe_pulsecount.sendCommand(0)
    


  • This has been solved!

    Hi @stoffej!

    Can you please try to assist me on a very similar topic?

    I've built the EnergyMeterPulseSensor.ino pulse count sensor from the 2.0 library but I'm unable to initialize the items and I'm quite certain that this is why I'm not getting any values into Openhab. The Arduino is waiting for a request to be acknowledged which I guess is not happening.

    I have enabled persistence for the pulse counter items and I've also tried to initialize the items by manually sending a value through the openhab console (telnet localhost 5555). After updating the values manually I can see the new value in the sitemap-GUI but the actual counting does not start.

    After restarting Openhab the following is shown in the log:

    ... - New Item "myPCVar (Type=NumberItem, state=Uninitialized) based on configuration "50;1;V_VAR1"
    

    A funny thing is that I actually got it working while working on the pulse counter on an experimental setup without actually trying to initialize the items. I don't know what I did at that time or if it started working just by chance.

    Do you have any ideas of what steps to try? Thanks!

    Ah forget what I wrote. Its working now. I guess it was a poor radio module which seems to be the reason in a lot of cases.


Log in to reply
 

Suggested Topics

  • 22
  • 5
  • 1
  • 10
  • 135
  • 7

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts