Attempt to bind ttyMyGatewaySerial to openhab failing miserably



  • Raspberry Pi3
    Running openhab v1.8.3
    nRF24L01+ connected directly to SPI of the Raspberry Pi using this instruction:

    https://forum.mysensors.org/topic/2437/step-by-step-procedure-to-connect-the-nrf24l01-to-the-gpio-pins-and-use-the-raspberry-as-a-serial-gateway

    This gives me a serial gateway "ttyMySensorsGateway" and as the instructions specify I have a symbolic link between that and "ttyUSB20" (whatever that means....sorry new at some of this stuff):

    ttyMySensorsGateway
    ttyprintk
    ttyS0
    ttyUSB20
    

    Next I followed this instruction:

    https://forum.mysensors.org/topic/3108/openhab-binding

    This is the result of all of this in the openhab debug log. What steps am I missing here?

    2016-07-16 22:59:50.599 [DEBUG] [i.internal.GenericItemProvider] - Start processing binding configuration of Item 'Temperature (Type=NumberItem, State=Uninitialized)' with 'MySensorsGenericBindingProvider' reader.
    2016-07-16 22:59:50.608 [DEBUG] [ySensorsGenericBindingProvider] - New Item "Temperature (Type=NumberItem, State=Uninitialized)" based on configuration "3;1;V_TEMP"
    2016-07-16 22:59:50.609 [DEBUG] [i.internal.GenericItemProvider] - Start processing binding configuration of Item 'Temperature (Type=NumberItem, State=Uninitialized)' with 'MySensorsGenericBindingProvider' reader.
    2016-07-16 22:59:50.610 [DEBUG] [ySensorsGenericBindingProvider] - New Item "Temperature (Type=NumberItem, State=Uninitialized)" based on configuration "3;1;V_TEMP"
    2016-07-16 22:59:50.656 [DEBUG] [.b.m.internal.MySensorsBinding] - activate
    2016-07-16 22:59:50.723 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyUSB20'
    2016-07-16 22:59:50.724 [INFO ] [.service.AbstractActiveService] - MySensors Refresh Service has been started
    2016-07-16 22:59:50.728 [DEBUG] [inding.ntp.internal.NtpBinding] - Got time from ptbtime1.ptb.de: Saturday, 16 July 2016 22:59:50 o'clock UTC
    2016-07-16 22:59:50.747 [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]```


  • Woo Hoo!!!!

    2016-07-17 15:39:53.970 [DEBUG] [.o.b.m.internal.gateway.Serial] - Serial port '/dev/ttyUSB20' has been found.
    

    Not sure what fixed it. I added pi and openhab to user group 'tty' and then rebooted. Okay baby steps here....moving on.

    pi@raspberrypi:~ $ sudo adduser pi tty
    Adding user `pi' to group `tty' ...
    Adding user pi to group tty
    Done.
    pi@raspberrypi:~ $ sudo adduser openhab tty
    Adding user `openhab' to group `tty' ...
    Adding user openhab to group tty
    Done.
    


  • Oh my gosh....I'm officially geeking out!

    2016-07-17 15:42:54.396 [DEBUG] [.b.m.internal.MySensorsBinding] - Gateway Version: 1.4```


  • OH MY GOSH!!! Just plugged in a node! It's alive! This is the best day of my life!!!

    2016-07-17 15:50:05.345 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor node found: node-id=0
     * Example item: 0;255;I_BATTERY_LEVEL      - Use this to report the battery level 0-100 (%)
     * Example item: 0;255;I_SKETCH_NAME        - Sketch name that can be used to identify sensor
     * Example item: 0;255;I_SKETCH_VERSION     - Sketch version that can be reported to keep track of the version of sensor
    


  • Awwwww.....good feelings gone 😞

    2016-07-17 15:50:54.019 [DEBUG] [.o.b.m.internal.gateway.Serial] - Error writing data on serial port /dev/ttyUSB20: Input/output error in writeArray
    2016-07-17 15:50:54.021 [DEBUG] [.b.m.internal.MySensorsBinding] - Ping gateway: Faild, unable to contact gawatay
    2016-07-17 15:50:54.026 [DEBUG] [.b.m.internal.MySensorsBinding] - Starting new gateway
    2016-07-17 15:50:54.032 [ERROR] [.o.b.m.internal.gateway.Serial] - Unable to find Serial port '/dev/ttyUSB20'
    

    I'm on an emotional roller coaster here. Now I'm back to:

    2016-07-17 15:51:54.065 [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]```


  • Checked the PiGatewaySerial.log file and nothing seems out of place. The log for today is simply:

    Jul 17 15:38:13 raspberrypi PiGatewaySerial: Starting PiGatewaySerial...
    Jul 17 15:38:13 raspberrypi PiGatewaySerial: Protocol version - 1.4
    Jul 17 15:38:13 raspberrypi PiGatewaySerial: Created PTY '/dev/pts/0'
    Jul 17 15:38:13 raspberrypi PiGatewaySerial: Gateway tty: /dev/ttyMySensorsGateway```


  • Oh! It's working again. I had used the stock eeprom clear sketch in the arduino id to reset my node and I should have used the eeprom clear config sketch in the mySensors examples within the mySensors arduino library to clear the eeprom. I couldn't get it to auto assign a node ID so I just hard coded one using:

      gw.begin(NULL,3);
    

    Then I updated my item to use that node id and voila:

    2016-07-17 17:49:17.721 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveUpdate(Temperature,20) is called!
    2016-07-17 17:49:17.723 [DEBUG] [.b.m.internal.MySensorsBinding] - Temperature = 20
    

    It's a good day!


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 5
  • 8

41
Online

11.4k
Users

11.1k
Topics

112.6k
Posts