OH 2.5 snapshot and MySensors binding

Hi,
With 2.5 final OH version, Mysensors binding doesn’t work. I have to upload jar file above to my addons directory.

Hi Tim,

I compiled your latest code from github where you added the MQTT gateway again. I was able to install it and see great progress: the MQTT gateway is supported again, but I believe there is still an issue at the point where the MQTT broker is defined. It doesn’t seem to recognize the broker.

Welcome to openHAB community! :smiley:

1 Like

I’m glad you’re able to configure the MQTT gateway with the current code, because I was not able to test it yet.
And yes, as I feared, the problem with the binding that doesn’t recognize the broker hasn’t been solved yet.

I believe the MqttService is nowhere set. I don’t know exactly how you have to get this. I assume through the MQTT binding based on the name in the configuration?

I’m not sure where the problem is located yet and I can’t add the MQTT binding to my development environment, because of this: Struggling with MQTT in development of new binding

This will be a though one.

I really believe it has something to do with getting the MQTTService. If I alter some settings on the MQTT Broker configuration, I can see things start working. I just can’t find any documentation on how to get the initial MQTT Service.

The MQTT Generic and Homie implementation seem to take a different approach.

I believe the best way forward is to change to a MQTTTopicDiscoveryService. By doing so, the MySensorsMQTT implementation doesn’t care anymore about the brokers. This would require a change in the MySensorsMqttConnection, but I believe this should be feasible.

1 Like

The OSGI dependency injection works for the MQTTService as soon as I added @Reference annotations to setMqttService und unsetMqttService in MySensorsMqttService.

Since already with annotations that not always worked for me I build a workaround in MySensorsMqttConnection.establishConnection()

       boolean connectionEstablished = false;

        //Start workaround
        if (MySensorsMqttService.getMqttService() == null) {
            BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
            final ServiceReference sr = bc.getServiceReference(MqttService.class.getName());
            if (sr != null) {
                final MqttService mqtt = (MqttService) bc.getService(sr);
                if (mqtt != null) {
                    new MySensorsMqttService().setMqttService(mqtt);
                }
            }
        }
        //End workaround

        if (MySensorsMqttService.getMqttService() == null) {

@Guillermo_Schimmel, I have been wondering how to do FOTA with my serial bridge connected gateway. Can you do a writeup on your FOTA steps?

Thanks,
John

I use a MQTT gateway, not serial.

In order to use FOTA I run a separate controller (https://www.mycontroller.org/).

So I end up using openhab for the automation and rules and mycontroller for mysensors node upgrading.

Hope it helps

regards

I just upgraded to 2.5 and I also report that mysensors do not work any more. The gateway seems to be online but the sensors do not report anything. It used to work just with openhab 2.4. the mysensors gateway is serial

same here … unfortunately I couldn’t get it to work under 2.5 and mqtt.
what about the current github code? does it run under openhab 2.5?

hey Tim

I had a fully running install, but had to move to another hardware and lost some configs.

what I still miss: in which directory should there be the mqtt-config for mysensors?

thanks peter