MQTT Broker support in MySensors 1.6


  • Plugin Developer

    @hek I believe in 1.5 version we have MQTT broker which is completely different than 1.6 MQTT Client version

    In version 1.5 I'm using client version of MQTT in MyController, So from version 1.6 I should have broker version of MQTT with MyController. Am I correct?


  • Admin

    Yes, the MQTT "broker" variant has been removed from development branch. It was not maintained by anyone and was rendering too much (unanswered) support questions.

    And yes, either you have to have to have a build in broker in the controller or add an external broker (like mosquito).


  • Plugin Developer

    @hek said:

    Yes, the MQTT "broker" variant has been removed from development branch. It was not maintained by anyone and was rendering too much (unanswered) support questions.

    And yes, either you have to have to have a build in broker in the controller or add an external broker (like mosquito).

    Thank you!



  • @hek I was also confused by this change. The API & Download page does show only 1.5 version, but 1.6 version is the one on Github, right ?


  • Admin

    We do releases of the "master" branch. Most recent release is 1.5.1.

    All development and pull requests happens against the "development" branch (1.6.0-beta). When this is released and merged into master, I'll update the main site to reflect the changes in api and examples.

    All download links on the site points to the correct releases in master branch.
    But the default branch on github is set to "development" on purpose. If you start cloning git repositories you probably know how to switch between branches. See:
    http://forum.mysensors.org/topic/330/how-to-contribute-code-to-the-mysensors-project/25



  • @hek Thanks. This leads me to another question please.
    I want to try the new MQTT client version. There is no complete example, right ? Only the empty .ino file on github from the development branch. https://github.com/mysensors/Arduino/tree/development/libraries/MySensors/examples/GatewayW5100MQTTClient

    If there is no working example, then I'll have to read first the development notes ( https://docs.google.com/document/d/1NKq5uuNdnxF5jWnum7VT32mbKLjuvqlx2A5D1qQ-H3Q/edit#) and then try to know which header files to include and which interfaces to be called to run the MQTT. Am I wrong ?

    Thank you.


  • Admin

    It should be "empty". The defines at the top enables the features needed and builds the gateway for you.

    It works.. πŸ™‚

    The only issue I know about right now is topic naming that the gateway subscribes to. Messages from your radio network will be looped back to the gateway by your broker because the gateway subscribes to the same topic as it publishes to (which you define in the sketch).

    I will probably rename the subscribe topic to avoid this.. Just haven't come up with any good prefix-name. Will probably just be user defined as well.



  • @hek Great πŸ˜„ I reflashed the mqttclient and it works well. Will test it with another node now.
    Thanks hek.



  • I have spent the last hour trying to create a new node but it keeps telling me that Radio init fail.
    What I reached is that the below condition in RF24.cpp does not return true.

      if( setDataRate( RF24_250KBPS ) )
      {
        p_variant = true ;
      }
    

    Thus in trasnportInit(), the following condition will return false.

    if (!_rf24.isPVariant()) {
    	debug(PSTR("isPVariant\n"));
    	return false;
    }
    

    Which finally lead to print Radio fail in MysensorCore.cpp

    
    if (!transportInit()) {
    			debug(PSTR("Radio init fail\n"));
    			// Nothing more we can do
    			while(1) {
    				#if defined(MY_GATEWAY_ESP8266)
    					yield();
    				#endif
    			};
    		}
    

    I tried using two boards which were running using v1.5. I checked also version 1.5 and the setDataRate function are the same. What do you think ?



  • I am using RelayActuator example.

    It's 1 AM and I may have missed something πŸ˜„ I will try to run it again tomorrow after work. Thanks.


  • Admin

    Usually indicates a mis-wired radio. If youΒ΄re using a non+ NRF-radio you might wanna remove that check.



  • @hek I am back from work.
    In 10 mins I knew what was the problem and you won't believe it 😐
    Since I was flashing at first the gateway, thus I defined the MY_SOFTSPI and didn't commented it back when I was flashing the relayactuator ! What a mistake !!

    I'll keep you updated as I'll start development the logic for the gateway using mqtt and the other node.

    Thanks hek.


Log in to reply
 

Suggested Topics

  • 4
  • 9
  • 14
  • 274
  • 5
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts