openHAB binding



  • @BastienVH

    Hi.

    The "Unknown: MySensors message:" log, should only appear if there is not item configured to the nessage sensor and type.
    I will change this message to some thing more meaningful

    So the problem is that your items is not configured or not configured correctly.

    Try add this to you logback.xml

    <logger name="org.openhab.binding.mysensors" level="DEBUG" />
    

    After editing the items file, you should see something like.

    19:59:48.085 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Humidity_skur (Type=NumberItem, State=Uninitialized)" based on configuration "1;0;V_HUM"
    19:59:48.087 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Temperature_skur (Type=NumberItem, State=Uninitialized)" based on configuration "1;1;V_TEMP"
    19:59:48.088 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Light (Type=ColorItem, State=Uninitialized)" based on configuration "2;0;V_RGB"
    19:59:48.090 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Humidity_3 (Type=NumberItem, State=Uninitialized)" based on configuration "3;0;V_HUM"
    19:59:48.091 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Motion_3 (Type=SwitchItem, State=Uninitialized)" based on configuration "3;2;V_TRIPPED" 
    19:59:48.094 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Light_3 (Type=NumberItem, State=Uninitialized)" based on configuration "3;3;V_LIGHT_LEVEL"
    19:59:48.095 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Watt_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_WATT"
    19:59:48.097 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "Kwh_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_KWH"
    19:59:48.098 DEBUG o.o.b.m.i.MySensorsGenericBindingProvider[:85]- New Item "PulseCount_4 (Type=NumberItem, State=Uninitialized)" based on configuration "4;1;V_VAR1"
    

    This is from my setup where it works.
    Or an error saying

    Unable to parse "..." need to be in the format <number>;<number>;<type>
    


  • @bkl
    Thanks for your response.
    After adding the line of code to the logback, my debug output remains the same.
    No message that new items have been added based on the configuration, nor parse-errors.

    It's just the same as before: the messages are received, but not interpreted correctly, just the raw data like below:
    2016-02-13 15:05:55.551 [INFO ] [.b.m.internal.MySensorsBinding] - Unknown: MySensors message: node-id=20, child-sensor-id=0, message-type=set, ack=false, sub-type=V_HUM, payload=48.0

    I will start over again from scratch tomorrow, reinstall openhab and your binding to see if it helped.



  • @bkl Awesome! Thank you for this binding. Helps to minimise rules in OH.



  • After reinstalling OpenHAB, the binding works fine, thank you!
    Just a question, don't know if you can help.

    I mapped my serial gateway to /dev/MSgw because ttyUSBx tends to change when unplugging / replugging multiple USB devices into the computer (raspberry pi in my case).
    I've also got a 433MHz gateway attached and when debugging have to unplug it sometimes.
    When trying to start OpenHAB with /dev/MSgw as gateway address I get this:

    2016-02-14 10:58:33.418 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
    RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB1
    2016-02-14 10:58:34.048 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/MSgw'
    

    Do you know how/if I can still you my own custom paths to the gateway?
    Now I changed it to ttyUSB1, but that port might change after rebooting.



  • @BastienVH

    https://github.com/openhab/openhab/wiki/Serial-Binding

    Note2: If you are using non standard serial ports you have to adapt start.sh to have the serial port included. the java command line should then include the following parameters:

    -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0
    whereas ttyAMA0 is the path to your serial port. Please be aware to change all scripts you might use for startup (debug, automatic start in linux,...)



  • @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

    Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
    org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

    Thanks



  • @andredts said:

    @bkl Great work, much better than using rules. For me it worked on the first try. I will be very happy to test what I can.

    Just one question, can we only read sensors, or can we interact, as in a relay switch? I tried to use V_LIGHT to add a light switch and got this log "Binding configuration of type 'mysensors' of item ‘Relay‘ could not be parsed correctly.
    org.openhab.model.item.binding.BindingConfigParseException: Invalid Type: V_LIGHT"

    Thanks

    Hi, made some more test, and saw that bidding suggests that I use V_STATUS, so I did. Now I can see the change in the relay status and I can even turn it OFF by the OH inteface, but I can´t turn it ON. Maybe I can´t turn it on because I use inverted logic, where High is OFF, does any off that makes sense?

    Thanks



  • Tested on openhab 1.8. works very well. Thanks!



  • @andredts
    Can you try and post the sketch you are using? Or are you using the RelayWithButtonActuator Example?

    I don't thing that the inverted logic should have anything to do with it.



  • @bkl
    Hi, I´m using the MultiRelayButton 0.9b sketch, that I found here in the forum:

    0_1456141716367_Bot_es_relays.ino

    If you like I can try RelayWithButtonActuator Example, but I like the other better because it works when the server is down, no aka from server to make the state change.



  • @andredts
    It was a bug in the code. If you download the new jar then it should be fixed.



  • @bkl
    Thanks, I will give it a try and return to you with feedback.



  • @bkl
    Working beautifully. I have three relay and three switches on the arduino, and no matter how fast I press them I got no miss command. Thanks

    I got one bug, but I think it is Openhab's, when I changed the item file with Openhab running and the switch in the user interface got inverted ON-OFF and OFF-ON.



  • Hi,

    Today I was testing Motion and Door sensors. Motion worked as expected, but the door sensor only works if it's set in OH as a "switch" item(on and off feedback), if you set it as a "contact"(open/closed) item you get the log: " No item configured for "5;1;V_TRIPPED". I have used the example sketch for the sensor



  • @andredts I also notice this with the door sensors. Normal the item must be contact and not switch.



  • @andredts
    Thanks for the feedback, this is now fixed.



  • @bkl
    Thank you for your great work. Happy to help with what I can.

    Already tested and fully abandoned rules for setting up OpenHab with Mysensors.

    Next I will try a analogic read, based on the dust sensor.



  • @andredts
    Using this bidding for 15 days, with 3 relay, a Micro Sensebender, Humidity, Motion and Water level (base on dust sensor). And everything is working great.

    Thanks again.



  • Hi.
    I just added your binding and I am very happy for it because I have spent quite some time to figure out, how do I integrate mySensors in to Openhab.

    My setup
    RPI2
    did apt-get update && apt-get upgrade
    OpenHab (openHAB runtime has been started (v1.8.1))
    I have NRF24L01+ connected directly to RPI using SPI.
    I am running PiGatewaySerial service and Iam able to see communication when i do

    sudo cat /dev/ttyMySensorsGateway
    

    for example

    7;255;3;0;15;0
    7;255;0;0;17;1.5.4
    7;255;3;0;6;0
    7;255;3;0;11;Humidity
    7;255;3;0;12;1.0
    7;0;0;0;7;
    7;1;0;0;6;
    
    

    My problem is that openHab is unable to access /dev/ttyMySensorsGateway
    I see error in my logs

    2016-03-11 23:30:11.288 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyMySensorsGateway'
    
    java.lang.NullPointerException: null
            at org.openhab.binding.mysensors.internal.gateway.Serial.write(Serial.java:82) ~[na:na]
            at org.openhab.binding.mysensors.internal.MySensorsBinding.execute(MySensorsBinding.java:178) ~[na:na]
            at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
            at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
    
    
    

    I found @BastienVH post and modified /etc/init.d/openhab JAVA_ARGS_DEFAULT section and added at the end of defintion

     -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway"
    

    and restarted service

    Sadly, there was no change.
    Please can you help?

    Thank you.



  • @Pavel-Hrudka

    I use RP2 with internal serial connected directly to ATmega328 chip. So it is also a unconventional serial. And for that to work I had to put the line " -Dgnu.io.rxtx.SerialPorts=/dev/ttyMySensorsGateway" on my start.sh file, before the line that has ".jar"

    Hope it helps



  • @Pavel-Hrudka

    On my last post I miss lid you, copping your own line, but actually to use raspberry internal serial you have to add to Openhab's start.sh "-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0 " before the line with the ".jar" because the serial got to start before you run the biddings.

    Hope it helps.



  • Hi thank you.
    I solved my issue, but when I wanted to update my post, the thread was locked.

    Here in this post its said that I should create link to virtual port like this

    sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
    

    Pointing OpenHab binding to this port solved my problem.

    I did try to add command line parameter to /init.d script for OpenHab but that did not work.

    Cheers.
    Pavel



  • Hi I am new to openHAB how do you configure a relay node? I do see the node in the logs but the relay don't what to switch on or off. I have my temp and humidity sensors working already.

    18:38:50.450 [INFO ] [.b.m.internal.MySensorsBinding:257  ] - New MySensor sensor found (Dimmable device of some kind): node-id=95, sensor-id=0 with type S_DIMMER
     * Example item: 95;0;V_STATUS             - Binary status. (on/off)
     * Example item: 95;0;V_PERCENTAGE         - Percentage value. 0-100 (%)
     * Example item: 95;0;V_WATT               - Watt value for power meters
    

    Regards

    Francois



  • Hi,

    Quick question, trying to integrate the mysprinkler project into openhab.

    getting stuck using V_VAR1-3 i need to somehow export out a runtime variable to the remote ardunio... any idea how i can get the V_VAR1-3 to output something that is not binary? i.e a runtime of 5 min for sprinklers...

    i have the triggering working, just can't configure the runtime.

    any help appreciated.. will do a guide if it get it working 🙂



  • I recently moved my OpenHab install from a Raspberry PI 2 to a Raspberry Pi 3 from wheezy to jessie and now the biding is not working. Everything was working perfectly with the previous install now i keep getting the following message, serial port exist and it works. I suspect it has do to with the change from wheezy to jessie but nothing i tries is working.

    2016-03-25 19:28:20 DEBUG o.o.b.m.i.MySensorsBinding[:96]- activate
    2016-03-25 19:28:20 ERROR o.o.b.m.i.gateway.Serial[:70]- Unable to find Serial port '/dev/ttyUSB0'

    [ 3137.417846] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
    [ 3137.520958] usb 1-1.5: New USB device found, idVendor=1a86, idProduct=7523
    [ 3137.520979] usb 1-1.5: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    [ 3137.520992] usb 1-1.5: Product: USB2.0-Serial
    [ 3137.522050] ch341 1-1.5:1.0: ch341-uart converter detected
    [ 3137.525880] usb 1-1.5: ch341-uart converter now attached to ttyUSB0

    regards
    Harry



  • @Harry-Gomez
    From https://github.com/openhab/openhab/wiki/Serial-Binding

    If you are using non standard serial ports you have to adapt start.sh to have the serial port included. the java command line should then include the following parameters:

    -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0

    whereas ttyAMA0 is the path to your serial port. Please be aware to change all scripts you might use for startup (debug, automatic start in linux,...)
    whereas ttyAMA0 is the path to your serial port. Please be aware to change all scripts you might use for startup (debug, automatic start in linux,...)



  • @ted said:

    -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0

    I tried that but it did not work - this is how part of the /etc/init.d/openhab looks - any other ideas - i did not needed this with the RPi2 and wheezy

    JAVA_ARGS_DEFAULT="-Dosgi.clean=true
    -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0
    -Declipse.ignoreApp=true
    -Dosgi.noShutdown=true
    -Djetty.port=${HTTP_PORT}
    -Dopenhab.configfile="${OPENHAB_CONF_DIR}/configurations/openhab.cfg"
    -Dopenhab.configdir="${OPENHAB_CONF_DIR}/configurations"
    -Dopenhab.logdir="${OPENHAB_LOG_DIR}"
    -Dsmarthome.userdata="${OPENHAB_USER_DATA_DIR}"
    -Djetty.home="${OPENHAB_DIR}"
    -Djetty.port.ssl=${HTTPS_PORT}
    -Djetty.config="${OPENHAB_CONF_DIR}/jetty"
    -Djetty.logs="${OPENHAB_LOG_DIR}"
    -Djetty.rundir="${OPENHAB_DIR}"
    -Dfelix.fileinstall.dir="${OPENHAB_DIR}/addons"
    -Dfelix.fileinstall.filter=.*\.jar
    -Djava.library.path="${OPENHAB_DIR}/lib"
    -Djava.security.auth.login.config="${OPENHAB_CONF_DIR}/login.conf"
    -Dorg.quartz.properties="${OPENHAB_CONF_DIR}/quartz.properties"
    -Dequinox.ds.block_timeout=240000
    -Dequinox.scr.waitTimeOnBlock=60000
    -Dfelix.fileinstall.active.level=4
    -Djava.awt.headless=true
    -jar ${LAUNCHER}
    -configuration ${OPENHAB_WORKSPACE_DIR}
    -data ${OPENHAB_WORKSPACE_DIR}
    -console ${TELNET_PORT}"



  • @Harry-Gomez
    What if you modify start.sh and start openhab from console? I'm not a linux expert; could it be that the usb driver was initiated after /etc/init.d is processed ?



  • @ted

    Thank worked with change to openhab.sh - I had to put -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0 at the begining to be able to work. I'm not sure why it would workthere and not on the /etc/init.d/openhab. Also there is not start.sh when you install using apt-get it is named opendhab.sh

    Thanks!!



  • Hi what is the syntax for a relay in openhab using this binding?

    This in what I get in the log but the light do not switch on or off.

    2016-03-27 20:37:00.068 [INFO ] [runtime.busevents             ] - LightSwitch_GF_Study received command ON
    2016-03-27 20:37:00.889 [INFO ] [runtime.busevents             ] - LightSwitch_GF_Study received command OFF
    2016-03-27 20:37:01.622 [INFO ] [runtime.busevents             ] - LightSwitch_GF_Study received command ON
    2016-03-27 20:37:02.407 [INFO ] [runtime.busevents             ] - LightSwitch_GF_Study received command OFF
    2016-03-27 20:37:03.247 [INFO ] [runtime.busevents             ] - LightSwitch_GF_Study received command ON
    

    This is the syntax that I am use and it is not working. Also try V_LIGHT without any luck.

    Switch LightSwitch_GF_Study	"Study Light  [%s]"				<light> 	(GF_Study)			{mysensors="41;1;V_BINARY"}
    


  • @Francois

    Hi, I use {mysensors="12;0;V_STATUS"}. Remember to give your node a ID, because OH does not give one.



  • Hi @Francois

    The syntax look OK.

    This is what i have working.

    Switch  Relay_10_0              "Relay 1"                       <none>                                  {mysensors="10;0;V_STATUS"}
    

    Try and turn on debug log for mysensors

    Add this to logback.xml

    <logger name="org.openhab.binding.mysensors" level="DEBUG" />
    


  • Hi @bkl

    Are you using the standard relay sketch with this binding or did you change anything in the sketch as I just don't get my relay to work.

    Here is my log with the above string in my logback.xml.

    17:28:48.825 [INFO ] [.b.m.internal.MySensorsBinding:257  ] - New MySensor node found: node-id=15
     * Example item: 15;255;I_BATTERY_LEVEL      - Use this to report the battery level 0-100 (%)
     * Example item: 15;255;I_SKETCH_NAME        - Sketch name that can be used to identify sensor
     * Example item: 15;255;I_SKETCH_VERSION     - Sketch version that can be reported to keep track of the version of sensor
    17:28:48.827 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 15-15-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    17:28:50.856 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 15-15-0 s=255,c=3,t=11,pt=0,l=25,sg=0:Main Bedroom Relay & Butt
    17:28:50.858 [INFO ] [.b.m.internal.MySensorsBinding:318  ] - No item configured for "15;255;I_SKETCH_NAME"
    17:28:50.860 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 15-15-0 s=255,c=3,t=12,pt=0,l=3,sg=0:2.0
    17:28:50.862 [INFO ] [.b.m.internal.MySensorsBinding:318  ] - No item configured for "15;255;I_SKETCH_VERSION"
    17:28:50.864 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 15-15-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
    17:28:50.867 [INFO ] [.b.m.internal.MySensorsBinding:257  ] - New MySensor sensor found (Binary device (on/off)): node-id=15, sensor-id=1 with type S_BINARY
     * Example item: 15;1;V_STATUS             - Binary status. (on/off)
     * Example item: 15;1;V_WATT               - Watt value for power meters
    17:28:51.457 [DEBUG] [.p.rrd4j.internal.RRD4jService:113  ] - Stored 'LightSwitch_GF_Study' with state 'ON' in rrd4j database (again)
    17:28:51.460 [DEBUG] [.p.rrd4j.internal.RRD4jService:132  ] - Stored 'LightSwitch_GF_Study' with state '0' in rrd4j database
    17:28:51.500 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command OFF
    17:28:51.503 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    17:28:51.719 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 2-2-0 s=0,c=1,t=1,pt=7,l=5,sg=0:29.1
    17:28:51.722 [DEBUG] [.b.m.internal.MySensorsBinding:307  ] - Hum_GF_Study = 29.1
    17:28:51.729 [DEBUG] [.p.rrd4j.internal.RRD4jService:132  ] - Stored 'Hum_GF_Study' with state '29.1' in rrd4j database
    17:28:51.760 [INFO ] [runtime.busevents             :26   ] - Hum_GF_Study state updated to 29.1
    17:28:51.762 [DEBUG] [.b.m.internal.MySensorsBinding:248  ] - internalReceiveUpdate(Hum_GF_Study,29.1) is called!
    17:28:51.862 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command ON
    17:28:51.864 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    17:28:52.045 [DEBUG] [.p.rrd4j.internal.RRD4jService:132  ] - Stored 'LightSwitch_GF_Study' with state '0' in rrd4j database
    17:28:52.075 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command OFF
    17:28:52.077 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    17:28:52.252 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command ON
    17:28:52.255 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    17:28:52.448 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command OFF
    17:28:52.451 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    17:28:52.648 [DEBUG] [.b.m.internal.MySensorsBinding:263  ] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    17:28:52.650 [INFO ] [runtime.busevents             :22   ] - LightSwitch_GF_Study received command ON
    17:28:52.654 [DEBUG] [.b.m.internal.MySensorsBinding:230  ] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    17:28:52.659 [DEBUG] [.b.m.internal.MySensorsBinding:307  ] - Motion_GF_Study = ON
    17:28:52.662 [DEBUG] [.p.rrd4j.internal.RRD4jService:113  ] - Stored 'Motion_GF_Study' with state 'OFF' in rrd4j database (again)
    


  • @bkl
    Note2: If you are using non standard serial ports you have to adapt start.sh to have the serial port included. the java command line should then include the following parameters:

    -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0
    whereas ttyAMA0 is the path to your serial port. Please be aware to change all scripts you might use for startup (debug, automatic start in linux,...)

    So my question (linux newbie) is what is the best way to attach my Arduino nano to rpi, so that it always find it on reboot or if it is unplugged/replugged.

    Is this correct and will this work with the binding?
    /etc/udev/rules.d/99-usb-serial.rules"

    with my device info:
    SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A40360T2", SYMLINK+="ttyUSB99"



  • @ted
    Hi
    I use RASPBIAN JESSIE.
    Command minicom -b 115200 -o -D /dev/ttyUSB0 show traffic from serial gateway.
    I write -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0 to /usr/share/openhab/bin/openhab.sh and /etc/init.d/openhab but still 'Unable to find Serial port '/dev/ttyUSB0''.
    Please help me



  • @zeblong

    for me I had to put -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0\ right at the begining for it to work at usr/share/openhab/bin/openhab.sh - i removed from /etc/init.d/openhab it did not make a difference. below is how it looks for me. also check the output if dmesg for changes in tty. I also use jessie on a RPi3

    JAVA_ARGS_DEFAULT="-Dosgi.clean=true
    -Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0
    -Duser.timezone=America/Los_Angeles
    -Declipse.ignoreApp=true
    -Dosgi.noShutdown=true
    -Djetty.port=${HTTP_PORT}
    -Dopenhab.configfile="${OPENHAB_CONF_DIR}/configurations/openhab.cfg"
    -Dopenhab.configdir="${OPENHAB_CONF_DIR}/configurations"
    -Dopenhab.logdir="${OPENHAB_LOG_DIR}"
    -Dsmarthome.userdata="${OPENHAB_USER_DATA_DIR}"
    -Djetty.home="${OPENHAB_DIR}"
    -Djetty.port.ssl=${HTTPS_PORT}
    -Djetty.config="${OPENHAB_CONF_DIR}/jetty"
    -Djetty.logs="${OPENHAB_LOG_DIR}"
    -Djetty.rundir="${OPENHAB_DIR}"
    -Dfelix.fileinstall.dir="${OPENHAB_DIR}/addons"
    -Dfelix.fileinstall.filter=.*\.jar
    -Djava.library.path="${OPENHAB_DIR}/lib"
    -Djava.security.auth.login.config="${OPENHAB_CONF_DIR}/login.conf"
    -Dorg.quartz.properties="${OPENHAB_CONF_DIR}/quartz.properties"
    -Dequinox.ds.block_timeout=240000
    -Dequinox.scr.waitTimeOnBlock=60000
    -Dfelix.fileinstall.active.level=4
    -Djava.awt.headless=true
    -jar ${LAUNCHER}
    -configuration ${OPENHAB_WORKSPACE_DIR}
    -data ${OPENHAB_WORKSPACE_DIR}
    -console ${TELNET_PORT}" \

    ~ $ dmesg |grep tty
    [ 0.000000] Kernel command line: 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa02082 bcm2709.serial=0x71ef84a5 smsc95xx.macaddr=B8:27:EB:EF:84:A5 bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    [ 0.001288] console [tty1] enabled
    [ 0.267235] 3f215040.uart: ttyS0 at MMIO 0x3f215040 (irq = 29, base_baud = 50000000) is a 16550
    [ 0.919548] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev2
    [ 2.166808] systemd[1]: Starting system-getty.slice.
    [ 2.170421] systemd[1]: Created slice system-getty.slice.
    [ 3.635870] usb 1-1.2: ch341-uart converter now attached to ttyUSB0



  • @Harry-Gomez
    That's all well done. does not work. It may be necessary to install any more bindings or the Java packages?



  • @zeblong

    Do you have the serial package installed --> org.openhab.io.transport.serial-1.8.2.jar?

    Did you add openhab to dialout group -> sudo usermod -a -G dialout openhab

    What is the error on you logs?



  • All my temp motion and humidity sensor work but my relay and dimmer sensor don't work, why will this be the case? Here is the log:

    2016-04-03 09:25:07.928 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:07.930 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:08.186 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:08.406 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:08.527 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:08.539 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:08.584 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:08.588 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:08.625 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:08.802 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:09.247 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:09.588 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:10.421 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:10.899 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:11.410 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:11.431 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:11.594 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:11.829 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:12.513 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:12.840 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:12.841 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 0
    2016-04-03 09:25:13.145 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,0) is called!
    2016-04-03 09:25:13.394 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:13.422 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:17.880 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:17.882 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:18.025 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:18.536 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:18.538 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:18.541 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:22.736 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:22.737 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 0
    2016-04-03 09:25:23.021 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 95-95-0 s=1,c=1,t=16,pt=1,l=1,sg=0:1
    2016-04-03 09:25:23.022 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Kitchen = ON
    2016-04-03 09:25:23.033 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,0) is called!
    2016-04-03 09:25:23.431 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Kitchen,ON) is called!
    2016-04-03 09:25:23.765 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=5,c=1,t=38,pt=7,l=5,sg=0:2.90
    2016-04-03 09:25:23.766 [DEBUG] [.b.m.internal.MySensorsBinding] - MotionBatVcc_GF_Study = 2.90
    2016-04-03 09:25:23.937 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(MotionBatVcc_GF_Study,2.90) is called!
    2016-04-03 09:25:26.984 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:26.985 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:27.203 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:27.648 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:27.650 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:27.650 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 66-66-0 s=1,c=1,t=17,pt=5,l=4,sg=0:315
    2016-04-03 09:25:27.651 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "66;1;V_WATT"
    2016-04-03 09:25:27.653 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:29.284 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 66-66-0 s=1,c=1,t=24,pt=5,l=4,sg=0:2718269
    2016-04-03 09:25:29.286 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "66;1;V_VAR1"
    2016-04-03 09:25:31.838 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:31.840 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 0
    2016-04-03 09:25:32.184 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,0) is called!
    2016-04-03 09:25:33.022 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 95-95-0 s=1,c=1,t=16,pt=1,l=1,sg=0:0
    2016-04-03 09:25:33.024 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Kitchen = OFF
    2016-04-03 09:25:33.326 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Kitchen,OFF) is called!
    2016-04-03 09:25:35.140 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:35.141 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:35.447 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:35.556 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-04-03 09:25:35.557 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 1
    2016-04-03 09:25:35.561 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,1) is called!
    2016-04-03 09:25:36.738 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:36.851 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:37.297 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:37.324 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:37.758 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:37.962 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:38.434 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:38.454 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,ON) is called!
    2016-04-03 09:25:38.877 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(LightSwitch_GF_Study,OFF) is called!
    2016-04-03 09:25:39.995 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 40-40-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:40.045 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Study = 0
    2016-04-03 09:25:40.341 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Study,0) is called!
    2016-04-03 09:25:40.590 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 82-82-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:40.591 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Kitchen01 = OFF
    2016-04-03 09:25:40.595 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Kitchen01,OFF) is called!
    2016-04-03 09:25:41.596 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 2-2-0 s=0,c=1,t=1,pt=7,l=5,sg=0:43.4
    2016-04-03 09:25:41.597 [DEBUG] [.b.m.internal.MySensorsBinding] - Hum_GF_Study = 43.4
    2016-04-03 09:25:41.852 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Hum_GF_Study,43.4) is called!
    2016-04-03 09:25:43.390 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 82-82-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-04-03 09:25:43.392 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion_GF_Kitchen01 = OFF
    2016-04-03 09:25:43.395 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion_GF_Kitchen01,OFF) is called!
    


  • @Harry-Gomez

    Many thanks.
    Line 'sudo usermod -a -G dialout openhab' helped me.



  • Hi @Francois

    Yes i am using the standard relay sketch.

    I thing i found you problem, try and change V_BINARY to V_STATUS



  • Hi @Harry-Gomez

    If you make a guide to make openhab work with a non standard serial port, then i will make it part of the first post.



  • Hi,

    I'm trying to control curtain with UP/DOWN/STOP commands, but it does not work.

    2016-05-03 05:00:45.446 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Window covers or shades): node-id=30, sensor-id=0 with type S_COVER
     * Example item: 30;0;V_UP                 - Window covering. Up.
     * Example item: 30;0;V_DOWN               - Window covering. Down.
     * Example item: 30;0;V_STOP               - Window covering. Stop.
     * Example item: 30;0;V_PERCENTAGE         - Percentage value. 0-100 (%)
    
    2016-05-03 11:17:58.351 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(BedroomCurtain,UP) is called!
    2016-05-03 11:17:58.354 [DEBUG] [.b.m.internal.MySensorsBinding] - Command "class org.openhab.core.library.types.UpDownType" is not a valid Command tyoe: [class org.openhab.core.library.types.PercentType]
    

    Item:

    Rollershutter	BedroomCurtain	"Bedroom Curtain"	<"rollershutter">	(Bedroom)	{mysensors="30;0;V_PERCENTAGE"}
    

    Sitemap:

    Switch	item=BedroomCurtain mappings=[UP="Up", STOP="Stop", DOWN="Down"]
    


  • I am going to give this a try with the serial gateway. I am not sure whether to use mqtt or serial; this might help me make up my mind!
    😄



  • Hi all,
    can we please document this binding and add it to github of openhab in similiar way to all other bindings? I can help with doing so:)



  • @bkl
    Just wanted to say thanks for making my wish come true!

    My Experience Setting up OpenHab
    If it helps others, I tried OpenHab a year ago but gave it away simply because of the instabilities associated with using MQTT, i.e. needing a server, a broker, a client and the gateway. Far too many modules to configure, making it so easy to get it wrong.

    Thanks to this MySensors/OpenHab binding, the Arduino gateway talks direct to OpenHab without all the middleware, making it easier to configure and more reliable.

    It took only a few minutes to install OpenHab 1.8 and this binding. Pasted the items and sitemap examples and presto - it was working! A very pleasant change from nearly three days wasted trying to get the (alternate) OpenHab2 binding working.

    I'll upgrade to OpenHab2 when I'm confident it is stable and the matching binding is sorted out.

    Paul



  • Hi
    I have setup openhab on my pi 2 and I can see the gateway and a motion sensor with the following output in the openhab log:

    2016-05-28 16:13:05.519 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v1.8.3).
    2016-05-28 16:13:23.624 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - mDNS service has been started
    2016-05-28 16:13:24.471 [INFO ] [o.o.i.s.i.DiscoveryServiceImpl] - Service Discovery initialization completed.
    2016-05-28 16:13:29.131 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model 'test.items'
    2016-05-28 16:13:56.064 [INFO ] [penhab.io.rest.RESTApplication] - Started REST API at /rest
    2016-05-28 16:14:02.165 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /classicui/openhab.app
    2016-05-28 16:14:09.952 [DEBUG] [ySensorsGenericBindingProvider] - New Item "Motion (Type=SwitchItem, State=Uninitialized)" based on configuration "3; 2;V_TRIPPED"
    2016-05-28 16:14:10.139 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
    2016-05-28 16:14:10.456 [DEBUG] [.o.b.m.internal.gateway.Serial] - Serial port '/dev/ttyUSB0' has been found.
    2016-05-28 16:14:10.530 [INFO ] [.service.AbstractActiveService] - MySensors Refresh Service has been started
    2016-05-28 16:14:12.181 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: gateway started, id=0, parent=0, distance=0
    2016-05-28 16:14:12.194 [INFO ] [.b.m.internal.MySensorsBinding] - Gateway Ready
    2016-05-28 16:14:35.120 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-05-28 16:14:35.136 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;1;V_TRIPPED"
    2016-05-28 16:14:49.747 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
    2016-05-28 16:14:49.760 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;255;I_REQUEST_SIGNING"
    2016-05-28 16:14:49.771 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=255,c=0,t=18,pt=0,l=5,sg=0:1.5.4
    2016-05-28 16:14:49.836 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor node found: node-id=1 ( REPEATER )

    • Example item: 1;255;I_BATTERY_LEVEL - Use this to report the battery level 0-100 (%)
    • Example item: 1;255;I_SKETCH_NAME - Sketch name that can be used to identify sensor
    • Example item: 1;255;I_SKETCH_VERSION - Sketch version that can be reported to keep track of the version of sensor
      2016-05-28 16:14:49.851 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
      2016-05-28 16:14:50.016 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: send: 0-0-1-1 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
      2016-05-28 16:14:51.780 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=255,c=3,t=11,pt=0,l=13,sg=0:Motion Sensor
      2016-05-28 16:14:51.792 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;255;I_SKETCH_NAME"
      2016-05-28 16:14:51.806 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
      2016-05-28 16:14:51.821 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;255;I_SKETCH_VERSION"
      2016-05-28 16:14:51.832 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=0,t=1,pt=0,l=0,sg=0:
      2016-05-28 16:14:51.847 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Motion sensor): node-id=1, sensor-id=1 with type S_MOTION
    • Example item: 1;1;V_TRIPPED - Tripped status of a security sensor. (Tripped/Untripped)
    • Example item: 1;1;V_ARMED - Armed status of a security sensor. (Armed/Bypassed)
      2016-05-28 16:14:51.861 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
      2016-05-28 16:14:51.868 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;1;V_TRIPPED"
      2016-05-28 16:15:10.721 [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
      2016-05-28 16:15:43.284 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
      2016-05-28 16:15:43.298 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "1;1;V_TRIPPED"

    "no item configured fo "1;1;V_TRIPPED" seems to be confusing me. I have entered the motion sensor into the items file as in the example so can you point me in the direction to correct this please?
    I am very impressed so far, easier to get to this stage than it was using insteon!



  • Found it! I had the .items entries wrong and if I had read things properly I would have worked it out before 😥

    2016-05-28 18:22:35.565 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model 'test.items'
    2016-05-28 18:22:35.649 [DEBUG] [ySensorsGenericBindingProvider] - New Item "Motion (Type=SwitchItem, State=Uninitialized)" based on configuration "1;1;V_TRIPPED"
    2016-05-28 18:22:46.463 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-05-28 18:22:46.488 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion = OFF
    2016-05-28 18:22:46.504 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion,OFF) is called!
    2016-05-28 18:22:52.541 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-05-28 18:22:52.552 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion,ON) is called!
    2016-05-28 18:22:52.562 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion = ON
    2016-05-28 18:23:11.590 [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
    2016-05-28 18:23:58.676 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-05-28 18:23:58.688 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion,OFF) is called!
    2016-05-28 18:23:58.698 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion = OFF
    2016-05-28 18:24:05.045 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    2016-05-28 18:24:05.058 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion,ON) is called!
    2016-05-28 18:24:05.067 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion = ON
    2016-05-28 18:24:08.746 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read and forward: 4-4-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    2016-05-28 18:24:09.134 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: send: 0-0-4-4 s=255,c=3,t=8,pt=1,l=1,sg=0,st=fail:0
    2016-05-28 18:24:11.594 [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
    2016-05-28 18:25:11.141 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2016-05-28 18:25:11.155 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Motion,OFF) is called!
    2016-05-28 18:25:11.165 [DEBUG] [.b.m.internal.MySensorsBinding] - Motion = OFF



  • @hek @bkl
    Just want to say a REAL BIG THANKS for this binding and for the whole mysensors system.

    I have been trying to use openhab 1.8 for my PhD project and I initially setup insteon and had so many headaches I gave up in disgust. I was pointed in the direction of mysensors as a possibility and I thought I had nothing to lose.
    Not only is the binding a success, I have two motion sensors running, one on a pro mini with 2xAA batteries running it as a test and one on a uno, I have persistence running and successfully logging the status of my devices on each and every update! I am using mongodb for the persistence methods as I love nosql, even though I have to teach relational databases at the moment, (trying to turn the Uni onto the light side).

    Anyway, for those interested, here is a log from the db:
    {
    "_id" : ObjectId("574acbe1e4b0cd9ed18ada26"),
    "item" : "DiningRoom",
    "realName" : "DiningRoom",
    "timestamp" : ISODate("2016-05-29T11:00:49.761Z"),
    "value" : "ON"
    }
    {
    "_id" : ObjectId("574acbe3e4b0cd9ed18ada27"),
    "item" : "DiningRoom",
    "realName" : "DiningRoom",
    "timestamp" : ISODate("2016-05-29T11:00:51.136Z"),
    "value" : "OFF"
    }
    {
    "_id" : ObjectId("574acc25e4b0cd9ed18ada2a"),
    "item" : "DiningRoom",
    "realName" : "DiningRoom",
    "timestamp" : ISODate("2016-05-29T11:01:57.823Z"),
    "value" : "ON"
    }

    the .items file looks like this, (so you can see the naming strategy)

    Switch DiningRoom "DiningSensor [%s]" <motion> (GF_Dining) {mysensors="1;1;V_TRIPPED"}
    Switch LivingRoom "LivingSensor [%s]" <motion> (GF_Living) {mysensors="2;1;V_TRIPPED"}

    .All in a brilliant success. Now to play with the rules and add lots of new sensors.
    THANKS AGAIN!!!!!



  • A Short Followup

    I've had this binding running 24x7 for a week or more and it has been faultless! - Thank You!

    For the newbie attempting to get OpenHab up and running, this is the answer, the only answer! It's so clean and simple, download OpenHab (1.8) and this binding and run.

    Cheers,

    Paul



  • I am amazed by your work @bkl !
    I have a few question for you:
    Can I use your binding somehow to integrate RGB light in openhab with the color wheel? I have some programmable rgb ledstrip that I was thinking about integrating into openhab, but I am unsure how to do this. I was thinking about using the color widget in the sitemap together with a DMX syntax:

    if my led strip has 56 diodes

    Color rgb_strip_living_room "RGB Ledstrip Living Room" {dmx="CHANNEL[0-56]"}.
    

    But then i could also use the same ledstrip in 2 by setting two different color like

    Color rgb_strip_living_room2 "RGB Ledstrip Living Room" {dmx="CHANNEL0-23]"}
    Color rgb_strip_living_room3 "RGB Ledstrip Living Room" {dmx="CHANNEL24-56]"}
    

    Then I would also like to send IR commands from OH to mysensor, have any of you done that?

    Keep up the great work, and let me know if I somehow can help with expanding/documenting the binding.



  • Hi @skatun

    I have some RGB lights, using mysensors and openhab

    Item configuration

    Color	Light_6_0		"Light Left"						(gBio,gLights)		{mysensors="6;0;V_RGB"}
    

    Sketch

    #include <MySensor.h>
    #include <ChainableLED.h>
    #include <SPI.h>
    
    #define NODE_ID 6
    
    #define NUM_LEDS 1
    
    int counter[NUM_LEDS];
    
    int current[NUM_LEDS][3];
    int step[NUM_LEDS][3];
    
    unsigned long SLEEP_TIME = 10;
    
    MySensor gw;
    //ChainableLED leds(7, 8, 1);
    ChainableLED leds(5, 6, NUM_LEDS);  // CLK, DATA, LEDS
    
    void setup() {   
      leds.init();
      for(byte childId = 0; childId < NUM_LEDS; childId++) {
        counter[childId] = 0;
        current[childId][0] = 0;
        current[childId][1] = 0;
        current[childId][2] = 0;
        step[childId][0] = 0;
        step[childId][1] = 0;
        step[childId][2] = 0;
        leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]); // Turn of on startup
      }
      
      // Initialize library and add callback for incoming messages
      gw.begin(incomingMessage, NODE_ID, true);
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("RGB Led", "1.2");
      for(byte childId = 0; childId < NUM_LEDS; childId++) {
       gw.present(childId, S_RGB_LIGHT);
      }
    }
    
    
    void loop()  {
      // Alway process incoming messages whenever possible
      gw.process();
    
      for(byte childId = 0; childId < NUM_LEDS; childId++) {
        if(counter[childId] >= 0) {
          counter[childId]--;
          int i = 1020 - counter[childId];
          current[childId][0] = calculateVal(step[childId][0], current[childId][0], i);
          current[childId][1] = calculateVal(step[childId][1], current[childId][1], i);
          current[childId][2] = calculateVal(step[childId][2], current[childId][2], i);
          
          leds.setColorRGB(childId, current[childId][0], current[childId][1], current[childId][2]);
        }
      }
      
      gw.wait(SLEEP_TIME);
    }
    
    void incomingMessage(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_RGB) {
        String hexstring = message.getString();
        long number = (long) strtol( &hexstring[0], NULL, 16);
        int colorR = number >> 16;
        int colorG = number >> 8 & 0xFF;
        int colorB = number & 0xFF;
        
         // Write some debug info
         Serial.print("Incoming change for sensor:");
         Serial.print(message.sensor);
         Serial.print(", Red: ");
         Serial.print(colorR);
         Serial.print(", Green: ");
         Serial.print(colorG);
         Serial.print(", Blue: ");
         Serial.print(colorB);
         Serial.print(", New status: ");
         Serial.println(message.getString());
    
          setColor(message.sensor, colorR, colorG, colorB);
         //leds.setColorRGB(message.sensor, colorR, colorG, colorB);
       } 
    }
    
    void setColor(byte led, int R, int G, int B) {
      step[led][0] = calculateStep(current[led][0], R);
      step[led][1] = calculateStep(current[led][1], G);
      step[led][2] = calculateStep(current[led][2], B);
    
      counter[led] = 255;
    }
    
    int calculateStep(int prevValue, int endValue) {
      int step = endValue - prevValue; // What's the overall gap?
      if (step) {                      // If its non-zero, 
        step = 255/step;              //   divide by 1020
      } 
      return step;
    }
    
    int calculateVal(int step, int val, int i) {
    
      if ((step) && i % step == 0) { // If step is non-zero and its time to change a value,
        if (step > 0) {              //   increment the value if step is positive...
          val += 1;           
        } 
        else if (step < 0) {         //   ...or decrement it if step is negative
          val -= 1;
        } 
      }
      // Defensive driving: make sure val stays in the range 0-255
      if (val > 255) {
        val = 255;
      } 
      else if (val < 0) {
        val = 0;
      }
      return val;
    }
    

    The sketch may be a bit over complicated, but the important part is the incomingMessage, all the rest is because I like to fade between the colors.

    Hope it help you.



  • @bkl Thanks for your code, just to be sure, you only have 1 LED in your LED strip? NUM_LEDS = 1 or does that define child ID? In mine I have 38, 52,43,78,23,67 leds in my ledstrips. How can I modify your code to be used as locally attached sensor on the gateway? Also I have 6 ledstrip connected to my gateway.

    Copyright 2015 Sensnology | Forum Guidelines | Privacy Policy | Terms of Service



  • @skatun

    My code was just to show how the integration between openhab and mysensors is working.
    And correct my led strip is controlled by a single P9813 chip,

    You could try and change NUM_LEDS but this will also increase the number of Sensors in openhab/mysensors
    Or you could group them togetter in the sketch.



  • Is it possible to change de default baud rate for the 1.8.0 binding? As I'm using a 8 MHz mini for my serial gateway I would like to set the baudrate to 38.4 kbps.

    I read that this would be possible for the Openhab 2.0 binding but I'm reluctant to move to Openhab 2.0 as its only a beta at the moment.

    Is it possible otherwise to compile a new jar with this lower baud rate? I guess two versions would be enough, 38.4 and 115.2.

    Thanks!



  • I've been trying to get a mysensors node which is using an nRF24L01+ to transmit to a directly connected nRF24L01+ on a Raspberry Pi 3 running PiGatewaySerial. When I start the gateway I get

    Starting PiGatewaySerial...
    Protocol version - 1.4
    Created PTY '/dev/pts/0'
    Gateway tty: /dev/ttyMySensorsGateway
    

    Following some other instruction I created a link to /dev/ttyUSB20 so that openhab could recognize it. I have Openhab with your serial binding in the addons folder. I am having difficulty with the binding. I feel like I have made a tiny bit of headway but it doesn't seem to be able to bind with it. In the openhab debug log I get:

    2016-07-16 14:39:15.537 [ERROR] [.service.AbstractActiveService] - Error while executing background thread MySensors Refresh Service
    java.lang.NullPointerException: null
    	at org.openhab.binding.mysensors.internal.gateway.Serial.write(Serial.java:82) ~[na:na]
    	at org.openhab.binding.mysensors.internal.MySensorsBinding.execute(MySensorsBinding.java:178) ~[na:na]
    	at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na]
    	at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
    

    What other information would you need to know to help me trouble shoot this?

    EDIT: This has been solved. See here:
    https://forum.mysensors.org/topic/4315/attempt-to-bind-ttymygatewayserial-to-openhab-failing-miserably



  • @NickBuilder

    Hi

    No need for a new version, baudrate is configurable

    just set.
    mysensors:baudrate=38400



  • @bkl

    Thank you @bkl! That is the best answer I could have wished for. 🙂

    I've actually tried some similar prefixes to the port definition, such as "...:38400" and "...@38400" etc. I haven't found any documentation describing the available binding settings more than the port definition that you mention here at the top. I guess the documentation will be more complete for the Openhab 2.0 binding description.

    Thank you for your great work here!



  • Hello I have a trouble with binding.
    My gateway 1.5.4 still only show
    [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.5.4
    2016-07-20 15:30:58.044 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    2016-07-20 15:31:00.060 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    2016-07-20 15:31:02.067 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    2016-07-20 15:31:04.074 [DEBUG] [.b.m.internal.MySensorsBinding] - I_LOG_MESSAGE: read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    but nothing else .
    I tested lot of sensor but still same error.
    Have you any idea ?
    Thanks



  • @Peter-Šuľaj I'm fairly new to this stuff, but curious if you are trying to auto-assign node ID? I don't believe the MySensorsBinding supports auto-assign so you have to define it as static and use:

    #define NODEID  3 //or whatever
    
    //and then call this in your setup instead of Sensor.begin();
    Sensor.begin(NULL, NODEID);
    

    in your script. Again, not sure if this is your problem but I figured I would chime in.



  • @bkl
    Hello again!

    Is there also support for sending the ack bit from the gw in some way? I saw that this is actually possible in the 2.0 binding. If it's possible how is a "not ack" handled? This would be very useful for e.g. a relay sensor.

    I also noticed that you're not the author of the 2.0 binding, I'm sorry for making that assumption.

    Thanks!



  • This binding works perfectly! Thanks for putting it together!



  • Thanks for the Binding! It would be very nice if you could implement SmartSleep, so that the node sends a heartbeat message to the Controller when waking up.



  • Hi,
    I had a working serial Gateway and one temp sensor setup.
    I now updated to 2.0 version for both but I can't see the gateway working with openhap while the sensor can send it's data fine it looks.
    Any idea what could be the problem?

    Sensor Serial log:

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=1)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    !TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=ok:Temperature Sensor
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1
    TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
    Request registration...
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
    TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=1, parent=0, distance=1, registration=1
    TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:24.7
    

    Openhab:

    2016-08-22 10:23:43.295 [DEBUG] [ySensorsGenericBindingProvider] - New Item "tempWhz1 (Type=NumberItem, State=Uninitialized)" based on configuration "1;0;V_TEMP"
    2016-08-22 10:23:43.331 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
    2016-08-22 10:23:43.342 [DEBUG] [.o.b.m.internal.gateway.Serial] - Serial port '/dev/ttyAMA0' has been found.
    2016-08-22 10:23:43.353 [INFO ] [.service.AbstractActiveService] - MySensors Refresh Service has been started
    

    And nothing else more on the openhab.log even I restart the sensor node.



  • @Alex-Schick
    I recognized that baudrate switched for gateway to 74880 instead of 115200 as before.
    That is related to https://forum.mysensors.org/topic/1483/trouble-with-115200-baud-on-3-3v-8mhz-arduino-like-serial-gateway-solution-change-baudrate/9

    Changed by adding setting in open hab mysensors:baudrate=74880
    But opening serial on the raspberry I only see rubish (fine when connected to PC). So connection seems to be not ok....

    EDIT: Got it sorted. Flashed for 16mhz and it worked fine with baud rate 38400.



  • Greetings All,

    I would very much like to download this binding, but the download link appears to be broken. Any possibility we could fix the link or repost the binding jar file.

    Looks like the server is back up!

    Thanks!

    Momanz



  • Hello all,

    i use a ATMEGA328P with internal clock (MysBootloader) and have a 4-channel relay board connected at the Arduino outputs D3-D6 (current MySensors Example Sketch).

    As central unit i use a RaspberryPi with openhab 1.8 and a serial gateway (Arduino Nano) and the MySensors- OpenHAB serial binding of @bkl

    The OpenHab item looks like this:

    Switch Lights_Downlights_Front "Downlights Front" <selfLight> (Outdoor, Lights_Outdoor) {mysensors="54;1;V_STATUS"}

    Unfortunately I can not switch the relays ON or OFF.
    Many other sensors (Temp, Hum, Rain) works fine with this environment.

    Any help is appreciated!

    Greets & Thanks



  • Hi @bkl and all other user of this great binding!

    I would like to know if its possible to send a message using this binding. I will try to explain my problem.

    I've built the "EnergyMeterPulseSensor.ino" sensor and I have it up and running. The sketch request a starting number for the count loop and if the item in Openhab has been initialized this value is sent back per request.
    This request function is only active before the actual count begins.

    I would now like to be able to reset the counter each midnight but as the sensor only requests the start count value at each startup I would have to manually restart the sensor at the same time as I have "reinitialized" the count item with a "0".

    I now see two ways of doing this if this binding allows it:

    • 1: Send a "I_REBOOT" in some way through the binding directly after manually updating the count item with a "0".

    • 2: Sending a new count value via the V_VAR1 parameter. This would be preferable I guess.

    In this thread @stoffej is after the same thing. I've tried the same approach using a myPulsecountItem.sendCommand(0) but other than adding a "0" to the persistence service nothing happens. The count continues where it left off. So my guess is that there is no actual message sent to the sensor. Sadly I don't get any useful information from the debug-xml. I don't know where @stoffej got the debug message I_LOG_MESSAGE:..., my serial debugging interface towards the gateway is occupied.

    My count item is defined as:

    Number  myElecVar "Elmätare pulser [%d]" {mysensors="50;1;V_VAR1"}
    

    I guess if I could utilize a switch item in some way I could send a message in the same way as in the relay implementation. For a switch I know that a message is being sent as I've built one of those myself but the switch can only send "on" or "off".

    Here's the receive function from the sketch:

    void receive(const MyMessage &message) {
      if (message.type==V_VAR1) {  
        pulseCount = oldPulseCount = message.getLong();
        Serial.print("Received last pulse count from gw:");
        Serial.println(pulseCount);
        pcReceived = true;
      }
    }
    

    Assistance is much appreciated!



  • @sensorchecker Hi!
    Its not easy helping you using only the posted information. Any debug logs available from Openhab or the serial interface terminal?

    My item defintion looks the same:

    Switch Lampa <light> {mysensors="40;1;V_STATUS"}
    


  • I'm trying to get a single Dallas Temp sensor displayed in OpenHAB using the Serial Gateway. I'm running the MySensors v2 Dallas Temp sketch, and I'm seeing my sensor in the logs. However, I'm getting the following:

    2016-09-28 07:34:21.805 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'mysensors' of item ?Temperature? could not be parsed correctly.
    java.lang.NullPointerException: null
    	at java.util.regex.Matcher.getTextLength(Matcher.java:1234) ~[na:1.7.0_101]
    	at java.util.regex.Matcher.reset(Matcher.java:308) ~[na:1.7.0_101]
    	at java.util.regex.Matcher.<init>(Matcher.java:228) ~[na:1.7.0_101]
    	at java.util.regex.Pattern.matcher(Pattern.java:1088) ~[na:1.7.0_101]
    	at org.openhab.binding.mysensors.internal.MySensorsGenericBindingProvider.validateItemType(MySensorsGenericBindingProvider.java:57) ~[na:na]
    	at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:347) [org.openhab.model.item_1.8.3.jar:na]
    	at org.openhab.model.item.internal.GenericItemProvider.internalDispatchBindings(GenericItemProvider.java:324) [org.openhab.model.item_1.8.3.jar:na]
    	at org.openhab.model.item.internal.GenericItemProvider.processBindingConfigsFromModel(GenericItemProvider.java:171) [org.openhab.model.item_1.8.3.jar:na]
    	at org.openhab.model.item.internal.GenericItemProvider.modelChanged(GenericItemProvider.java:390) [org.openhab.model.item_1.8.3.jar:na]
    	at org.openhab.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:159) [org.openhab.model.core_1.8.3.jar:na]
    	at org.openhab.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:100) [org.openhab.model.core_1.8.3.jar:na]
    	at org.openhab.model.core.internal.folder.FolderObserver.checkFolder(FolderObserver.java:142) [org.openhab.model.core_1.8.3.jar:na]
    	at org.openhab.model.core.internal.folder.FolderObserver.run(FolderObserver.java:99) [org.openhab.model.core_1.8.3.jar:na]
    
    

    My item definition looks like the following:

    Number  Temperature           "Temp [%s °C]"     <temperature>   (gBio,gTemperature)     {mysensors=105;1;V_TEMP}
    

    As a follow-on, I've been trying to understand the {mysensors=105;1;V_TEMP} binding and what the semicolon separated values represent. So far I've been following example code, and haven't found the right documentation. Can someone point me to the right place? I appreciate any help.



  • @NickBuilder
    From what i know sendCommand should be the way to go.

    myElecVar.sendCommand(0);
    

    That should send the value to your sensor, and then update its value of pulseCount



  • Hi @Kodiak80

    Your are missing the " item definition should be.

    Number  Temperature           "Temp [%s °C]"     <temperature>   (gBio,gTemperature)     {mysensors="105;1;V_TEMP"}
    

    The values is just

    node-id;child-sensor-id;sub-type
    


  • @bkl
    Ok. But for some reason the new value is not accepted in my case. I will try and see if the serial terminal, when connected to the sensor, will give a hint on what’s going on. It would be nice if the debug of the binding could show what is actually being sent to (and possibly through) the gateway. Is this possible already by ”activating” a certain debug.xml module?

    The serial binding is quite clear in this regard as the message with payload according to the mysensor protocol is displayed in the debug log.



  • ...trying to download the jar from the link in the first post, but server is not reachable. Is there any other URL to this .jar?



  • @bkl First off I want to thank you for the MySensors openhab binding. It works wonderfully!

    In the MySensors 2.0 there is an internal message that doesn't seem to be handled by the binding. I believe it needs to be handled in MySensorsBinding.java. I would do it myself but my knowledge of Java sucks....to put it lightly. The internal message is:

    I_DISCOVER_RESPONSE
    

    so my openhab log keeps getting spammed with:

    2016-10-21 22:16:21.653 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "4;255;I_DISCOVER_RESPONSE"
    2016-10-21 22:26:21.374 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "4;255;I_DISCOVER_RESPONSE"
    2016-10-21 22:36:22.127 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "4;255;I_DISCOVER_RESPONSE"
    2016-10-21 22:46:21.847 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "4;255;I_DISCOVER_RESPONSE"
    2016-10-21 22:56:21.569 [INFO ] [.b.m.internal.MySensorsBinding] - No item configured for "4;255;I_DISCOVER_RESPONSE"
    

    I'm assuming that we just need to add a line to:

    public void incommingMessage(Message message)
    

    to handle it but I would rather let you do it since like I said....I suck with Java. Is that something that would be an easy fix?



  • Ethernet gw binding source seems to be missing in github repo.

    Any clue?

    Thanks

    : Compilation failure:
    [ERROR] /root/openhab/bundles/binding/org.openhab.binding.mysensors/src/main/java/org/openhab/binding/mysensors/internal/MySensorsBinding.java:[17]
    [ERROR] import org.openhab.binding.mysensors.internal.gateway.Ethernet;
    [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ERROR] The import org.openhab.binding.mysensors.internal.gateway.Ethernet cannot be resolved
    [ERROR] /root/openhab/bundles/binding/org.openhab.binding.mysensors/src/main/java/org/openhab/binding/mysensors/internal/MySensorsBinding.java:[117]
    [ERROR] gateway = new Ethernet(prop.getProperty("host"), Integer.parseInt(prop.getProperty("port", "5003")));
    [ERROR] ^^^^^^^^
    [ERROR] Ethernet cannot be resolved to a type
    [ERROR] 2 problems (2 errors)
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR] mvn <goals> -rf :org.openhab.binding.mysensors



  • How do I add the "my-sensors" add on to openhab2.0. I openhab2 up and running based on their rasp-image. I have downloaded a couple other adds and install just fine. I don't know how to place the .jar file into the adds. Is there a clear guide on how to get this done ? PLS HELP!



  • @bkl Hi,

    Use this biding from it`s beginning, many thanks again. Just want to know if there is any function like the "ack" as there is on OH2 binding, where gateway re-sends the msg 5 times if it does not hear from the sensor after a command. It´s a killer function to make it more reliable, but I´m not ready for OH2 yet.

    Thanks



  • Hi,
    after my openHAB system completely failed I had to re-install everying. I had MySensors configured the old way with a lot of rules with the serial binding I thought I give the binding a try.
    In general it works but I have issues with S_COVER, not sure how to configure this.
    But of course in openhab it is a single Rollershutter item... I think I could do a workaround in creating in total 4 items and only show my rollershutter and then have a rule and based on up/down/stop update the 3 items.

    Anyhow, seems to complex.

    What is best practice here?

    The sensor presents itself with this:

     * Example item: 188;2;V_UP                 - Window covering. Up.
     * Example item: 188;2;V_DOWN               - Window covering. Down.
     * Example item: 188;2;V_STOP               - Window covering. Stop.
     * Example item: 188;2;V_PERCENTAGE         - Percentage value. 0-100 (%) ```


  • I saw STOP in S_cover is not supported in OH2 - what about OH1? Anyone?


  • Hero Member

    @parachutesj According OH2: That was fixed a looooooong time ago. 😄

    Refer to: https://github.com/tobof/openhab2-addons/wiki/Examples for an example (cover).



  • @TimO thank you.
    and what is with OH1? Not getting it to work.
    Does not seem that STOP works, UP & DOWN and PERCENTAGE work


  • Hero Member

    @parachutesj I can't help you with this version of the binding, I've never used it.



  • @TimO Thanks anyway. I am slowly moving into the OH2 direction - still a lot of things to be clarified and configured



  • Hello guys, who can unpin this post?

    It is terribly outdated.

    The effort for an openhab-mysensors binding is still valid but several things changed on OpenHAB, making this a lot easier.


  • Mod

    @guillermo-schimmel done. Is there some other post that should be pinned instead?



  • @mfalkvidd Thanks! Just give me a couple of days and I will try to make a new tutorial for mysensors+openhab.


Log in to reply
 

Suggested Topics

  • 22
  • 2
  • 3
  • 1
  • 5
  • 7

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts