No LAN connection ESP8266 gateway



  • My ESP8266-NodeMCU gateway was successfully flashed using Arduino IDE 1.8.19 with MySensors library version 2.3.2
    The standard sketch was amended only with my credentials and a static IP address as follows:

    #define MY_RADIO_RF24
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    #define MY_GATEWAY_ESP8266
    
    #define MY_WIFI_SSID "XXX"
    #define MY_WIFI_PASSWORD "YYY"
    
    // Enable UDP communication
    //#define MY_USE_UDP  // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_HOSTNAME "ESP8266_GW"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,178,4
    
    // If using static ip you can define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    #define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    // The port to keep open on node server mode
    #define MY_PORT 5003
    
    // How many clients should be able to connect to this gateway (default 1)
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    //#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
    
    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN D1
    
    // Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    // Led pins used if blinking feature is enabled above
    //#define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors here
    }
    
    void loop()
    {
    	// Send locally attached sensors data here
    }
    

    The gateway fails to show up in the LAN however and pinging it at the static IP address fails.
    In the serial monitor a push on the reset button gives:

    ets Jan  8 2013,rst cause:2, boot mode:(3,6)
    
    load 0x4010f000, len 3460, room 16 
    tail 4
    chksum 0xcc
    load 0x3fff20b8, len 40, room 4 
    tail 4
    chksum 0xc9
    csum 0xc9
    v00049310
    ~ld
    

    I have tried two other NodeMCU boards and also a sketch with DHCP address assignment but results remain the same.

    Where do I go wrong?


  • Mod

    @Bramz is anything connected to any of the gpio pins? Some of the pins control boot behavior.



  • @Bramz @mfalkvidd I was curious about this and tried to see if it worked for me. I have the same results as @Bramz ! I can only see the output, though, when I set the monitor baud rate to 74880

    This is the same for the ESP8266Gateway and the ESP8266GatewayMQTTclient examples

    I tried it with the radio connected and without.

    On the Building a WiFi Gateway using ESP8266 one is instructed to "Install CP2102 drivers from here" but "here" is a dead link This is the driver for Windows in order for the nodeMCU to be seen as a serial port. So this is not the problem.

    I tried another example file-->examples-->ESP8266-->interactive and it worked as described. But this is not a MySensors example.


  • Mod

    @OldSurferDude that's strange. The driver download link works for me:
    IMG_6487.PNG

    But if you can flash the esp, you already have working drivers so there is no need to install more.

    We have a lots of users using esp8266 as gateways (I have on such gateway myself) so generally MySensors works well with esp8266. I wonder what the difference could be for your and Bramz's devices.

    The esp8266 uses 74880 baud when it boots (before it loads the sketch) so yes, to see the boot output you must use 74880 baud.


  • Mod

    Hmm, interesting. On my mobile I get redirected to https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads which works. But on my PC I get an error.


  • Mod



  • @mfalkvidd In my gateway hardware setup nothing is connected to GPIO pins apart from those used for radio connection as described in https://www.mysensors.org/build/connect_radio .
    Next to that, I have uploaded the sketch to 2 different NodeMCU-boards with absolutely nothing connected.

    I have also successfully uploaded the gateway sketch from two different Linux computers with same negative result. Only the serial monitor does not work in a Linux-ESP8266 connection as Linux apparently does not support the rather uncommon 74880 Baud rate which is forced by ESP8266.

    The funny thing is that about two years ago, using exactly the same hardware, I managed to set up a fully functional gateway with a remote Arduino-Nano temperature node and a visible, static-adressed LAN-connection. As it would not connect to my Domoticz-system at the time, I left it for a while until I tried to revive it recently.



  • @Bramz I am not an expert, but I can verify your findings. This looks like a serious bug in the MySensors code.

    OSD



  • @OldSurferDude Judging by the many different ways I tried to upload a functional gateway sketch I am beginning to suspect the same. Question is: where did things start to change from my earlier attempts two years ago?



  • @Bramz I'm fairly new to MySensors. As it is supported by volunteers, like you and me and @mfalkvidd, some code doesn't get updated when there's a version change, the code update often happens when someone notices that the code needs to be updated. I suspect that this is the case here.

    I'd be glad to help out, but not knowing the in's and out's of things, I can pretty much only verify code for which I have hardware.

    OSD


  • Mod

    @Bramz see section #1:1 in https://forum.mysensors.org/topic/666/read-this-first-it-could-save-you-a-lot-of-time on how to enable debug logging. After that, please post the serial output here.



  • @mfalkvidd Thanks for your suggestion. I was under the impression that the com port could only be used for one thing at a time: either flashing or monitoring, but apparently this combination is possible. Anyway, I followed the instruction but unfortunately the serial monitor remains completely blank.
    FlashAction.png



  • Did you try an earlier ESP 8266 framework version? Perhaps version 3 or even lower?


  • Mod

    @electrik version 3 will not work. 2.6.2 is required.



  • @mfalkvidd I am not entirely sure what is meant by an ESP framework, but if it refers to the URL which is given in the <Preferences> section of the Arduino IDE under <More Board manager URL's> than this might be the problem.
    I am now using https://arduino.esp8266.com/stable/package_esp8266com_index.json which leads to a version 3.0.2.
    What URL should I use for a version 2.6.2 ? Than I will give that a try.


  • Mod

    @Bramz yes. Here:
    f5c588bb-16b5-4002-9f67-07d39b99e780-image.png



  • Blush, blush. Thanks.



  • @mfalkvidd @electrik Yes! This did the trick for me. Thanks for your guidance.
    Probably the instruction to use a version not higher than 2.6.2 has been given somewhere/sometime and I have overlooked it.
    The serial monitor remained blank during upload, but when I select 9600 baud and press the reset-button it gives what I think is a healthy response:

    ⸮⸮5R⸮⸮64 MCO:BGN:INIT GW,CP=RNNGE---,FQ=80,REL=255,VER=2.3.2
    121 TSF:LRT:OK
    137 TSM:INIT
    151 TSF:WUR:MS=0
    174 TSM:INIT:TSP OK
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 3
    cnt 
    
    connected with XXX, channel 6
    dhcp client start...
    ip:192.168.178.46,mask:255.255.255.0,gw:192.168.178.1
    403 TSM:INIT:GW MODE
    426 TSM:READY:ID=0,PAR=0,DIS=0
    458 MCO:REG:NOT NEEDED
    ip:192.168.178.4,mask:255.255.255.0,gw:192.168.178.1
    1544 GWT:TIN:CONNECTING...
    2573 GWT:TIN:CONNECTING...
    scandone
    3601 GWT:TIN:CONNECTING...
    3629 GWT:TIN:IP: 192.168.178.4
    3662 MCO:BGN:STP
    3680 MCO:BGN:INIT OK,TSP=1
    3708 TSM:READY:NWD REQ
    3735 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    pm open,type:2 0
    

    And sure enough, the LAN has detected an ESP device at 192.168.178.4 now.

    Secretly, I was hoping that connection to Domoticz would now also work but unfortunately I keep on getting the persistent message:

    2022-11-25 11:54:58.598 Error: MySensorsGateway: Can not connect to: 192.168.178.4:5003
    

    However, that probably needs to be adressed in a different topic.



  • @OldSurferDude Hope this worked for you too.



  • @mfalkvidd @Bramz @electrik

    When I saw 2.6.2 I was thinking the MySensors Library (2.3.2)! It never occurred to me it was the board manager.

    So, yes! it works for me. 🙂

    I just checked to see if Domoticz has an MQTT interface and it appears that it does. @Bramz, look into that. Once you have that, then it may be easy to connect other devices, like Tasmota devices, to Domoticz. MQTT requires an always-on computer connected to your network.

    I have a headless (needs dummy monitor plug or 3x 75Ω resistors to boot), refurbished computer on which I run Linux OS, then both MQTT and Home Assistant running in Virtual Box.

    Thanks everyone!

    OSD



  • Still, there seems to be 'someting rotten in the state of Network' where my LAN is concerned. Although the Arduino serial monitor says:

    13:03:55.821 -> connected with XXX, channel 6
    13:03:55.868 -> ip:192.168.178.4,mask:255.255.255.0,gw:192.168.178.1
    13:03:55.915 -> ip:192.168.178.4,mask:255.255.255.0,gw:192.168.178.1
    13:04:04.826 -> pm open,type:2 0
    

    when I ping the IP-address I get:

    Pinging 192.168.178.4 with 32 bytes of data:
    Request timed out.
    Request timed out.
    Request timed out.
    Request timed out.
    
    Ping statistics for 192.168.178.4:
        Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
    

    When I use the tool 'Wireless Network Watcher' I do see that a device is connected at 192.168.178.4 with the correct MAC address.
    However, when I look at the management page of my FritzBox 7490 modem/router no device is mentioned at 192.168.178.4.

    I remain at a loss here.


Log in to reply
 

Suggested Topics

10
Online

11.2k
Users

11.1k
Topics

112.5k
Posts