Serial Gateway as Controller



  • Hi all.
    Is there possible in serial gateway read last recieved packet?? not in serial format .. format like Message in Sensor ..
    I don't want parse data from serial string ..

    I want add code to gateway , for controll I2C relay .. don't need controller..

    regards..


  • Admin

    Just rewrite the serial gateway code for your needs.



  • hmmm.... then I must do it self .. OK .. in loop secton is good point to check if new packet is received and control realy..

    OK .. regards..



  • hi.
    I make changes .. litle changes in https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MyGateway.cpp#L223

    return 1 if new message else 0
    then I can test in loop if got new message .
    then load last message .. and have all information what I need ..

    super thanks ..

    PS : how I can add here part of source code ?

    regards.


  • Admin

    @dzairo said:

    PS : how I can add here part of source code ?

    http://forum.mysensors.org/topic/666/how-to-ask-for-help



  • Hi @dzairo and @hek,

    If you can share with me and other person in that forum more info. about your experiences in that topic... "Gateway as Controller". For me that solution and idea is very interesting because I'll tried prepare gateway with LCD and SD card reader only ...to write information from sensors. Extra controller and other stuff isn't necessary for me. You know @hek it can be solution for small environment only with arduino and nRF cards ... Additionally it seems to me that configuration will be much chipper than full architecture (sensors, gateway and controller) isn't it ?

    Because I'm not sure where I can make changes in Gateway Code or library to read directly information from message ... help me please and give me advise how I can start with that ... I feel that it could have a future 😃

    Regards

    Michal



  • @dzairo
    Hello dzairo
    I could not open the link. Can you please share your code?

    Regards
    Ratnanabh



  • Hi. It's long time .. but standard function is : gw.processRadioMessage();
    and I make changes in source code in MyGateway.cpp to this :

    char MyGateway::processRadioMessage() {
    	char isMessage=0;
    	if (process()) {
    	// A new message was received from one of the sensors
    	  isMessage=1;
    	  MyMessage message = getLastMessage();
    	  if (mGetCommand(message) == C_PRESENTATION && inclusionMode) {
    		rxBlink(3);
    	  } else {
    		rxBlink(1);
    	  }
    	  // Pass along the message from sensors to serial line
    	  serial(message);
    	}
    
    	checkButtonTriggeredInclusion();
    	checkInclusionFinished();
    	return isMessage;
    }
    

    But in new library is not file MyGateway.cpp .. then I don't now ..
    using is :

    if (gw.processRadioMessage()==1) {..}
    

    regards..
    there is possible make easy gateway .. controler .. to control only light for example.. then we don't need external controller .. etc..



Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts