openHAB 4 MySensors Binding



  • Hello there
    I thought it would be a good idea to upgrade my system to openHAB4, as i wanted to play with my security cameras linked to a Synology NAS system...
    Well it didn't go according to plan.
    First openhabian had to be upgraded from Buster to Bullseye in order to get Java from 11 to 17. Then Java got upgraded, By that time MySensors stopped working. So i started over with a fresh install of MySensors. All went well until

    make
    
    hal/architecture/Linux/drivers/core/GPIO.cpp: In constructor ‘GPIOClass::GPIOClass()’:
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:12: note: ‘snprintf’ output between 22 and 277 bytes into a destination of size 64
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:12: note: ‘snprintf’ output between 23 and 278 bytes into a destination of size 64
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    g++ -MT build/hal/architecture/Linux/drivers/core/interrupt.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_MQTT_CLIENT_ID=\"impassedesroses\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_RF24_PA_LEVEL=RF24_PA_LOW -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/interrupt.cpp -o build/hal/architecture/Linux/drivers/core/interrupt.o
    hal/architecture/Linux/drivers/core/interrupt.cpp:33:10: fatal error: stropts.h: No such file or directory
       33 | #include <stropts.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:99: build/hal/architecture/Linux/drivers/core/interrupt.o] Error 1
    
    

    Please advise if i should start over from the very begenning (fresh SD) or just stick with openHAB 3 (but soon or later it will be superseeded)

    Thanks a lot for your time people.


  • Mod

    @ben999 just remove the stropts include (in hal/architecture/Linux/drivers/core/interrupt.cpp), or use the development branch where the include has already been removed.

    https://github.com/mysensors/MySensors/pull/1446



  • This post is deleted!


  • @mfalkvidd Genius !!! 😮



  • Hi,

    After changed to develop branch, the make was successfull, but how to get MySensors binding?
    I have found this: https://github.com/tobof/openhab-addons/wiki/Installation but it is for OpenHab 3.
    When I installed the jar, I get this error:

    [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.mysensors-3.1.0.jar
    
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [265]
    
      Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
    

    How to get a new binding?
    How to solve this?



  • Hi @zkarolyi

    I can not provide any help on that matter as i went the MQTT way.

    The binding for serial gateway requires loads of work from the MySensors dev team; so it might tatke a while before it becomes available (if it does all together). I really appreciate all the effort put into this but i also understand that it might come to an end someday. No matter how much i prefer the serial gateway over MQTT... i ended up in the mqtt team

    Back to your issu : the jar file might not be compatible with OH4



  • Hi @ben999

    I used to have OH3 with MySensors Ethernet gateway but now I have upgraded to OH4 and it seems the only option is to connect MySensors network to OH via MQTT.
    I flashed MySensors mqtt_gateway and installed Mosquitto on same machine where OH4 is installed (ip=192.168.1.yyy). I also installed MQTT binding in OH4.

    Can you please advise how did you configure things and items file? In OH3 I had them configured in textual format.

    Things file in OH3

    Bridge mysensors:bridge-eth:gateway [ ipAddress="192.168.1.xxx", tcpPort=5003, sendDelay=300, startupCheckEnabled=false, networkSanCheckEnabled=true ] {
    	 light			relunderstair0101 [ nodeId=1, childId=1, requestAck=false ]
    

    Items file in OH3

    Switch relunderstair0101  "LED-stairs" { channel="mysensors:light:gateway:relunderstair0101:status" }
    


  • @niccodemi I am no expert and am having a tough time with these files as well !!!

    My .things file looks like so :

    Bridge mqtt:broker:mosquitto "MySensorsGateway"@"Home" [host="openhabian", port="1883", secure=false]
    {
    	Thing topic garageDoor01 "Garage"@"Basement" {
    		Channels:
    			Type contact :	garageDoor01switch	[stateTopic="mysensors-out/19/1/1/0/16", transformationPattern="MAP:contact.map"]
    			Type datetime : garageDoor01switch_LastUpdate
    	}
    

    As far as i understand, you're missing that "linktopic" descrption...



  • @ben999 Thank you. I managed to get sensors data coming into OH.

    Would you happen to have also any thing / item example for switch / relay sketch?



  • Hello anybody runing openhab4 with latest bindings (3.3.0) and serial gateway?
    I'm not able to get the bindings active. They are installed but not active.

    d2c88d93-f48c-4149-87ae-864a0d9cc88a-image.png

    diag gives following message:

    7cf09807-9953-4235-bafd-cc3986e25756-image.png

    Any ideas?



  • @forexsieno I am running OH4 but have migrated MySensors to MQTTGateway. Below example of how to control relays.

    thing file

    Bridge mqtt:broker:Mosquitto "Mysensors MQTT Broker" [host="192.xxx.xxx.xxx", secure=false, port=1883, clientID="Openhab"] 
    {
        Thing topic relunderstair "Relay" (mqtt:broker:Mosquitto) {
            Channels:
                Type switch : relunderstair0101 "LED-stairs" [ stateTopic="mygateway1-out/1/1/0/0/2", commandTopic ="mygateway1-in/1/1/0/0/2", on="1", off="0" ]
        }
     }
    

    item file

    Switch relunderstair0101  "LED-stairs" { channel="mqtt:topic:Mosquitto:relunderstair:relunderstair0101" }
    


  • Hi @zkarolyi

    You can download the 3.2.0-Snapshot version from here:
    https://forum.mysensors.org/post/110626

    It is working in OH3 and OH4!

    There is also a 3.3.0-Snapshot version, but it doesn't work in OH4.
    See my post here: https://forum.mysensors.org/post/113864



  • Hi @zkarolyi

    Download org.openhab.binding.mysensors-4.0.4-SNAPSHOT.jar from my Google Disk and try it.
    I only tested as a MySensors MQTT Gateway



  • Hi @CyborgAndy

    many thanks for providing the binding update for MySensors 4.0.4! I upgrade my OpenHAB 3.4.4 a few minutes ago to 4.0.4 successfully with your binding update. I use a USB connected serial-gateway. The OpenHAB manual installation upgrade works perfect. I need to do afterwards the following steps in the Karaf console, to get the gateway online again, after the update:

    feature:install openhab-transport-serial
    feature:install openhab-core-io-transport-mqtt
    feature:install openhab-core-io-transport-serial-javacomm
    

    Many thanks again!
    kerberos



  • As x-mas gift 🎅 works with OpenHAB 4.1 as well...



  • Hi @CyborgAndy

    Really thank you for this jar so much, I finally managed to bring my sensors to life!
    A thousand thanks and gratitude!

    zkarolyi



  • As an OH3 user looking to upgrade, I'm wondering, do all of the binding points from OH to mysensor nodes, children etc work after upgrade and loading this new .jar?

    Or do I have to re-build everything in OH?



  • This post is deleted!


  • Hi @adds666

    I did in between the switch from 2.5.12 to 3.4.4 a change from pure textual configuration in 2.5.12 to a UI configuration in 3.4.4. This requires some homework. Can't remember beside the exchanged mysensors binding files anything else to upgrade to 4.0.4 from 3.4.4 and finally to current 4.1.1. Keep in mind, I use a OpenHAB manual installation on a non-Debian Linux system, not openHABian. This may have an influence, but I don't expect any hiccups.

    kerberos


Log in to reply
 

Suggested Topics

  • 22
  • 10
  • 2
  • 1
  • 3
  • 7

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts