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
  • 2
  • 5
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts