openHAB 2.0 binding


  • Hero Member

    @undee I'm not able to find a hint, that it is already implemented in OH2, do you have more information for me?

    Defining:

    Switch light01  "light01"       { autoupdate=false, channel="mysensors:light:gateway:light01:status" }
    

    Returns:

    [.e.s.m.i.i.GenericItemProvider:385  ] - Couldn't find ItemFactory for item 'channel' of type 'false'
    

    Does not look like OH2 already knows what it means.



  • @TimO The MQTT binding might be helpful. It is possible to implement the following behaviour with MQTT when autoupdate is set to false:

    When you touch a switch, the defined message is published to an MQTT topic, but the button status remains unchanged. Then, for example, the device processes the message and publishes a status message which then causes the update to the visible status of the button.

    The same can be implemented with shutters. When you push the button to move the shutters up, with autoupdate=true the icon is immediately set to reflect 0%. With autoupdate=false, you can show the current position by updating the position while it is in motion.

    I can't do this with the MySensors binding yet because pushing a button always updates the status automatically.



  • @TimO
    πŸ‘‘ you deserve that one πŸ™‚
    All working fine, no trouble
    Very clean OH2 log file
    Happy man i am!
    Thanks again for time, effort and availability
    Please let me know if i can help in any way

    pi@raspberrypi:/usr/share/openhab2 $ ./start.sh
    Launching the openHAB runtime...
    
                              __  _____    ____      
      ____  ____  ___  ____  / / / /   |  / __ )     
     / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  | 
    / /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /      
    \____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/     
        /_/                        2.0.0-SNAPSHOT
                                   Build #609   
    
    Hit '<tab>' for a list of available commands
    and '[cmd] --help' for help on a specific command.
    Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
    
    openhab> log:set DEBUG org.openhab.binding.mysensors
    openhab> log:tail
    21:42:00.387 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTING - org.openhab.binding.mysensors
    21:42:00.403 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTED - org.openhab.binding.mysensors
    21:42:00.523 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=org.openhab.binding.mysensors.internal.factory.MySensorsHandlerFactory, component.id=0, service.id=106, service.bundleid=10, service.scope=bundle} - org.openhab.binding.mysensors
    21:42:14.666 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.things'
    21:42:14.994 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:bridge-eth:gateway' has been added.                                                                                   
    21:42:15.002 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:humidity:gateway:bathHum01' has been added.                                                                           
    21:42:15.006 [INFO ] [smarthome.event.ThingAddedEvent     ] - Thing 'mysensors:temperature:gateway:bathTemp01' has been added.                                                                       
    21:42:15.433 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=230, service.bundleid=10, service.scope=singleton} - org.openhab.binding.mysensors
    21:42:15.451 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:bridge-eth:gateway' changed from UNINITIALIZED to INITIALIZING
    21:42:15.453 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    21:42:15.464 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:humidity:gateway:bathHum01' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
    21:42:15.474 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:temperature:gateway:bathTemp01' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)                         
    21:42:15.507 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Set skip check on startup to: false
    21:42:15.508 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Enabling connection watchdog
    21:42:15.517 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [127.0.0.1:5003]
    21:42:15.532 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.
    21:42:15.534 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [1]
    21:42:15.540 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
    21:42:15.541 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;14;Gateway startup complete.
    21:42:15.548 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;14;Gateway startup complete.
    21:42:15.552 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item 'mysensors_humidity_gateway_bathHum01_hum' has been added.
    21:42:15.554 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;0;0;18;2.0.1-beta
    21:42:15.556 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'mysensors_humidity_gateway_bathHum01_hum-mysensors:humidity:gateway:bathHum01:hum' has been added.
    21:42:15.555 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;0;0;18;2.0.1-beta
    21:42:15.559 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item 'mysensors_humidity_gateway_bathHum01_lastupdate' has been added.
    21:42:15.562 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'mysensors_humidity_gateway_bathHum01_lastupdate-mysensors:humidity:gateway:bathHum01:lastupdate' has been added.                 
    21:42:15.565 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item 'mysensors_temperature_gateway_bathTemp01_lastupdate' has been added.                                                             
    21:42:15.569 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'mysensors_temperature_gateway_bathTemp01_lastupdate-mysensors:temperature:gateway:bathTemp01:lastupdate' has been added.         
    21:42:15.571 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item 'mysensors_temperature_gateway_bathTemp01_temp' has been added.                                                                   
    21:42:15.573 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'mysensors_temperature_gateway_bathTemp01_temp-mysensors:temperature:gateway:bathTemp01:temp' has been added.                     
    21:42:15.729 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    21:42:15.743 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.0.1-beta
    21:42:15.744 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Good,Gateway is up and running! (Ver:2.0.1-beta)
    21:42:15.745 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.0.1-beta
    21:42:15.749 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:bridge-eth:gateway' changed from INITIALIZING to ONLINE
    21:42:15.759 [INFO ] [al.protocol.ip.MySensorsIpConnection] - Successfully connected to MySensors Bridge.
    21:42:15.761 [WARN ] [al.protocol.ip.MySensorsIpConnection] - Network Sanity Checker thread disabled from bridge configuration
    21:42:15.788 [DEBUG] [ternal.handler.MySensorsThingHandler] - Configuration: node 1, chiledId: 1, revertState: false
    21:42:15.789 [DEBUG] [ternal.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering...
    21:42:15.789 [DEBUG] [ternal.handler.MySensorsThingHandler] - Configuration: node 1, chiledId: 0, revertState: false
    21:42:15.790 [DEBUG] [ternal.handler.MySensorsThingHandler] - Event listener for node 1-0 not registered yet, registering...
    21:42:15.794 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:temperature:gateway:bathTemp01' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
    21:42:15.796 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:humidity:gateway:bathHum01' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
    21:42:15.797 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:temperature:gateway:bathTemp01' changed from INITIALIZING to ONLINE
    21:42:15.799 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:humidity:gateway:bathHum01' changed from INITIALIZING to ONLINE
    21:42:17.115 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
    21:42:17.453 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
    21:42:17.949 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
    21:42:18.125 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
    21:42:25.762 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:42:35.763 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:42:45.765 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:42:55.766 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:05.768 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:13.988 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;0;1;0;1;62.5
    21:43:14.005 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 1 to 2016-11-23T21:43:13.995+0000
    21:43:14.010 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 1 to 2016-11-23T21:43:14.006+0000
    21:43:14.016 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;0;1;0;1;62.5
    21:43:14.022 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_temperature_gateway_bathTemp01_lastupdate changed from NULL to 2016-11-23T21:43:13.995+0000
    21:43:14.037 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_humidity_gateway_bathHum01_lastupdate changed from NULL to 2016-11-23T21:43:14.006+0000
    21:43:14.040 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_humidity_gateway_bathHum01_hum changed from NULL to 62.5
    21:43:15.769 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:25.771 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:35.772 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:45.775 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:43:55.778 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:05.779 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:15.780 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:20.330 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;1;1;0;0;18.9
    21:44:20.340 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 1 to 2016-11-23T21:44:20.333+0000
    21:44:20.348 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 1 to 2016-11-23T21:44:20.342+0000
    21:44:20.349 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;1;1;0;0;18.9
    21:44:20.352 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;0;1;0;1;62.0
    21:44:20.362 [DEBUG] [rs.internal.protocol.MySensorsReader] - 1;0;1;0;1;62.0
    21:44:20.364 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_temperature_gateway_bathTemp01_lastupdate changed from 2016-11-23T21:43:13.995+0000 to 2016-11-23T21:44:20.333+0000
    21:44:20.370 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_temperature_gateway_bathTemp01_temp changed from NULL to 18.9
    21:44:20.381 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_humidity_gateway_bathHum01_lastupdate changed from 2016-11-23T21:43:14.006+0000 to 2016-11-23T21:44:20.342+0000
    21:44:20.387 [INFO ] [marthome.event.ItemStateChangedEvent] - mysensors_humidity_gateway_bathHum01_hum changed from 62.5 to 62.0
    21:44:25.783 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:35.785 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:45.786 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:44:55.788 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:45:05.789 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    21:45:15.792 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Bridge is connected, connection skipped
    

  • Hero Member

    @ben999 Thank you for your kind words and for your patience! πŸ™‚

    I'm glad it is working now. As it is quiet for a day now, I suppose the problem is solved.



  • @TimO thanks to you. My Sensor seems working right since a week. πŸ™‚

    But I have noticed a beahaviour that I think it's anomal.
    I have a Door Sensor, their lastupdate attribute upate their value almost each 10 minuts approximately. I think it should be updated when the state of the tripped value changes, or not?

    Also, if the tripped value change quickly, the lastupdate attribute not change.

    I'm triying that the lastupdate value is the last time the door was open or close, but I don't find the way to do that. Is this a bug? I have reviewed my skecht and I don't see any posible error in it.

    Thanks in advance


  • Hero Member

    @Jic Do you have a corresponding log for me?

    My last update value only updates if a update is received. If I don't get an update for hours the last update variable won't change.

    Maybe you receive a not tripped from the motion sensor? That will update the last update variable.



  • @TimO right now, I have only one Door sensor.
    my logs are

    2016-12-01 23:02:43.047 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    2016-12-01 23:02:53.049 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    2016-12-01 23:02:53.909 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;1;1;0;16;1
    2016-12-01 23:02:53.923 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 10 to 2016-12-01T23:02:53.913+0100
    2016-12-01 23:02:53.990 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;22;100788
    2016-12-01 23:03:03.051 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    2016-12-01 23:03:13.053 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    2016-12-01 23:07:03.111 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    2016-12-01 23:07:05.190 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:07:05.203 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 10 to 2016-12-01T23:07:05.193+0100
    
    ==> events.log <==
    2016-12-01 23:07:05.229 [ItemStateChangedEvent     ] - mysensors_door_gateway_Door_10_1_lastupdate changed from 2016-12-01T23:02:53.913+0100 to 2016-12-01T23:07:05.193+0100
    2016-12-01 23:07:05.264 [ItemStateChangedEvent     ] - Cancela01time changed from 2016-12-01T23:02:53.913+0100 to 2016-12-01T23:07:05.193+0100
    

    You can see last event is at 23:07, however in the following snapshot the time is 11:17

    0_1480631760477_SelecciΓ³n_004.png

    No more events, but the lastupdate change



  • @TimO ok, I have discovered that my "tail" command doesn't work rigth, sorry

    My logs are

    2016-12-01 23:02:53.990 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;22;100788
    2016-12-01 23:07:05.190 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:17:05.248 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:27:05.326 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:37:05.409 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:47:05.486 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-01 23:57:05.562 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    2016-12-02 00:07:05.639 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;255;3;0;21;0
    

    I don't understand why am I reciving this message?


  • Hero Member

    @Jic According to the serial API this is a I_DISCOVER_RESPONSE, but why is it sent? This seeems to update the lastUpdate channel.

    I see it this way: "lastUpdate" is the last time the node has sent something, so everything is working as expected. πŸ˜„



  • @TimO

    Thanks. I don't know why is it sending a I_DISCOVER_RESPONSE message. Any Idea?


  • Hero Member

    @Jic No sorry, I've no idea. πŸ˜•



  • @TimO said:

    @bentrik said:

    I managed to find an addons directory in /usr/share/openhab2/addons, but I canΒ΄t find a way to copy the .jar file there, as I get permission denied both through WinSCP in sudo mode and terminal ssh. The folder has permission 0775.

    That is the correct directory if you installed OH2 via .deb. Seems like you are using a user in WinSCP that is not allowed to write to the directory above. To circumvent this:

    1. Copy the binding jar to /tmp.
    2. Login via ssh and execute:
    sudo cp /tmp/org.openhab.binding.mysensors-2.0.0-SNAPSHOT.jar /usr/share/openhab2/addons/
    

    and

    sudo chmod openhab.openhab /usr/share/openhab2/addons/org.openhab.binding.mysensors-2.0.0-SNAPSHOT.jar
    

    OH2 is started/stopped/restarted with

    service openhab2 start/stop/restart
    

    To log into the karaf console do:

    ssh openhab@localhost -p 8101
    

    Password is: habopen

    Follow the guide/wiki from:

    In the console enter feature:install openhab-transport-serial
    

    I have installed openhab with the openhabian image. I could start the mysensors gateway too.
    I followed the github-openhab2 installation instructions.
    To this point

    In the console enter feature:install openhab-transport-serial
    

    I read a lot of posts on this thread but on get this error:

    openhab> install openhab-transport-serial
    Bundle IDs:
    Error executing command: Error installing bundles:
    	Unable to install bundle openhab-transport-serial
    

    the chmod line posted above doesn't work neither. chmod does not accept openhab.openhab

    I dont have any clue how to install the binding for openhab2 ... why isn't that possible from paperui 😞



  • I have install the addon and am getting the error:

    17:49:40.745 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [null:1883]
    17:49:40.745 [ERROR] [al.protocol.ip.MySensorsIpConnection] - IP must be not null/empty
    17:49:40.752 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:46)
    17:49:40.753 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Disconnecting from IP bridge ...
    

    MySensors does not show up as a binding in HabMin or PaperUI.

    Where do I configure the MySensors binding if it doesn't show up in the UI?



  • @tademet
    as stated in the configuration wiki https://github.com/tobof/openhab2-addons/wiki/Configuration you have to define the bridge in your thing-configuration, depending on the type of your gateway serial or ethernet.



  • @jogant
    I have added the config to the thing file.

    Bridge mysensors:bridge-eth:gateway [ ipAddress:"10.9.167.116", tcpPort=5003, sendDelay=200, imperial=true] {
    
    }
    

    But still getting the error:

    08:10:25.214 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [null:5003]
    08:10:25.215 [ERROR] [al.protocol.ip.MySensorsIpConnection] - IP must be not null/empty
    08:10:25.216 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:3)
    08:10:25.217 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Disconnecting from IP bridge ...
    
    

    I changed the port and it recognized that change but is not recognizing ipAddress. Am I misspelling this?


  • Hero Member

    @tademet there's a ":" instead of a "=" between ipAddress and the IP adress.



  • Just stumbled across this binding great work!
    Until now I have used MQTT binding and MQTT gateway.
    Will try this later on.
    However, is there a reason why this binding is not part as downloadable from within OH2?
    Cheers πŸ™‚


  • Hero Member

    Hey @Nicklas-Starkel !
    I hope it will work out for you! πŸ™‚

    It is not yet part of OH2 and downloadable within OH2 because my pull request is still open. A OH2 developer needs to look at it. πŸ™‚



  • @TimO

    I've downloaded your code from github for this binding and tried to modify it a bit for my specific needs. However I'm having trouble compiling it. I've then gone back to basics and added in your unedited code to Eclipse. However it complains about:

    @Override
    public void bridgeHandlerDisposed(ThingHandler thingHandler, Bridge bridge)

    Saying : The method bridgeHandlerDisposed(Thinghandler,Bridge) of type MySensorsHandler must override or implement a supertype method.

    Do you have any advice for me on this? πŸ™‚

    Thanks for your work on this!




  • Hero Member

    Hey @infrag !

    Switch to the MySensors branch, the master branch is outdated. πŸ™‚



  • @TimO

    ah that explains it. Thanks! πŸ™‚



  • @TimO
    I'm trying to add a CO2 sensor. What is the sensor i need to select inside OpenHAB?

    TSP:MSG:SEND 70-70-0-0 s=0,c=1,t=37,pt=4,l=4,sg=0,ft=0,st=ok:1162
    CO2 level = 1162 ppm

    sketch:
    MyMessage msg(CHILD_ID_AIQ, V_LEVEL);
    present(CHILD_ID_AIQ, S_AIR_QUALITY);



  • Hello everyone,
    In an OH2 environment with 2 nodes reporting temperature, one attached to the gateway and one on his own I receive the following error:
    [ERROR] [rs.internal.protocol.MySensorsReader] - (java.lang.IllegalStateException: Could not update state, because callback is missing) on reading from connection, message: class org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialReader

    The node attached to the gateway works fine, his item gets updated but the other one not.
    The only code difference between their loop methods are calls to isTransportOK() and receiveTime() which are made by the latter node.
    Doesn't this version support those 2 methods or I'm missing something ?
    https://github.com/tobof/openhab2-addons/blob/MySensors/addons/binding/org.openhab.binding.mysensors/target/org.openhab.binding.mysensors-2.0.0-SNAPSHOT.jar

    Thx for all the hard work on this library πŸ˜ƒ


  • Hero Member

    Hey @frg !

    1. receiveTime() is supported by the binding and should work. In the binding log should appear a message like:
    I_TIME request received from 123, answering...
    

    Do you have some more log for me?

    1. isTransportOK() is only handled within the node, no message is send so there is nothing the binding could support. By the way, the method was renamed to isTransportReady() with the current version 2.1.0.

    Are there no updates from the second node? Did you check in the serial log of the node that messages were sent?



  • @TimO
    Hello,
    Well this is bit of embarrassing...after changing the sleep time from 5 minutes to 1 minute for the troublesome node and re-uploading the sketch, it is reporting the temperature just fine. I tried all kinds of combinations trying to replicate the initial behavior, stopped the controller, rebooted the gateway, powered them off for while, moving back to 5 minutes sleep, to no avail, node registers and the temperature is reporting is showed in the paperui.

    On the other hand I don't see that I_TIME request received from... message in the logs (used log:set DEBUG org.openhab.binding.mysensors and log:tail) so I'm not sure if the receiveTime() is called.
    I suppose I can write something in the EEPROM when the callback function runs and check that.
    Thank you

    01:30:45.291 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:30:50.280 [DEBUG] [rs.internal.protocol.MySensorsReader] - 2;0;1;0;0;22.0
    01:30:50.282 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 2 to 2017-01-06T01:30:50.281+0200
    01:30:50.285 [INFO ] [marthome.event.ItemStateChangedEvent] - TemperatureOutside_LastUpdate changed from 2017-01-06T01:28:52.282+0200 to 2017-01-06T01:30:50.281+0200
    01:30:53.550 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;1;1;0;0;23.1
    01:30:55.292 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:05.293 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:15.293 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:25.294 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:35.294 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:45.295 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:31:49.287 [DEBUG] [rs.internal.protocol.MySensorsReader] - 2;0;1;0;0;22.0
    01:31:53.541 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;1;1;0;0;23.1
    01:31:53.544 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 0 to 2017-01-06T01:31:53.543+0200
    01:31:53.552 [INFO ] [marthome.event.ItemStateChangedEvent] - TemperatureGateway_LastUpdate changed from 2017-01-06T01:29:53.559+0200 to 2017-01-06T01:31:53.543+0200
    01:31:55.295 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:05.296 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:15.296 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:25.297 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:35.298 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:45.298 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    01:32:48.283 [DEBUG] [rs.internal.protocol.MySensorsReader] - 2;0;1;0;0;22.0
    01:32:48.284 [DEBUG] [ternal.handler.MySensorsThingHandler] - Setting last update for node 2 to 2017-01-06T01:32:48.284+0200
    01:32:48.290 [INFO ] [marthome.event.ItemStateChangedEvent] - TemperatureOutside_LastUpdate changed from 2017-01-06T01:30:50.281+0200 to 2017-01-06T01:32:48.284+0200
    01:32:53.532 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;1;1;0;0;23.1
    01:32:55.299 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    
    

    Node 0 is gateway attached, Node 2 is battery run -TemperatureOutside.


  • Hero Member

    @frg Sometimes magic just happens. πŸ˜‰
    I'm glad it is working now! πŸ‘



  • I try to send ORP calibration value to my sensors but it doesn't work.
    NODE_ID : 10, CHILD_NODE_ID : 0
    When I'm recieve ORP from my sensors it's ok :

    13:55:38.216 [DEBUG] [rs.internal.protocol.MySensorsReader] - 10;0;1;0;52;996.3
    

    But when I change the value, the value is not send :

    14:09:24.051 [INFO ] [marthome.event.ItemStateChangedEvent] - orp01 changed from 40 to 50
    14:09:24.266 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'orp01' received command 60
    14:09:24.266 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 10;0;1;0;0;
    

    Item :

    Number	orp01	"Redox [%.1f mV]" <faucet> (gPiscine) { channel="mysensors:waterQuality:gateway:orp01:orp"}
    

    Sitemap :

      sitemap test label="Main Menu" { 
        Frame label="Piscine" { 
    		Setpoint item=orp01 label="Calirabte ORP" minValue=0 maxValue=1000 step=10
        } 
      }
    

  • Hero Member

    @Fabien I need a little bit more time to reproduce this behaviour. I've opened an issue here: https://github.com/tobof/openhab2-addons/issues/50



  • Hello everyone
    I'm slowly migrating to OH2, my small MySensors network generally works fine but I see some weird behavior with the binding configuration in Paper UI.
    So far it looks like "Disable network sanity check" is reversed - I'm sliding it to the left which means for me 'not disabled', i.e. 'enabled', but in the log I see "Checker thread disabled".

    2017-01-11 16:50:38.405 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;14;Gateway startup complete.
    2017-01-11 16:50:38.408 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;0;0;18;2.1.0
    2017-01-11 16:50:38.503 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    2017-01-11 16:50:38.511 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.1.0
    2017-01-11 16:50:38.512 [DEBUG] [col.serial.MySensorsSerialConnection] - Good,Gateway is up and running! (Ver:2.1.0)
    2017-01-11 16:50:38.514 [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.
    2017-01-11 16:50:38.515 [WARN ] [col.serial.MySensorsSerialConnection] - Network Sanity Checker thread disabled from bridge configuration
    2017-01-11 16:50:48.516 [DEBUG] [col.serial.MySensorsSerialConnection] - Bridge is connected, connection skipped
    
    

    Is that ok?


  • Hero Member

    @AndrewZ Don't worry about that message, the debug log looks good. The warning is confusing and we need to change that. πŸ™‚



  • @TimO Thanks, will keep it off in the GUI.



  • Hi @TimO

    I've logged a job to include documentation about non-native OpenHAB 2.0 bindings in the official OH2 docs.

    ThomDeitrich is looking to know why it's not yet in the official distro. Can provide some info?

    https://github.com/openhab/openhab-docs/issues/188


  • Hero Member

    Hey @Duncan-Pullen !

    The main reason is: I'm waiting for suggestions / approval from the OH2 developers. πŸ™‚

    The MySensors binding has grown big and a review takes some time.


  • Admin

    @TimO, thank you for all the effort you've put into this!



  • Hi everyone,
    @TimO, thanks for everything you did here!

    I just made the 2.0 version (code in comments of respective post) of petewill's Simple Scene Controller and discovered that a Scene Controller is not yet implemented in the OpenHAB binding. Is there a possibility that it will be implemented in the future?
    For now, is it possible to get this working with CustomSensor or Text?


  • Hero Member

    Hi @FusedHe3 !

    My first thought was: that's easy, lets add this! But after a second thought ...

    I see one problem with S_SCENE_CONTROLLER: how do I map this in OpenHAB?

    In MySensors there is V_SCENE_ON and V_SCENE_OFF. The message contains the corresponding scene number.

    In OpenHAB I've: Number, Switch, Selection ...

    0_1484735515591_upload-dac7eae9-cec0-4cbd-95ec-a0428268441c

    In OpenHAB I may choose between Scene A, Scene B and so on, but I can't select between ON and OFF. Is Scene A switched off, when I select Scene B?

    I'm using scenes with a switch in OpenHAB. Something like "Christmas decoration ON". In OpenHAB I'm using a group for that gChristmasDecoration or a rule: switch light on, shutter to 33%, ..

    My approach in implementing a (hardware) scene controller would be a mapping of those switches. So I would define a switch / child for every button (scene) on the controller.

    I'm open for ideas on how to map V_SCENE_CONTROLLER in OpenHAB, so if you or someone else have and idea, shout it out. πŸ˜„


  • Hero Member

    Ah, by the way, I forgot to mention: SmartSleep is supported since last week.

    0_1484736645455_upload-d9d8432b-4892-4c07-876a-3abd4def86a0



  • @TimO Thanks for the quick reply!
    I do think the ON/OFF switch for every scene would be the most logical solution. In that way it's fully compatibel with the MySensors Scene Controller and you can have multiple scenes active at the same time.



  • Just updated my OH2 installation from snapshot to RC/beta and immediately got an error with the binding:

    [ERROR] [rs.internal.protocol.MySensorsReader] - (java.lang.NumberFormatException: For input string: "Gateway startup complete.") on reading from connection, message: class org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialReader
    

    But then the usual:

    [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.
    [WARN ] [col.serial.MySensorsSerialConnection] - Network Sanity Checker thread disabled from bridge configuration
    

    What could be a problem? Do I need to perform some cleanup on my system? What exactly needs to be deleted?



  • I ran into trouble today by apt-get updating Openhab.

    I am over redefining the Distro for Snapshot... I have 2.0.0-SNAPSHOT, Build #743 up and running.

    my bundle list looks following:
    204 | Active | 80 | 3.12.0.OH | nrjavaserial
    205 | Installed | 80 | 2.0.0.201611221149 | MySensors Binding

    Still getting these errors:
    "03:17:10.911 [ERROR] [org.openhab.binding.mysensors ] - FrameworkEvent ERROR - org.openhab.binding.mysensors
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [205]
    Unresolved requirement: Require-Bundle: org.openhab.io.transport.serial"

    Any idea for next step?


  • Hero Member

    @krejcarek please upgrade the binding to the most recent version. πŸ™‚



  • @TimO what about my error? I'm on the latest version already.


  • Hero Member

    @AndrewZ Sorry! Is it working despite the error? I need to test with RC1 myself. The error looks like it could be ignored. From time to time messages get corrupted, due to connection issues and the parser stumbles about that. But it should continue to work just fine. I suppose this is the case here, but I'll check!



  • @TimO yes, it is working, but please check this one and 2nd (Network Sanity Checker thread disabled). Thank you!



  • I had the same error messages on first boot of OH. After finishing upgrade procedure and restarting OH once again error message is gone. New version of the binding is working well. No hickups at the moment.



  • Hi Guys
    I am currently playing with a fairly fresh install of openhab2 (last weekend)
    I have played with the auto-discovery function in PaperUI
    Wow that's amazing πŸ™‚
    But i am having trouble when it comes to sitemap file : sitemap function is not included within PaperUI (as far as i know) and i need this file to configure properly my iOS app
    So i have to go back to the old fashionned way and edit thing, item and map files with a text editor (which is fine)

    Two questions from here:

    • please prove me wrong in the way that i can discover things and configure items within paperUI and still create a valid sitemap file usable by my iOS devices
    • if above not possible, is there a way to "flush" openhab things and items database as i am getting warnings about things that don't exist anymore (things previously discovered by paperUI but deleted since)
      Thanks a lot for reading


  • I must be missing something. I have the same error as well. Is there a link to the latest binding. The one on the instructions page is dated 20161122 and a second one refereed to in this topic above dated 20161222. Which binding should I be using



  • @TimO, Thanks for the quick response. Probably was some stupid mistake with copying.jar file. Got mine now on 2.0.0.201701181308, and works like charm.
    Hoping to have mysensors soon as official binding to avoid the need of workarounds and thus prone to mistakes.


  • Hero Member

    @hillmanr please try this link: Download


  • Hero Member

    @ben999

    1. It is possible to discover things with PaperUI and afterwards insert them in an item and sitemap file. Just use the channel that was given due to recovery. This way you don't need the things file.

    2. You may delete the hole database or edit it with a text editor as it is a jsondb file. I'm on my phone, so I can't give you the correct location right now.

    Did you try habmin? I've seen some amazing screenshots but haven't tried it myself.



  • Got the 2.0.0.201701181308 binding, works, thanks. Amazing effort on the binding, great job.



  • @TimO
    Thanks a lot Tim
    Found a few interresting files in /usr/share/openhab2/userdata/jsondb (one containing history of discovery)
    Got rid of them all then rebooted but no change: my log is still polluted with that kind of entries:

    05:33:19.658 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate update '3' for item 'salonBatt01' to handler for channel 'mysensors:temperature:gateway:Temperature_1_0:battery', because no thing with the UID 'mysensors:temperature:gateway:Temperature_1_0' could be found.
    05:33:19.660 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate update '3' for item 'salonBatt01' to handler for channel 'mysensors:humidity:gateway:salonBatt01:battery', because no thing with the UID 'mysensors:humidity:gateway:salonBatt01' could be found.
    

    There also was a backup directory in there... deleted but no change
    Another location?

    EDIT : files in that directory are back after a reboot πŸ˜„ (meaning that the files themselves are back, and the one containing discovery data still contains it !!!)

    Thanks a lot for your help buddies



  • This binding works fine with 2.1.1 sensors actually Temp/Hum, Ph/ORP, RollerShutters. thanks for your work on this binding @TimO !
    Is this binding work with firmware update : http://docs.openhab.org/administration/runtime.html ?


  • Hero Member

    @Fabien Thank you for your feedback!
    And: I've waited for that question according firmware updates to come up. πŸ˜„

    I've looked into it and I'm very interested but till now there is only the implementation in the library, I've not seen an implementation in a binding. I'll continue to look at it, but with low priority. πŸ™‚

    Current priority list is:

    1. Include binding in OH2 repository.
    2. Test and include the big refactoring from @andreacioni .
    3. Add MQTT gateway (proof of concept working, full integration after refactoring).
    4. Add little feature requests, add sensors ...


  • This is so great. I am fairly new to openhab 2. I have it up and running on a RP3. No issues during the install. I was able to get Habmin and paperhab up and running. I installed a few add-ons that were part of the img on openhab.com. However, i cant figure out how to add mysensors.org add-on. I am using OSX and I can't figure out where to place the file in openhab2 on the raspberry pi. Please help!!!!


  • Hero Member

    The jar needs to be placed here:

    /usr/share/openhab2/addons/

    You'll find further instructions here:

    https://github.com/tobof/openhab2-addons/wiki/Installation



  • I was able to successfully install the binding, but when I added a temperature sensor as a test, it keeps failing. This is the error message I'm getting:

    17:01:28.130 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occured while initializing handler of thing 'mysensors:temperature:4c0b17b9': java.lang.NullPointerException
    java.util.concurrent.ExecutionException: java.lang.NullPointerException
            at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_121]
            at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_121]
            at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:188)[98:org.eclipse.smarthome.core:0.9.0.b4]
            at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:81)[98:org.eclipse.smarthome.core:0.9.0.b4]
            at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:65)[98:org.eclipse.smarthome.core:0.9.0.b4]
            at org.eclipse.smarthome.core.thing.internal.ThingManager$9.run(ThingManager.java:710)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
            at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
    Caused by: java.lang.NullPointerException
            at org.openhab.binding.mysensors.internal.handler.MySensorsThingHandler.getBridgeHandler(MySensorsThingHandler.java:268)[193:org.openhab.binding.mysensors:2.0.0.201701181308]
            at org.openhab.binding.mysensors.internal.handler.MySensorsThingHandler.initialize(MySensorsThingHandler.java:77)[193:org.openhab.binding.mysensors:2.0.0.201701181308]
            at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:713)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
            at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:1)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
            at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:179)[98:org.eclipse.smarthome.core:0.9.0.b4]
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
            ... 3 more
    

    Any thoughts?


  • Hero Member

    @azuntik Did you configure the temperature thing in the things and items file? Please post the contents of these files. Please add the debug log from the time before and after the exception occurs. Which version (snapshot, stable) of OH2 are you running?



  • @TimO I'll be honest with you: I'm not sure I configured everything properly. I don't have things or items files, because I set things up through the PaperUI. Do I need to set everything up through config files?

    I've attached the complete log file. I'm running stable.

    Thanks for your help!

    Edit: Nevermind. I don't have permission to upload a file. So, here's a pastebin: http://pastebin.com/jLeTXbvX (the timestamps are wrong, you can ignore the date).

    Edit2: One thing that I was having trouble with was determining the Node and Child IDs. I finally settled on what I think they are (105 and 255, respectively), but I may be wrong. Any advice with regard to figuring that out would also be greatly appreciated!


  • Mod

    @azuntik You should know what you are creating πŸ˜‰

    In PaperUI you first create a thing for the gateway (I assume that worked for you).
    Next OpenHAB should find all attached things for you, no need to create them manually. Just confirm what OpenHAB found.
    Based on available properties you create an Item.



  • @marceltrapman Frankenstein's Monster? πŸ˜„

    So, the UI is not detecting anything, although testing mysgw shows it receiving data. Is this a misconfiguration on my part?

    Edit: Nevermind. I think what you said just sank in. Thanks for your help!



  • Hi TimO
    Can you please add support for gas meter S_GAS like the water meter.

    Thanks
    Nikos



  • Hello all! I believe I have done my due diligence in solving my own problem, but I am stuck. Can anyone point me in the right direction?

    I am trying to get started with an Ethernet Gateway. The gateway is displayed on the PaperUI, but in the log, it continues to try and connect to the ip bridge (Sending to MySensors: 0;0;3;0;2;)

    I am on:
    openhab 2.1.0-snapshot build #791
    MySensors Binding: 2.0.0.201701181308
    Gateway is using library 2.1.1

    I have tried:
    Clearing the EEPROM on the gateway thinking some garbage got stuck there.
    Set up and successfully used an MQTT gateway, thinking bad hardware?
    Restarted the binding, openhab, kitchen sink countless times.
    Updating everything to the latest build I could find
    Manually creating things

    The only thing that seems odd to me is the gateway repeats over and over what appears to be initialization data (displays ip address, 0;255;3;0;9;MC0;BGN;STP.....). However, it does receive data from a temperature node I built.

    I appreciate any pointers that can be provided, including "have you read this page?", though I think my Google search is permanently stuck on "mysensors openhab" at this point.

    Thanks,

    Dave



  • @nikos1671

    Where do I found the Mysensors Binding 2.0.0.201701181308 jar file for download?
    Or is it mandatory to compile it from source?

    Thanks Kristoffer


  • Hero Member

    @David-Link Are you sure the gateway isn't in a boot loop?


  • Hero Member



  • @TimO That's exactly what is going on. Thank you for the tip, I was pulling my hair out. Now on to solving that problem! Thanks again.



  • Hi @TimO
    I am having trouble but think I might be doing it wrong.
    Is it possible to use this binding with a MQTT gateway?
    I see that it needs to find the gateway on port 5003 but this isn't defined in MQTT gateway.
    Is it possible?


  • Hero Member

    Hi @mlava !
    The MQTT gateway is not supported at the moment. I've done a proof of concept and it will be implemented after the refactoring we're currently working on.



  • @TimO
    Wonderful, thank you for the answer.
    I'll wait eagerly for progress! πŸ˜€



  • @David-Link It looks like you have a similar issue to me re the ethernet gateway. I have also tried "everything" and then yesterday discovered an old bug that might have resurfaced. I just put the following up on github:

    https://github.com/mysensors/MySensors/issues/777

    It might help you..



  • Further to my client ethernet gateway not working with the MySensors 2.1.1 library, I tried 2.0.0 and now go much further. The gateway does not keep restarting, talks to the openhab controller and at least reads the messages and tripped status from my motion sensor

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    IP: 192.168.1.9
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    0;255;3;0;9;TSP:SANCHK:OK```
    

    I had to turn on the skipStartupCheck for the ethernet gateway to come online in openhab (and the gateway serial monitor did show the 0;0;3;0;2; and ethernet messages between openhab and the gateway)

    15:10:13.316 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [192.168.1.9:5003]
    15:10:13.819 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:10:14.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:10:15.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:10:16.320 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:10:17.321 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    15:10:18.321 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Cannot start reading/writing thread, probably sync message (I_VERSION) not received. Try set skipStartupCheck to true
    15:10:18.322 [ERROR] [al.protocol.ip.MySensorsIpConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1)
    15:10:18.322 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Disconnecting from IP bridge ...
    15:10:18.323 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Stopping Writer thread
    15:10:18.324 [DEBUG] [rs.internal.protocol.MySensorsReader] - Stopping Reader thread
    15:10:18.324 [ERROR] [rs.internal.protocol.MySensorsWriter] - (java.lang.InterruptedException) on writing to connection, message: class org.openhab.binding.mysensors.internal.protocol.ip.MySensorsIpWriter
    15:10:18.325 [ERROR] [rs.internal.protocol.MySensorsReader] - (java.lang.InterruptedException: sleep interrupted) on reading from connection, message: class org.openhab.binding.mysensors.internal.protocol.ip.MySensorIpReader
    15:10:25.236 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Disposing of the MySensors bridge
    15:10:25.236 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Destroying connection
    15:10:25.236 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.
    15:10:25.237 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [1]
    15:10:25.237 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: [1]
    15:10:25.239 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    15:10:25.239 [INFO ] [smarthome.event.ThingUpdatedEvent   ] - Thing 'mysensors:bridge-eth:cb1d6dd1' has been updated.
    15:10:25.240 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Set skip check on startup to: true
    15:10:25.240 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Enabling connection watchdog
    15:10:25.240 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.
    15:10:25.241 [DEBUG] [al.protocol.ip.MySensorsIpConnection] - Connecting to IP bridge [192.168.1.9:5003]
    15:10:25.241 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: [1]
    15:10:25.241 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
    15:10:25.244 [WARN ] [al.protocol.ip.MySensorsIpConnection] - Skipping I_VERSION connection test, not recommended...
    15:10:25.244 [INFO ] [al.protocol.ip.MySensorsIpConnection] - Successfully connected to MySensors Bridge.
    

    I then got my motion sensor to come online in openhab

    15:13:24.300 [DEBUG] [ternal.handler.MySensorsThingHandler] - Configuration: nodeId 1, chiledId: 1, requestAck: false, revertState: false, smartSleep: false
    15:13:24.301 [DEBUG] [ternal.handler.MySensorsThingHandler] - Event listener for node 1-1 not registered yet, registering...
    15:13:24.305 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'mysensors:motion:24559d07' changed from INITIALIZING to ONLINE```
    

    However the motion sensor (via gateway) and openhab controller are not talking to each other. Does skipping the startup check result in problems?

    Any ideas on how to progress with MySensors 2.0.0 library or do I need to wait for a fix to 2.1.1?

    Many Thanks...



  • @Andrew-Currie I think that is the same thing I am dealing with. I will take a look, thank you!

    I "cheated" and just hooked it up to my Pi that is running OpenHab and it works like a charm.


  • Hero Member

    @Andrew-Currie It should make no difference for the binding if you're using 2.0.0 or 2.1.1. I can't see any incoming messages in the debug log you've posted. If the gateway is properly connected you should see messages incoming, for example from your motion sensor. Could you please establish a telnet connection to the gateway at port 5003 and post the output? In parallel check the serial output of the gateway, there you should see the establishment of the telnet connection for example.



  • @TimO Thanks Tim for your feedback. Here is the log from the gateway. It receives messages from openhab re the ethernet connection and also from the motion sensor and gets a fail from one send

    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    IP: 192.168.1.9
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: disconnect
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;Eth: connect
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: 0;0;3;0;2;
    0;255;3;0;9;Eth: 
    0;255;3;0;9;Eth: disconnect
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:SANCHK:OK
    0;255;3;0;9;TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=1)
    0;255;3;0;9;TSP:CHKUPL:OK
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSP:MSG:PINGED (ID=1, hops=1)
    0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=ok:1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=fail:0100
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=11,pt=0,l=13,sg=0:Motion Sensor
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=0,t=1,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;TSP:MSG:SEND 0-0-1-1 s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=ok:1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:1
    0;255;3;0;9;TSP:MSG:READ 1-1-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    0;255;3;0;9;TSP:SANCHK:OK
    

    The telnet connection shows no action and the gateway device is on the local network

    $ telnet 192.168.1.9 5003
    Trying 192.168.1.9...
    Connected to 192.168.1.9.
    Escape character is '^]'.
    
    $ arp -a
    HPB482AF (192.168.1.2) at 28:92:4a:c0:c3:27 [ether] on wlan0
    WIZnet9FFEED (192.168.1.9) at de:ad:b1:9f:fe:ed [ether] on wlan0
    NB604N.Home (192.168.1.1) at 00:60:64:83:50:8b [ether] on wlan0
    HF-LPB100 (192.168.1.12) at f0:fe:6b:16:a1:4a [ether] on wlan0
    

    I have tried all sorts of ubuntu firewall settings to allow access to and from 192.168.1.9 port 5003 and also looked into the router settings with no joy.

    As another approach I tried the serial gateway and investigated the linux settings given in
    http://docs.openhab.org/installation/linux.html#privileges-for-common-peripherals

    The furthest I got with the serial gateway was as follows, first the debug log at startup and then when creating the gateway thing in the paper ui

    10:07:04.218 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={component.name=org.openhab.binding.mysensors.internal.factory.MySensorsHandlerFactory, component.id=197, service.id=340, service.bundleid=250, service.scope=bundle} - org.openhab.binding.mysensors
    10:07:04.219 [DEBUG] [org.openhab.binding.mysensors       ] - BundleEvent STARTED – org.openhab.binding.mysensors
    10:08:52.520 [DEBUG] [org.openhab.binding.mysensors       ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=341, service.bundleid=250, service.scope=singleton} – org.openhab.binding.mysensors
    
    10:08:52.524 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge
    10:08:52.526 [DEBUG] [col.serial.MySensorsSerialConnection] - Set skip check on startup to: false
    10:08:52.526 [DEBUG] [col.serial.MySensorsSerialConnection] - Enabling connection watchdog
    10:08:52.527 [DEBUG] [col.serial.MySensorsSerialConnection] - Connecting to ttyUSB1 [baudRate:115200]
    10:08:52.530 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache file: given_ids.cached exist.
    10:08:52.531 [DEBUG] [ternal.factory.MySensorsCacheFactory] - Cache (given_ids) content: []
    10:08:52.532 [DEBUG] [ernal.handler.MySensorsBridgeHandler] - Initialization of the MySensors bridge DONE!
    
    testRead() open failed: /dev/ttyUSB1
    
    localClose: File Descriptor error, not closing
    
    testRead() open failed: /dev/ttyUSB1
    
    localClose: File Descriptor error, not closing
    
    testRead() open failed: /dev/ttyUSB1
    
    localClose: File Descriptor error, not closing
    10:08:52.545 [DEBUG] [col.serial.MySensorsSerialConnection] - Final port list: ttyUSB1:/dev/ttyUSB1
    
    testRead() open failed: ttyUSB1
    
    localClose: File Descriptor error, not closing
    Failed to connect on port: ttyUSB1 exception: 
    gnu.io.NoSuchPortException
    

    While my plan was to test on my ubuntu 16.04 laptop, I have gone ahead and ordered a Raspberry pi 3 and intend to install the openhabianpi img file. Hopefully better progress there...



  • Hey guys, first message on this forum. Been reading alot before. But now I have a problem I just can't solve.
    It's about smartsleep with openhab 2.
    Im using wifi gw rfm 69.
    Regular messages works as it should both ways.
    But it almost seems like the smartsleep isn't enabled in the binding.
    Here are my configs and logs.

    Things file:

    Bridge mysensors:bridge-eth:gw69 [ ipAddress="192.168.1.235", tcpPort=5003, sendDelay=100, enableNetworkSanCheck=true ] {
    //  Anarduino
        humidity        AnHum   [ nodeId="66", childId="0" ]
        temperature     AnTemp  [ nodeId="66", childId="1" ]
        light           light02 [ nodeId="66", childId="3", smartSleep=true ]
      }
    

    Items file:

    Switch  TestLight   "Test lampa" (Test) { channel="mysensors:light:gw69:light02:status" }
    

    Sketch: (Cleaned up the parts that dont matter, RTC and so on.)

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69
    #define MY_IS_RFM69HW
    #define MY_NODE_ID 66
    #define MY_RFM69_NETWORKID 100
    #define MY_RFM69_FREQUENCY RF69_433MHZ
    #define MY_SMART_SLEEP_WAIT_DURATION_MS 1000
    #include <MySensors.h>
    #include <TimeLib.h>
    #include <Wire.h>
    #include <MCP7940RTC.h>
    #include <DHT.h>
    
    #define MCP7940_CTRL_ID 0x6F
    #define CSMEM_PIN 5
    
    #define LEDPIN 9
    
    long sleepIntervalSec=5;
    long loopCnt=0;
    uint8_t d[8];
    uint8_t dAlarm[8];
    int d1[8];
    
    // Set this to the pin you connected the DHT's data pin to
    #define DHT_DATA_PIN 6
    
    // Set this offset if the sensor has a permanent small offset to the real temperatures
    #define SENSOR_TEMP_OFFSET 0
    
    // Sleep time between sensor updates (in milliseconds)
    // Must be >1000ms for DHT22 and >2000ms for DHT11
    static const uint64_t UPDATE_INTERVAL = 5000;
    
    // Force sending an update of the temperature after n sensor reads, so a controller showing the
    // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
    // the value didn't change since;
    // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
    static const uint8_t FORCE_UPDATE_N_READS = 10;
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_MULTIMETER 2
    
    float lastTemp;
    float lastHum;
    uint8_t nNoUpdatesTemp;
    uint8_t nNoUpdatesHum;
    bool metric = true;
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgVolt(CHILD_ID_MULTIMETER, V_VOLTAGE);
    
    DHT dht;
    
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
    int oldBatteryPcnt = 0;
    int batteryBasement = 812;
    int batteryFull = 922;
    float batteryConstant = 100.0 / (batteryFull - batteryBasement);
    float lastbatteryV = 0;
    
    const int buzzer = 7; //buzzer to arduino pin 7
    
    #define RELAY_1  8  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 1 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    void before()
    {
      for (int sensor=3, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);
        // Set relay to last known state (using eeprom storage)
        digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
    }
    
    void setup()  
    {
       // use the 1.1 V internal reference
       analogReference(INTERNAL);
    
      pinMode(LEDPIN, OUTPUT);
      digitalWrite(LEDPIN, LOW);
      Wire.begin();
      pinMode(CSMEM_PIN, OUTPUT);
      digitalWrite(CSMEM_PIN, HIGH);
    
       dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
      if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
        Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
      }
      // Sleep for the time of the minimum sampling period to give the sensor time to power up
      // (otherwise, timeout errors might occure for the first reading)
      sleepIntervalSec = dht.getMinimumSamplingPeriod();
      clearAlarm();
      delay(20);
      setNewAlarm();
      sleep(dht.getMinimumSamplingPeriod());
      analogRead(BATTERY_SENSE_PIN);
     }
    
    void presentation() {
       // Send the sketch version information to the gateway and Controller
       sendSketchInfo("Humidity sensor", "1.0");
       present(CHILD_ID_MULTIMETER, S_MULTIMETER, "VOLT", true);
       present(CHILD_ID_HUM, S_HUM, "HUMIDITY", true);
       present(CHILD_ID_TEMP, S_TEMP, "TEMP", true);
      for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_BINARY);
      }
      metric = getControllerConfig().isMetric;
    }
    
    
    void loop()
    {
      wait(100);
       int sensorValue = analogRead(BATTERY_SENSE_PIN);
       #ifdef MY_DEBUG
       Serial.println(sensorValue);
       #endif
       float batteryV  = sensorValue * 0.004551646;
       if(sensorValue < batteryBasement) {
        sensorValue = batteryBasement;
        batteryV = 0;
       }
       else if (sensorValue > batteryFull) {
        sensorValue = batteryFull;
       }
       int batteryPcnt = (sensorValue - batteryBasement) * batteryConstant;
           if ((abs(oldBatteryPcnt - batteryPcnt) > 1)) {
          sendBatteryLevel(batteryPcnt);
          oldBatteryPcnt = batteryPcnt;
        }
       
       if(batteryV != lastbatteryV) {
       send(msgVolt.set(batteryV, 2));
       lastbatteryV = batteryV;
       }
       #ifdef MY_DEBUG
       Serial.print("Battery Voltage: ");
       Serial.print(batteryV);
       Serial.println(" V");
       Serial.print("Battery percent: ");
       Serial.print(batteryPcnt);
       Serial.println(" %");
       #endif
    
      // Force reading sensor, so it works also after sleep()
      dht.readSensor(true);
    
      // Get temperature from DHT library
      float temperature = dht.getTemperature();
      if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT!");
      } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
        // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
        lastTemp = temperature;
        if (!metric) {
          temperature = dht.toFahrenheit(temperature);
        }
        // Reset no updates counter
        nNoUpdatesTemp = 0;
        temperature += SENSOR_TEMP_OFFSET;
        send(msgTemp.set(temperature, 1));
        #ifdef MY_DEBUG
        Serial.print("T: ");
        Serial.println(temperature);
        #endif
      } else {
        // Increase no update counter if the temperature stayed the same
        nNoUpdatesTemp++;
      }
    
      // Get humidity from DHT library
      float humidity = dht.getHumidity();
      if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
      } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
        // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
        lastHum = humidity;
        // Reset no updates counter
        nNoUpdatesHum = 0;
        send(msgHum.set(humidity, 1));
    
        #ifdef MY_DEBUG
        Serial.print("H: ");
        Serial.println(humidity);
        #endif
      } else {
        // Increase no update counter if the humidity stayed the same
        nNoUpdatesHum++;
      }
    long sleepTime = UPDATE_INTERVAL;
    if (batteryPcnt < 50) {
      sleepTime = (sleepTime * 2);
    }
      // Sleep for a while to save energy
      sleepIntervalSec = sleepTime / 1000;
      Serial.println();
      Serial.print("Setting new sleep time: ");
      Serial.print(sleepIntervalSec);
      Serial.println(" seconds.");
      clearAlarm();
      delay(20);
      setNewAlarm();
      smartSleep(sleepTime);
    
    }
    
    void receive(const MyMessage &message)
    {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_STATUS) {
        // Change relay state
        digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
        // Store state in eeprom
        saveState(message.sensor, message.getBool());
        // Write some debug info
        Serial.print("Incoming change for sensor:");
        Serial.print(message.sensor);
        Serial.print(", New status: ");
        Serial.println(message.getBool());
      }
    }
    

    Sensor startup:

    0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    3 MCO:BGN:BFR
    4 TSM:INIT
    5 TSF:WUR:MS=0
    8 TSM:INIT:TSP OK
    9 TSM:INIT:STATID=66
    11 TSF:SID:OK,ID=66
    13 TSM:FPAR
    143 TSF:MSG:SEND,66-66-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    524 TSF:MSG:READ,0-0-66,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    529 TSF:MSG:FPAR OK,ID=0,D=1
    2150 TSM:FPAR:OK
    2151 TSM:ID
    2152 TSM:ID:OK
    2154 TSM:UPL
    2161 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2181 TSF:MSG:READ,0-0-66,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2186 TSF:MSG:PONG RECV,HP=1
    2189 TSM:UPL:OK
    2190 TSM:READY:ID=66,PAR=0,DIS=1
    2199 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2253 TSF:MSG:READ,0-0-66,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2310 TSF:MSG:SEND,66-66-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2366 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2403 TSF:MSG:READ,0-0-66,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2461 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=OK:Humidity sensor
    2562 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    2618 TSF:MSG:SEND,66-66-0-0,s=2,c=0,t=30,pt=0,l=4,sg=0,ft=0,st=OK:VOLT
    2757 !TSF:MSG:SEND,66-66-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=0,st=NACK:HUMIDITY
    2777 TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=6,pt=0,l=4,sg=0,ft=1,st=OK:TEMP
    2912 !TSF:MSG:SEND,66-66-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    2918 MCO:REG:REQ
    2974 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
    2991 TSF:MSG:READ,0-0-66,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2996 MCO:PIM:NODE REG=1
    2999 MCO:BGN:STP
    3154 MCO:SLP:MS=2000,SMS=0,I1=255,M1=255,I2=255,M2=255
    3160 MCO:SLP:TPD
    3161 MCO:SLP:WUP=-1
    3163 MCO:BGN:INIT OK,TSP=1
    

    Log Sensor: (This is when I press the button when the sensor is awake)
    It's sends away it's heartbeat correctly.

    125578 TSF:MSG:READ,0-0-66,s=3,c=1,t=2,pt=0,l=1,sg=0:0
    Incoming change for sensor:3, New status: 0
    
    Setting new sleep time: 5 seconds.
    137926 MCO:SLP:MS=5000,SMS=1,I1=255,M1=255,I2=255,M2=255
    137939 TSF:MSG:SEND,66-66-0-0,s=255,c=3,t=22,pt=5,l=4,sg=0,ft=0,st=OK:134932
    

    Log Openhab: And the gateway receives heartbeat.

    18:21:37.174 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0
    18:21:37.178 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TestLight' received command OFF
    18:21:37.181 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFF
    18:22:15.416 [DEBUG] [rs.internal.protocol.MySensorsReader] - 66;255;3;0;22;134932
    18:22:16.372 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 0;0;3;0;2;
    18:22:16.408 [DEBUG] [rs.internal.protocol.MySensorsReader] - 0;255;3;0;2;2.1.1
    

    Log Openhab: When the node sleeps..

    18:26:52.396 [DEBUG] [rs.internal.protocol.MySensorsWriter] - Sending to MySensors: 66;3;1;0;2;0
    18:26:52.397 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'TestLight' received command OFF
    18:26:52.399 [INFO ] [marthome.event.ItemStateChangedEvent] - TestLight changed from ON to OFF
    

    As you can see there is no mention in the openhab log file about buffering or smart sleep. Or a received heartbeat. Which it gets.
    What am I doing wrong?


  • Hardware Contributor

    Hi, just a short question as I haven't found any up to date information about it: I am thinking about switching from domoticz to openHab 2 (as I really like the new UIs and the auto discovery). I am using an ESP8266 based MQTT gateway. Does openhab 2 on a raspi work with Mysensors using MQTT and does it support the new sensors/actor types added Mysensors 2 (specially RGBW)?

    Thank you!



  • Yes you can using proxy items and rules. see example here : https://github.com/mortommy/MySensorDioder
    But why not switching to ethernet/serial gateway with @TimO OH2 plugin ?


  • Hardware Contributor

    Thanks @Fabien I have a serial gateway too, but I liked the idea of a MQTT gateway more because its much more flexible. Does Tims plugin not support MQTT? I wanted to use that.



  • Hi @LastSamurai , currently Timo is working on MQTT gateway but I don't know precisely when it will be available to all.

    @TimO said in openHAB 2.0 binding:

    @Fabien Thank you for your feedback!
    And: I've waited for that question according firmware updates to come up. πŸ˜„

    I've looked into it and I'm very interested but till now there is only the implementation in the library, I've not seen an implementation in a binding. I'll continue to look at it, but with low priority. πŸ™‚

    Current priority list is:

    1. Include binding in OH2 repository.
    2. Test and include the big refactoring from @andreacioni .
    3. Add MQTT gateway (proof of concept working, full integration after refactoring).
    4. Add little feature requests, add sensors ...

  • Hardware Contributor

    Ok, I will keep an eye on this one and stay with the serial gateway for now.



  • After moving from my ubuntu laptop to RP3 I have had success!!
    Flashed the sd card with the latest openhabian, waited for everything to auto install on the RP3 and could then install the my sensors (ethernet) gateway on the pi and also open a karaf console to log openhab2 via a remote/headless ssh. My remote browser could open the paper ui via openhabianpi:8080 and I added the ethernet gateway successfully. Adding the motion sensor needed the node id 2 and child id 1 as set by the Arduino sketch. The light level sensor was then turned on and it just showed up as my sensors (2,2) in the paper ui inbox so this level of discovery works! The sensors now show tripped status/light level in the paper ui control.
    Looks like I can now progress to using My Sensors to control the mi-lights already working in openhab2.
    Thanks Tim for all your work on the binding



  • @TimO , I just noticed a weird behavior - I've changed configuration for another binding and restarted it from the console but that killed mysensors binding:

    2017-03-04 13:07:19.110 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'demo.things'
    2017-03-04 13:07:19.123 [ERROR] [col.serial.MySensorsSerialConnection] - Interrupted reset time wait
    2017-03-04 13:07:19.124 [WARN ] [col.serial.MySensorsSerialConnection] - Skipping I_VERSION connection test, not recommended...
    2017-03-04 13:07:19.125 [INFO ] [col.serial.MySensorsSerialConnection] - Successfully connected to MySensors Bridge.
    2017-03-04 13:07:19.125 [WARN ] [col.serial.MySensorsSerialConnection] - Network Sanity Checker thread disabled from bridge configuration

    2017-03-04 13:07:21.141 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
    2017-03-04 13:07:21.149 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:0)
    2017-03-04 13:07:33.161 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
    2017-03-04 13:07:33.163 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:1)

    Complete stop/start of OH is the only solution so far.



  • Hi @AndrewZ , yes this is a known issue (I just openend an issue here) with the binding. Just out of curiosity, have you changed something in things file?



  • @andreacioni thank you
    Yes, it was a change in the .things file, but it was related to another binding.



  • @AndrewZ things file update trigger a reload of all binding declared inside it, nothing strange. πŸ˜‰ Follow the above link to keep track of the status of this issue.


  • Hardware Contributor

    I just tried to get the openhab 2 binding up and running. I have a serial gateway and domoticz + openhab running on a pi. I stopped the domoticz service and installed the serial and mysensors addons for openhab like mentioned in the github readme (bundle:list showed them both). I also added the openhab user to the dialout group.
    I then created a demo.things file in config/things with

    Bridge mysensors:bridge-ser:gateway [ serialPort="/dev/ttyUSB0", sendDelay=200 ] {
        /** define things connected to that bridge here */
      }
    

    The log of openhab shows these errors though:

    2017-03-19 00:03:59.855 [ERROR] [col.serial.MySensorsSerialConnection] - Can't connect to serial port. Wrong port?
    2017-03-19 00:03:59.897 [ERROR] [col.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:46)
    

    Any idea why? This works just fine:

    cat /dev/ttyUSB0
    


  • @LastSamurai please check the group ownership

    $ ls -l /dev/ttyUSB0
    

    Make sure the port you're using is included in EXTRA_JAVA_OPTS as described here


  • Hardware Contributor

    Thank you, that helped! Should anyone ever face the same problem: after changing the EXTRA_JAVA_OPTS I also needed to restart openhab (more likely the java vm).


  • Hardware Contributor

    So openhab is running now and discovers my sensors when I restart them while scanning. My RGBW controller nodes pop up as RGBW sensors though. The on/off switch works, but what do I have to do to actually control the colors?
    I tried editing the 4 variables but that doesn't seem to change the lights.

    0_1490048386134_upload-9bf82cdd-ddd8-4249-973e-65bd30a3a959


  • Hero Member

    @LastSamurai : What does your sketch expect? One ASCII formated RGB code like described here: https://www.mysensors.org/download/serial_api_20 or a value between 0 and 100% per color (r,g,b,w)? I see different implementations (in openhab and in mysensors) and maybe we have to adjust the binding.


  • Hardware Contributor

    @TimO Right, I guess thats the problem. I have written my sketch against domoticz, so it expects either a 6 bit hex string (rgb = e.g. ff00ff) or a 9 bit (idk why) rgbw hex string (e.g. #ff00ff00).
    According to the mysensors docu "ff00ff00" would be right, I guess.



  • Just noticed in the log:

    [WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 0, child: 255 please insert it manually
    

    Is that normal or any additional configuration is needed?
    Thanks!


  • Hero Member

    @AndrewZ hmmmm, a child that represents itself with an id of 255 shouldn't exist. 255 is used for battery status for example. What's the message that comes in before that?


  • Hero Member

    @LastSamurai I'm working on a solution! RGB seems easy, but I haven't looked at RGBW. The Colopicker in OpenHAB only sends RGB.



  • @TimO here is the output:

    2017-03-23 20:51:32.531 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
    2017-03-23 20:51:33.754 [WARN ] [.discovery.MySensorsDiscoveryService] - Cannot automatic discover thing node: 0, child: 255 please insert it manually
    2017-03-23 20:51:33.772 [INFO ] [al.protocol.ip.MySensorsIpConnection] - Successfully connected to MySensors Bridge.
    

  • Hero Member

    @AndrewZ the message occurs right after startup and before the bridge gets connected?! Just ignore the message if everything else is working fine. πŸ˜„
    I'll release the refactored version soon. It's already available via the new IoT marketplace.



  • @TimO yes, message occurs on startup and I'm already using version from marketplace, I see it as market:binding-3328323 - 1.0


  • Hero Member

    @AndrewZ oh okay! I will look at it!


Log in to reply
 

Suggested Topics

  • 22
  • 5
  • 135
  • 1
  • 4
  • 19

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts