How ethernet gateway code can check if is connected with controller?



  • Having arduino ethernet gateway I need to send messages with senors values to controller (Home assistant requirement to auto configure sensors).
    With serial gateway simple sending in first iteration of loop:

    	void loop() {
    		if ( ! inital_msgs_sent ) {
    			inputs.sendStates(); 
    			outputs.sendStates();
    			inital_msgs_sent = true;
    

    worked.

    But with ethernet controller loop starts when HA is not yet connected to GW so sent messages do not reach controller 😕
    So, how should I fix it?

    1. Is any way to know if controller is connected ?
    2. Is any way to know if controller requested presentation?
    3. Is any way to know if send message really reached controller?

    TIA, regards,



  • @matkor said in How ethernet gateway code can check if is connected with controller?:

    1. Is any way to know if controller is connected ?
    2. Is any way to know if send message really reached controller?

    Seems positive send() result means message reached controller when executed on gateway?



  • Answering one of my own questions.
    On ethernet gateway send() may return true when there is no connected controller, even when there is no ethernet cable plugged in. 😕


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 3
  • 1
  • 6
  • 10

49
Online

11.4k
Users

11.1k
Topics

112.6k
Posts