openHAB binding
-
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? -
@Harry-Gomez
That's all well done. does not work. It may be necessary to install any more bindings or the Java packages?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! -
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?
Many thanks.
Line 'sudo usermod -a -G dialout openhab' helped me. -
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! -
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 ttyUSB0Hi @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"] -
Hi
I have been playing a bit with creating a binding for openHAB.
And it is now in a state where i think it is ready for some more testing.Links
GitHub (https://github.com/bloft/openhab)
Download (http://bkl.linux.dk/org.openhab.binding.mysensors-1.8.0-SNAPSHOT.jar)Features
- Serial Gateway supported Only
- Supported all sensors (1.6)
- Discovery of devices (sort of)
- Support requesting values from openhab
Experimental / Not Tested
- Ethernet Gateway
- Error handling of Gateway (restart of connection)
- I_CONFIG support add mysensors:metric=true to mysensors:metric=false to openhab.cfg
Not Working
- Auto assign of Node ID
Howto Use
- Add jar to addons dir
- Modify openhab.cfg add "mysensors:port=/dev/ttyUSB0"
- Add items
Configure ethernet gateway
Modify openhab.cfg setmysensors:type=ethernet mysensors:host=<host ip> mysensors:port=5003This is still untested so please report if it is working or not.
Auto discovery
Every time a Presentation is detected, example of usage is printed to the openhab.log on INFOExample of items:
Number Humidity "Hjemmebio [%s %%Rh]" <water> (gBio,gHumidity) {mysensors="3;0;V_HUM"} Number Temperature "Hjemmebio [%s °C]" <temperature> (gBio,gTemperature) {mysensors="3;1;V_TEMP"} Switch Motion "Hjemmebio [%s]" <motion> (gBio,gMotion) {mysensors="3;2;V_TRIPPED"} Number Light "Hjemmebio [%s]" <slider> (gBio,gLightLevel) {mysensors="3;3;V_LIGHT_LEVEL"}@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 :disappointed_relieved:
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.
-
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.
-
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
-
@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
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/ttyMySensorsGatewayFollowing 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