ESP8266 WiFi gateway port for MySensors



  • @hek Yes I tried those but it's probably the driver install it was acting a little finicky so it was quicker to flip over to the VM. 🙂



  • @DrJeff
    I remember that there was an error in the boardmanager-package for MacOS. You need to change the file-permissions to executable:

    sudo chmod +x ~/Library/Arduino15/packages/esp8266/tools/esptool/0.4.4/esptool 
    

  • Hero Member

    I followed the steps above, and I'm even able to upload sketches, however I only get this in serial monitor:

    load 0x4010f000, len 1264, room 16 
    

    Bad module maybe?

    EDIT: After choosing the right board (v.1.0) and applying the fix above from @fleinze, it seems it is working now...



  • Hi,

    I'm having problems running ESP8266 gateway. When I reset my nodes or trying send command from controller to node (dimmer, realy etc.) my gateway reset itself. I try using different ESP-s (I'm using ESP-12), power supplys and radio modules.

    On serial monitor I get this error:

    error.jpg


  • Mod

    @krajcl What catches my eye is the client command echoed by the gateway: "Client 0: 44;255;3;0;6;"
    The 0 at the end seems to be missing -- This could be a gateway issue (are you using the standard ESP gateway sketch, or did you make any modifications?) which causes e.g. the command parser to crash.

    Could you give a more detailed description of your setup? Which controller are you using, what does the network look like (nr. of sensors, repeaters etc.).



  • @Yveaux I'm using standard ESP gateway sketch (I reinstalled Arduino IDE, download latest mysensors library). At the moment I'm using MYSController as controler (for testing), I only have one node active (standard humidity sketch - only changed node id).


  • Mod

    @krajcl The last command from the controller seems to be a response to the sensor to indicate metric or imperial units are used (internal command 6). The payload should be either 'M' or 'I'.
    I'm not familiar with MYSController, but is there some setting influencing the unit system? Can you check if it has a valid value?
    I can't replay the situation right now, so anything you can do yourself to track the problem would really help.



  • @Yveaux This is result with Domoticz as controller and new node (relay), same result:

    error2.jpg


  • Hero Member

    I'm definitely not a expert at all on the topic, but could it be that a ftdi-usb adapter doesn't provide enough power to ESP, and it eventually hangs when wi-fi transmissions drawn too much power? (according to the specs, ~150mA when transmitting) .

    Just trying to help with some (probably dumb) brainstorming. 😉



  • Do you need to the NodeMCU to implement this?
    I have an arduino uno and ESP-01. How do I wire these up?

    After doing some more reading looks like the esp-01 does not have enough pins. Dont think I can use it 😞


  • Mod

    @krajcl Does it only crash when sending this particular message?



  • @Yveaux I tried function (clear routing table) in MYSConroller. This is result:

    Client 0: 0;0;3;0;10;C
    Client 0: 6;0;3;0;10;C

    ctx: cont
    sp: 3ffeabe0 end: 3ffeaf20 offset: 01b0

    When I try this function for gateway, evrything works fine, but for other nodes - gateway resets


  • Mod

    @krajcl When this message is addressed to the gateway (0;0;3;0;10;C) it does not get sent over the air by the radio.
    When you send it to node 6 (6;0;3;0;10;C), it will send the message to the node, using the radio.

    Can you please answer this: Will it crash with just any message sent to the nodes using the radio, or only when sending internal messages to nodes (internal messages to nodes have the first value unequal to 0 and the third value set to 3, like 6;x;3;x;x;x) ?



  • @Yveaux it doesn't matter, what I send, resets every time


  • Mod

    @krajcl Ah, ok! That helps!
    For me, and a lot of other people on this forum, sending messages just works with the ESP.
    Maybe @rvendrame is pointing in the right direction? How are you powering the ESP?



  • Is it possible to set a fixed IP adress and bypass DHCP? My router sometimes messes up his DHCP-table and reassigns all adresses. Then I would have to correct the IP in my controller which I want to avoid.


  • Mod

    @Anduril The ESP8266 Arduino port uses the same API as the standard Arduino WiFi library.
    This means you should be able to use WiFi.config() to set a fixed IP address.

    Change the following line in Esp8266Gateway.ino

      (void)WiFi.begin(ssid, pass);
    

    into something like (untested!):

      IPAddress ip(192, 168, 0, 123);  /* Set to whatever IP address you'd like the gateway to have */
      WiFi.config(ip);
      (void)WiFi.begin(ssid, pass);
    

    Please report back your experience!



  • I got this working on an 0.9 version of the nodeMCU ( the Yellow board ). It has some code upload issues, which are slightly worse on OS X than Linux, but usually a couple of tries with holding down the button as @hek mentioned usually does the trick. I do not have any TCP/IP clients pointed at it currently, but I also get lots of watch dog timer resets, which seem somewhat random, as it will run and log messages for somewhere between 15 mins and 10 hours.

    It is just being powered by USB and I have not swapped NRF modules yet, so one of those may likely be the culprit, but just wanted to chime in with a (mostly) successful setup.

    thanx



  • Hello all,
    is there anybody setup MQTT gateway and it's working fine? how many node wifi gateway can handle?
    Could you please share me Wifi MQTT Gateway code.
    Thank you all and have a nice day


  • Mod

    @kimnguu204 said:

    is there anybody setup MQTT gateway and it's working fine?

    Currently there is no MQTT WiFi gateway, but it shouldn't be very hard to create one by combining the WiFi Gateway with the MQTT gateway.

    how many node wifi gateway can handle?

    The same as any other MySensors gateway (around 250).



  • I will report a successful first experience with MySensors using the esp8266 WiFi Gateway and a digital switch nRF24L01+ MySensors node.
    Thank you Yveaux and hek! nRF24L01+ nodes are the only way to go for battery power!
    I look forward to learning more about the MySensors architecture.
    I am currently using openHAB as my controller.

    For the MQTT library, I will vote for the https://github.com/Imroy/pubsubclient library if you decide to create a MQTT version of the WiFi Gateway. I have this library installed on 8 esp8266 nodes operating for over two months without any problems.

    The knolleary version has had some recent updates since I installed the lmroy version, so it may work fine with Mosquitto MQTT 3.1.1 instead of MQTT 3.1 only.



  • Hi Friends

    I am having an issue with my NRF24L01+. If I change gw.begin() to anything like below,

    gw.begin(incomingMessage, 0, true, 0);

    I get an error "radio init fail"

    And I am now trying ESP-8266 12E module along with nrf24L01+ (genuine) transceiver to built wifi gateway, which I'll later use as gateway for openhab. I am having a similar issue, Here is the log I get through serial monitor.

    **Connecting to Ahmed
    ...........Connected!
    IP: 192.168.0.31
    0;0;3;0;9;radio init fail

    ctx: cont
    sp: 3ffebdf0 end: 3ffec010 offset: 01b0

    stack>>>
    3ffebfa0: 0000007f 3ffec03c 40201cac 3ffeaff0
    3ffebfb0: 40202320 00000001 00000000 40201d4f
    3ffebfc0: 1f00a8c0 00ffffff 0100a8c0 3ffec03c
    3ffebfd0: 3ffe9328 3ffead34 3ffec070 402026ef
    3ffebfe0: 3ffe98a8 1f00a8c0 00000000 00000000
    3ffebff0: 3fffdc20 00000000 3ffec034 40201d1f
    3ffec000: 00000000 00000000 3ffeaff0 40100398
    <<<stack<<<

    ets Jan 8 2013,rst cause:1, boot mode:(3,3)

    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld**

    This information runs in a loop again and again. I am using latest library from https://github.com/mysensors/Arduino/tree/master without editing the sample Esp8266Gateway sktech except user name and password. I have followed the connection instruction specified in sample sketch and sketch was successfully uploaded. I am using 101nf capacitors and 10K resistances as specified by https://www.youtube.com/watch?v=JA-0hs5rpMY.
    Everything is working fine except that error. May anyone help me out?


  • Mod

    @vickey the resets you're experiencing are caused by the failure to init the radio. This will cause the MySensors library to enter an endless loop. This will cause the watchdog to trigger and reset the ESP.
    Please try connecting the radio exactly as stated on the MySensors build page (when using NodeMcu hardware) or connect the same way as I did (see first post in this topic).
    Double check your radio connections.



  • I have checked all the wires and every thing is according to as par advised. I am using 2 separate 3.3 v voltage regulator to power up ESP-8266 12E and nrf24L01+ having common ground, using ESP-8266 breakout board without voltage regulator and nrf24l01+ breakout board with 3.3 v regulator powered by 5v supply.

    GPIO15 connected via 10K pulldown resistor to GND and also connected with CSN of nrf24l016, is this connection correct?

    Moreover, I am using USB to TTL adapter in place of FTDI and TX of ESP-8266 is connected with RX of TTL serial adapter and vice versa, GND of TTL serial adapter is also connected common GND. It's all the difference from your mentioned procedure.


  • Mod

    @vickey could the nrf24 be defective?
    Did you obtain the gateway & MySensors code from my github repository or from MySensors repository?



  • Sorry When I investigate the wiring throughly, MOSI and MISO was interchanged. Now it has started working but error has changed

    ESP8266 MySensors Gateway
    Connecting to Ahmed
    .......Connected!
    IP: 192.168.0.31
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
    0;0;3;0;9;ver mismatch
    0;0;3;0;9;read: 0-0-0 s=0,c=0,t=0,pt=0,l=0,sg=0:
    0;0;3;0;9;ver mismatch

    I obtained the code for gateway & MySensors from MySensors repository on github.
    what would be the problem now?



  • I would like to use this tutorial for MySensors in the openHAB program:
    http://forum.mysensors.org/topic/1194/tutorial-openhab-with-serial-gateway

    I have the ESP8266 WiFi gateway working over a telnet session in Putty.

    Is there a way to have openHAB communicate over telnet like a hardwired serial interface?

    Has anyone used this yet?
    https://github.com/openhab/openhab/pull/2832


  • Mod

    @ridge sorry, can't help with that. Everything's MQTT over here 🙂



  • Thanks! Are you using this gateway with a controller or is it a proof of concept?

    It is fun to watch the states respond in a telnet session. I am having trouble finding any mention on how to use this with a controller.


  • Mod

    @ridge its use should be no different then when using the Ethernet gateway (because it is an Ethernet gateway 🙂 )
    I'm using it with OpenHab through MQTT and NodeRed through MQTT.



  • Is your setup using this gateway like:

    MySensors network <=>Gateway <=> Format conversion program <=> MQTT broker <=> openHAB

    For some reason, I had assumed that the results of the gateway could be used directly in openHAB.


  • Admin



  • Thanks hek, OpenHAB 1.7.1 is stable for me. I will probably wait for openHAB 2.0 to get closer to production status before wading in.

    I understand serial binding.
    I understand MQTT binding.

    I am missing something stupid easy in understanding ethernet binding.
    Do I include the http binding in the addons folder?

    A serial connected device is defined in an openHAB items file like:
    Switch HardwareButton "Bell" (Entrance) { serial="/dev/ttyS0" }

    I just cannot find an example of what an ethernet connected device would use in place of the "serial" definition.


  • Mod

    @ridge said:

    Is your setup using this gateway like:

    MySensors network <=>Gateway <=> Format conversion program <=> MQTT broker <=> openHAB

    Yes. Production gateway is currently (cabled) ethernet gateway, "Format conversion program" is this perl script and MQTT broker is Mosquitto.
    Perl script, Mosquitto and OpenHab run on Ubuntu 12.04LTS server PC.


  • Admin

    @ridge

    You could always use ser2net to emulate a serial port connected to the ethernet gateway from you openhab box.



  • Thank you hek and Yveaux. I thought I had missed something obvious. For the present with openHAB 1.7.1, a small piece of the wireless sensor data super highway of the future is still under construction! In that case I will certainly study the MySensors gateway to MQTT broker examples closely.



  • Hello guys,

    I am having issues with this installation. I got everything up and running but it simply doesn't connect to my WiFi Netgear router at home.

    I just enabled my hotspot on my cell phone and the gateway did connect successfully and started the gateway master with IP, etc assigned.

    When I try to connect to my home WiFi it just keeps on printing dot dot dot in the serial console.

    My Netgear has two networks with 2.4Ghz and 5Ghz. I tried both and none of them worked. They are configured with WPA2-PSK [AES] encryption for the passphrase and the passphrase has one special character included. The SSID is 5 characters long and the passphrase is 22 characters long which shouldn't be an issue.

    I don't get any error messages in the serial console and my router doesn't show anything in the logs either like the ESP gateway doesn't even try to connect. I don't know how to troubleshoot this from here.

    Any help would be appreciated.


  • Admin

    I also have both 5/2.4Ghz on my router.

    When ESP connects is seems to prefer 2,4 GHz / n / WPA2 if that helps.



  • This is what I have. 2,4 GHz / n / WPA2 (no TKIP but AES instead so I can go beyond 54Mbit) and it doesn't connect. Just dots coming up.


  • Mod

    @Pseudomizer Esp8266 is 2.4ghz only.
    You could try adding the following line just after hw_init() in the sketch:

    Serial.setDebugOutput(true);
    

    It will dump a lot of ESP WiFi related data, please post the output here. Maybe some will give a hint of what goes wrong.



  • Thanks a lot for this. This helped me troubleshoot the problem and I am surprised why it didn't connect. It couldn't find my SSID name because in the router it is all UPPER case but when I write it on any other machine Windows, Linux, etc to connect to, I always write it lower case with the exception of the first character.

    In this case I modified the sketch to have the SSID name all in UPPER case and voila it connected.

    Thanks again for the help here. Much appreciated.



  • I was very happy when it connected but now it is resetting itself constantly with this error message:

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld

    Any ideas why?



  • I missed one line of error code above:

    ets Jan 8 2013,rst cause:4, boot mode:(3,6)



  • I tried my Home Wifi and my Cell Hotspot. The crashes occur on both wifi networks. 😞



  • @Pseudomizer , Is the esp8266 on a breadboard or is it part of a commercial product like HUZZAH or nodemcu ? I ask because the esp devices can reset themselves from a brownout condition during the WiFi transmit if the power supply circuit is not up to handling the momentary 'high current draw' requirements of the radio. From reading www.esp8266.com, breadboard circuits have caused many hours of troubleshooting enjoyment with the esp8266 parts.

    I replace the battery packs on these with 2 Amp cell phone charger power supplies. I have 8 under power 24/7 for months with no problems. They are available from multiple vendors.
    http://www.aliexpress.com/item/Free-shipping-ESP8266-ESP-12-serial-WIFI-Industrial-stable-version-A-full-test-board-Full-IO/32260095422.html?spm=2114.01020208.3.49.0YGvDs&ws_ab_test=201556_7,201527_4_3_2_1_4_71_72_73_74_75,0_0



  • I followed the instructions exactly as shown here and I purchased that exact equipment.

    http://www.mysensors.org/build/esp8266_gateway

    nodemcu.jpg

    I even powered the NRF24L01+ from a different power source just to make sure that power fluctuation is not the issue but it didn't make any difference.

    I even tried transfer rates 115k, 57k and 9600 Baud but none of that made any difference either.

    I also downloaded the flash eeprom ino program to clear all the data but again, no difference.



  • I even reflashed the ESP8266 with those instructions and then loaded the mysensors ino but still the same outcome. 😞

    http://benlo.com/esp8266/esp8266QuickStart.html


  • Mod

    @Pseudomizer did you make any changes to the gateway sketch out the MySensors library/config?
    Could you post the output of the gateway just before the crash occurs (it might give an indication of where this crash occurs)



  • The only changes to the sketch are the SSID, the pass and the debug line

    Serial.setDebugOutput(true);

    as instructed. No other changes were made.

    Here the the debug output....you will see multiple resets in a row based on the internal watchdog timer.

    ESP8266 MySensors Gateway
    Connecting to MYWIFI
    scandone
    f 0, scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt

    connected with MYWIFI, channel 6
    dhcp client start...
    ......ip:192.168.1.222,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.222

    ets Jan 8 2013,rst cause:4, boot mode:(3,6)

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld

    ESP8266 MySensors Gateway
    Connecting to MYWIFI
    scandone
    f 0, scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt

    connected with MYWIFI, channel 6
    dhcp client start...
    .......ip:192.168.1.222,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.222

    ets Jan 8 2013,rst cause:4, boot mode:(3,6)

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld

    ESP8266 MySensors Gateway
    Connecting to MYWIFI
    scandone
    f 0, scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt

    connected with MYWIFI, channel 6
    dhcp client start...
    ......ip:192.168.1.222,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.222


  • Admin

    Triple-check your radio wiring.


  • Mod

    @hek said:

    Triple-check your radio wiring.

    Or try with a different radio. The crash seems to happen in the radio init part.



  • I just replaced the NRF with a new NRF and then again as I have 4 total. With every single one the same error.

    The wiring matches exactly the picture from mysensors.

    This is driving me crazy...



  • Hi, I tried the bridge with a rfm69hw module. It starts all well but does not receive any information. Neither shows startup information module .
    Where to put the DIO0 . I tried on several pins ( changing IRQ number) but no thoughts about doing anything.


  • Mod

    @miguelingles I didn't test with a rfm69hw module and I'm not aware of anybody else testing with this setup.
    Probably you have to test step by step what work and what not.
    Start with the radio initialization to see if the communication is ok, and go on from there.


  • Mod

    @Pseudomizer past few days @hek and I have been working on better diagnosis for the ESP8266 regarding radio communication failures.
    Please try if the version of MySensors development helps in diagnosing your problems.
    Make sure to uncomment the line

    //#define MY_DEBUG_VERBOSE
    

    in MyConfig.h and make the same changes to ssid & password as you did before.
    This version will dump diagnostics of NRF communications and a full register dump when starting up.
    Good luck!



  • Thanks a lot. This version provides much more details but at this stage of my learning progress I am not able to understand all those registers where I have to rely on your help guys. I assume that my password is not being exposed here.

    ESP8266 MySensors Gateway
    Connecting to ZEUS
    scandone
    f 0, scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt

    connected with ZEUS, channel 6
    dhcp client start...
    ......ip:192.168.1.222,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.222
    write_register(0x04,0x5F)
    write_register(0x06,0x23)
    write_register(0x06,0x03)
    write_register(0x00,0x0E)
    write_register(0x07,0x70)
    write_register(0x05,0x4C)
    write_register(0x00,0x0E)
    STATUS 0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1 0x0E0E0E0E0E 0707070707
    RX_ADDR_P2-5 0xFF C4 C5 C6
    TX_ADDR 0x0E0E0E0E0E
    RX_PW_P0-6 0x00 00 20 00 00 00
    EN_AA 0x3B
    EN_RXADDR 0x07
    RF_CH 0x4C
    RF_SETUP 0x03
    CONFIG 0x0E
    DYNPD/FEATURE 0x3F 06
    Data Rate 1MBPS
    Model nRF24L01+
    CRC Length 16 bits
    PA Power PA_LOW
    write_register(0x01,0x3F)
    write_register(0x01,0x3B)
    write_register(0x1D,0x06)
    FEATURE=0x06
    write_register(0x1C,0x3F)
    write_register(0x05,0x4C)
    write_register(0x06,0x0
    ets Jan 8 2013,rst cause:4, boot mode:(3,7)

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld

    ESP8266 MySensors Gateway
    Connecting to ZEUS
    scandone
    f 0, scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt

    connected with ZEUS, channel 6
    dhcp client start...
    ......ip:192.168.1.222,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.222
    write_register(0x04,0x5F)
    write_register(0x06,0x23)
    write_register(0x06,0x03)
    write_register(0x00,0x0E)
    write_register(0x07,0x70)
    write_register(0x05,0x4C)
    write_register(0x00,0x0E)
    STATUS 0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1 0x0E0E0E0E0E 0707070707
    RX_ADDR_P2-5 0xFF C4 C5 C6
    TX_ADDR 0x0E0E0E0E0E
    RX_PW_P0-6 0x00 00 20 00 00 00
    EN_AA 0x3B
    EN_RXADDR 0x07
    RF_CH 0x4C
    RF_SETUP 0x03
    CONFIG 0x0E
    DYNPD/FEATURE 0x3F 06
    Data Rate 1MBPS
    Model nRF24L01+
    CRC Length 16 bits
    PA Power PA_LOW
    write_register(0x01,0x3F)
    write_register(0x01,0x3B)
    write_register(0x1D,0x06)
    FEATURE=0x06
    write_register(0x1C,0x3F)
    write_register(0x05,0x4C)
    write_register(0x06,0x0
    ets Jan 8 2013,rst cause:4, boot mode:(3,7)

    wdt reset
    load 0x4010f000, len 1264, room 16
    tail 0
    chksum 0x42
    csum 0x42
    ~ld


  • Mod

    @Pseudomizer just had a quick look at your results. Radio config (and this communication) seem to be OK, but it restarts due to watchdog timeout.
    Hopefully tonight I can have a better look.



  • when I put the development package I can not compile anything (all gives me error). I tried it with a clean install and nothing.
    I think the problem is the IRQ pin DIØØ , if the ESP cpu does not recognize this interruption when the RF module receives data is unable to apply for the request .


  • Mod

    @miguelingles said:

    I think the problem is the IRQ pin DIØØ , if the ESP cpu does not recognize this interruption when the RF module receives data is unable to apply for the request .

    The irq pin from the nrf24 stays unconnected, like the build instructions clearly state!



  • but RF69 need irq.


  • Mod

    @miguelingles didn't know you were talking about rf69... Sorry but I cannot keep track of what everyone is using.


  • Mod

    For everyone wondering what serial output during startup of the ESP8266-NRF24 gateway should look like (all captures taken using link development branch from Oct 6, 2015 (hek just merged gateway-refactoring this morning, so output might have slightly changed)) .

    WiFi startup comes first after reset, followed by MySensors (nRF24) startup:

    • WiFi startup (not using Serial.setDebugOutput(true) )
    ESP8266 MySensors Gateway
    Connecting to YOUR_SSID
    ...........Connected!
    IP: 192.168.1.101
    
    • WiFi startup (using Serial.setDebugOutput(true) )
    ESP8266 MySensors Gateway
    Connecting to YOUR_SSID
    scandone
    f 0, ....scandone
    .add 0
    aid 10
    pm open phy_2,type:2 0 0
    cnt 
    
    connected with YOUR_SSID, channel 1
    dhcp client start...
    .....ip:192.168.1.101,mask:255.255.255.0,gw:192.168.1.1
    .Connected!
    IP: 192.168.1.101
    
    • MySensors startup (not using DEBUG and MY_DEBUG_VERBOSE)
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    
    • MySensors startup (using DEBUG and MY_DEBUG_VERBOSE)
    write_register(0x04,0x5F)
    write_register(0x06,0x27)
    write_register(0x06,0x07)
    write_register(0x00,0x0C)
    write_register(0x07,0x70)
    write_register(0x05,0x4C)
    write_register(0x00,0x0E)
    write_register(0x00,0x0E)
    STATUS		0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	0x0E0E0E0E0E 0303030303 
    RX_ADDR_P2-5	0xC3 C4 C5 C6 
    TX_ADDR		0x0E0E0E0E0E 
    RX_PW_P0-6	0x00 00 00 00 00 00 
    EN_AA		0x3F 
    EN_RXADDR	0x03 
    RF_CH		0x4C 
    RF_SETUP	0x07 
    CONFIG		0x0E 
    DYNPD/FEATURE	0x00 00 
    Data Rate	1MBPS
    Model		nRF24L01+
    CRC Length	16 bits
    PA Power	PA_MAX
    write_register(0x01,0x3F)
    write_register(0x01,0x3B)
    write_register(0x1D,0x06)
    FEATURE=0x06
    write_register(0x1C,0x03)
    write_register(0x05,0x4C)
    write_register(0x06,0x03)
    write_register(0x06,0x23)
    write_register(0x04,0x5F)
    write_register(0x00,0x0E)
    write_register(0x1D,0x06)
    FEATURE=0x06
    write_register(0x1C,0x3F)
    write_register(0x13,0x20)
    write_register(0x02,0x07)
    write_register(0x11,0x20)
    write_register(0x02,0x07)
    write_register(0x12,0x20)
    write_register(0x02,0x07)
    write_register(0x00,0x0F)
    write_register(0x07,0x70)
    write_register(0x02,0x06)
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    

  • Mod

    @Pseudomizer Had a better look at your crashdump.
    Your ESP seems to crash with a watchdog timeout when MySensors is setting the datarate (or shortly after that) after nRF24 has been initialized.
    Default datarate is RF24_250KBPS.

    Some questions, trying to rule things out:

    • Do you use this default datarate?
    • Could it be that you have an nRF24L01+ clone, which in reality is a nRF24L01 (clone)?
    • Did you ever try and succeed to connect these radios to a regular Arduino?
    • Are all radio's from the same batch/order?


  • I tried multiple different data rates when I created the ethernet gateway from mysensors. It didn't work at all in terms of connecting the sensors to the gateway while the gateway was visible in Vera until I made them all the same data rate. If I recall correctly I got them working with both at 250kpbs or 1Mbps.

    Since I tried to build the wifi gateway I haven't checked the data rates. I am going to check this next.

    In regards to your other questions:
    I purchased 4 radios from Amazon:
    http://www.amazon.com/nRF24L01-Wireless-Transceiver-Arduino-Compatible/dp/B00E594ZX0/ref=cm_cr_pr_product_top?ie=UTF8

    Yes, those radios work totally fine with the ethernet gateway from mysensors and I had two sensors attached. My goal is to have a wireless gateway so I can place it anywhere in the house and your great work would enable me to do so. 😉



  • Thinking about the data rate... at the moment I don't have any other sensors powered on at all which means I am just installing the wifi gateway. There should be no mismatch in the data rates unless I would have at least one sensor with a different data rate causing the issue. The Wifi gateway should boot up successfully without any client sensor.

    Is my thinking correct?



  • @Yveaux said:

    y but I

    it,s works !!!!! you have to do is remove the DIO0 while Bots and put it quickly . If not removed DIO0 not start.



  • I have done EXTENSIVE testing and I got it working now but I don't understand why.

    It seems like my MyConfig.h is broken which is the one which I copied over from your development package. I used one of my MyConfig.h files and the module boot was successfull and it did not crash anymore. It is stable and fully integrated into Vera with sensors now.

    I also tested the different data rates. I tested 250KBPS and 1MBPS and both work fine as long as I configure the gateway and the sensor clients with the same data rate. If I use different data rates between client and gateway, the gateway does NOT crash but the sensor clients simply don't connect.

    Now I have a working MyConfig.h and a broken MyConfig.h. Here is the WORKING MyConfig.h file.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     */
    
    
    #ifndef MyConfig_h
    #define MyConfig_h
    #include <stdint.h>
    
    // Enable debug flag for debug prints. This will add a lot to the size of the final sketch but good
    // to see what is actually is happening when developing
    //#define DEBUG
    //#define MY_DEBUG_VERBOSE
    
    // Disable this line, If you are using TX(1), RX(0) as normal I/O pin
    #define ENABLED_SERIAL
    
    // Serial output baud rate (for debug prints and serial gateway)
    #define BAUD_RATE 115200
    
    
    /**********************************
    *  Over the air firmware updates
    ***********************************/
    
    // The following define enables the safe over-the-air firmware update feature
    // which requires external flash and the DualOptiBoot bootloader.
    // Note: You can still have OTA FW updates without external flash but it
    // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
    //#define MY_OTA_FIRMWARE_FEATURE
    // Slave select pin for external flash
    #define MY_OTA_FLASH_SS 8
    // Flash jdecid
    #define MY_OTA_FLASH_JDECID 0x1F65
    
    
    /**********************************
    *  Information LEDs blinking
    ***********************************/
    // This feature enables LEDs blinking on message receive, transmit
    // or if some error occured. This was commonly used only in gateways,
    // but now can be used in any sensor node. Also the LEDs can now be
    // disabled in the gateway.
    
    // #define WITH_LEDS_BLINKING
    
    // The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING
    // When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
    // off when blinking
    
    //#define WITH_LEDS_BLINKING_INVERSE
    
    
    // default LEDs blinking period in milliseconds
    #define DEFAULT_LED_BLINK_PERIOD 300
    // The RX LED default pin
    #define DEFAULT_RX_LED_PIN 6
    // The TX LED default pin
    #define DEFAULT_TX_LED_PIN 5
    // The Error LED default pin
    #define DEFAULT_ERR_LED_PIN 4
    
    
    /**********************************
    *  Message Signing Settings
    ***********************************/
    // Disable to completly disable signing functionality in library
    //#define MY_SIGNING_FEATURE
    
    // Define a suitable timeout for a signature verification session
    // Consider the turnaround from a nonce being generated to a signed message being received
    // which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
    #define MY_VERIFICATION_TIMEOUT_MS 5000
    
    // Enable to turn on whitelisting
    // When enabled, a signing node will salt the signature with it's unique signature and nodeId.
    // The verifying node will look up the sender in a local table of trusted nodes and
    // do the corresponding salting in order to verify the signature.
    // For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
    // nodes have to implement whitelisting for this to work.
    // Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
    // to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
    // for the sender in it's whitelist)
    //#define MY_SECURE_NODE_WHITELISTING
    
    // MySigningAtsha204 default setting
    #define MY_ATSHA204_PIN 17 // A3 - pin where ATSHA204 is attached
    
    // MySigningAtsha204Soft default settings
    #define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
    
    // Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
    #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    
    /**********************************
    *  NRF24L01 Driver Defaults
    ***********************************/
    #define RF24_CE_PIN		   9
    #define RF24_CS_PIN		   10
    #define RF24_PA_LEVEL 	   RF24_PA_MAX
    #define RF24_PA_LEVEL_GW   RF24_PA_LOW
    // RF channel for the sensor net, 0-127
    #define RF24_CHANNEL	   76
    //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
    //#define RF24_DATARATE 	   RF24_1MBPS
    #define RF24_DATARATE 	   RF24_250KBPS
    // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
    #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
    
    // Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
    //#define SOFTSPI
    #ifdef SOFTSPI
    	// Define the soft SPI pins used for NRF radio
    	const uint8_t SOFT_SPI_MISO_PIN = 16;
        const uint8_t SOFT_SPI_MOSI_PIN = 15;
        const uint8_t SOFT_SPI_SCK_PIN = 14;
    #endif
    
    
    /**********************************
    *  RFM69 Driver Defaults
    ***********************************/
    // Default network id. Use the same for all nodes that will talk to each other
    #define RFM69_NETWORKID     100
    
    // Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
    // #define RFM69_FREQUENCY   RF69_433MHZ
    #define RFM69_FREQUENCY   RF69_868MHZ
    //#define FREQUENCY     RF69_915MHZ
    
    // Enable this for encryption of packets
    //#define RFM69_ENABLE_ENCRYPTION
    #define RFM69_ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
    
    
    
    
    #endif
    
    

    And here is the NON WORKING MyConfig.h file.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     */
    
    
    #ifndef MyConfig_h
    #define MyConfig_h
    #include <stdint.h>
    
    // Enable debug flag for debug prints. This will add a lot to the size of the final sketch but good
    // to see what is actually is happening when developing
    #define DEBUG
    
    // Enable MY_DEBUG_VERBOSE flag for verbose debug prints. Requires DEBUG to be enabled.
    // This will add even more to the size of the final sketch!
    #define MY_DEBUG_VERBOSE
    
    // Disable this line, If you are using TX(1), RX(0) as normal I/O pin
    #define ENABLED_SERIAL
    
    // Serial output baud rate (for debug prints and serial gateway)
    #define BAUD_RATE 115200
    
    
    /**********************************
    *  Over the air firmware updates
    ***********************************/
    
    // The following define enables the safe over-the-air firmware update feature
    // which requires external flash and the DualOptiBoot bootloader.
    // Note: You can still have OTA FW updates without external flash but it
    // requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
    //#define MY_OTA_FIRMWARE_FEATURE
    // Slave select pin for external flash
    #define MY_OTA_FLASH_SS 8
    // Flash jdecid
    #define MY_OTA_FLASH_JDECID 0x1F65
    
    
    /**********************************
    *  Information LEDs blinking
    ***********************************/
    // This feature enables LEDs blinking on message receive, transmit
    // or if some error occured. This was commonly used only in gateways,
    // but now can be used in any sensor node. Also the LEDs can now be
    // disabled in the gateway.
    
    #define WITH_LEDS_BLINKING
    
    // The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING
    // When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
    // off when blinking
    
    //#define WITH_LEDS_BLINKING_INVERSE
    
    
    // default LEDs blinking period in milliseconds
    #define DEFAULT_LED_BLINK_PERIOD 300
    // The RX LED default pin
    #define DEFAULT_RX_LED_PIN 6
    // The TX LED default pin
    #define DEFAULT_TX_LED_PIN 5
    // The Error LED default pin
    #define DEFAULT_ERR_LED_PIN 4
    
    
    /**********************************
    *  Message Signing Settings
    ***********************************/
    // Disable to completly disable signing functionality in library
    //#define MY_SIGNING_FEATURE
    
    // Define a suitable timeout for a signature verification session
    // Consider the turnaround from a nonce being generated to a signed message being received
    // which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
    #define MY_VERIFICATION_TIMEOUT_MS 5000
    
    // Enable to turn on whitelisting
    // When enabled, a signing node will salt the signature with it's unique signature and nodeId.
    // The verifying node will look up the sender in a local table of trusted nodes and
    // do the corresponding salting in order to verify the signature.
    // For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
    // nodes have to implement whitelisting for this to work.
    // Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
    // to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
    // for the sender in it's whitelist)
    //#define MY_SECURE_NODE_WHITELISTING
    
    // MySigningAtsha204 default setting
    #define MY_ATSHA204_PIN 17 // A3 - pin where ATSHA204 is attached
    
    // MySigningAtsha204Soft default settings
    #define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
    
    // Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
    #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    
    /**********************************
    *  NRF24L01 Driver Defaults
    ***********************************/
    #define RF24_CE_PIN		   9
    #define RF24_CS_PIN		   10
    #define RF24_PA_LEVEL 	   RF24_PA_MAX
    #define RF24_PA_LEVEL_GW   RF24_PA_LOW
    // RF channel for the sensor net, 0-127
    #define RF24_CHANNEL	   76
    //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
    #define RF24_DATARATE 	   RF24_250KBPS
    // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
    #define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
    
    // Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
    //#define SOFTSPI
    #ifdef SOFTSPI
    	// Define the soft SPI pins used for NRF radio
    	const uint8_t SOFT_SPI_MISO_PIN = 16;
        const uint8_t SOFT_SPI_MOSI_PIN = 15;
        const uint8_t SOFT_SPI_SCK_PIN = 14;
    #endif
    
    
    /**********************************
    *  RFM69 Driver Defaults
    ***********************************/
    // Default network id. Use the same for all nodes that will talk to each other
    #define RFM69_NETWORKID     100
    
    // Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
    // #define RFM69_FREQUENCY   RF69_433MHZ
    #define RFM69_FREQUENCY   RF69_868MHZ
    //#define FREQUENCY     RF69_915MHZ
    
    // Enable this for encryption of packets
    //#define RFM69_ENABLE_ENCRYPTION
    #define RFM69_ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
    
    #endif
    

    I don't understand why the second one makes the module reboot constantly. However, I am happy now that it is working but I wanted to share my experience and maybe it can help others to troubleshoot this and understand why this was happening as I am sure I will not be the only one having that issue in the future.

    I do appreciate all the help so far and I wouldn't have been able to solve it without your help Yveaux. THANK YOU!!!


  • Admin

    You cannot mix MyConfig.h between branches.

    In the development brach all MySensors related defines has the prefix "MY_".



  • Hi, if it possible to show a sketch with an ESP8266 WIFI => MQTT gateway? I figure out, that the received sensor data will automatic publish to my MQTT Server running on my Raspi. Then i can install this pice of wonderfull work in every room from my house 🙂


  • Admin

    I created a simple ESP-MQTT sketch a while ago. I've only done some simple tests using it. Feedback appreciated.

    https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino



  • @hek Very nice! the code are magic 🙂 Very nice solution, i'll test this next days.

    ...
    #include <ESP8266WiFi.h>
    #include <MySensor.h>
    
    void setup() { 
    }
    
    void presentation() {
      // Present locally attached sensors here    
    }
    
    
    void loop() {
      // Send locally attech sensors data here
    }
    

  • Hardware Contributor

    @hek said:

    I created a simple ESP-MQTT sketch a while ago. I've only done some simple tests using it. Feedback appreciated.

    https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino

    Testing the above sket from the development branch with a new sensbender micro I get:
    mygateway/255/255/3/0/3 (null) on MQTT

    This is an id request. I answer this request with
    mosquitto_pub -h ds -t "mygateway/255/255/3/0/4" -m 8
    which should set the ID 8 on the sensbender micro in my undestanding. I can see the message in the serial terminal on the ESP-8266 but the message doesn't arrive at the sensbender micro.

    Is my message to set the id correct?


  • Admin

    Yes, the response message looks ok. But I must confess that I haven't verified the MQTT gateway much yet. Probably something I've missed (=bug).

    Do you have the possibility to to see where the message ends up or being thrown away (debug-print-debugging is awesome, yes I know...) in the MQTT gateway?

    Or wait a few days until I've had time to look at it.


  • Hardware Contributor

    @hek said:

    ...
    Do you have the possibility to to see where the message ends up or being thrown away (debug-print-debugging is awesome, yes I know...) in the MQTT gateway?
    ...
    There seems to be a bug in incomingMQTT:
    replace
    for (str = strtok_r(topic, "/", &p); str && i < 5;
    with
    for (str = strtok_r(topic, "/", &p); str && i <= 5;

    or it will never send a message.

    There seems to be another problem:
    0;0;3;0;9;send: 0-0-0-255 s=255,c=3,t=4,pt=0,l=1,sg=0,st=fail:8

    Why is the payload in st=fail?

    The messages sent to MQTT seem to make a merry go round and come back.... 🙂


  • Admin

    @FotoFieber said:

    Why is the payload in st=fail?

    The payload (8) seems correct. Gateway just never received any ack from node... which is fine for broadcast messages (to node 255) such as this.

    The messages sent to MQTT seem to make a merry go round and come back....

    Ok, like you suspected earlier? So we need to subscribe to something else than we publish to then...


  • Hardware Contributor

    @hek
    Loaded the ethernet ESP-8266 gateway and entered with telnet:
    255;255;3;0;4;8

    It is working as it should. Now I have assigned the id 8.

    Tried to solve the merry go round but it didn't help. Now I let the stage to the pros.. 🙂



  • Do you think we can use this board with MySensors (with NRF24 or RFM69) ?
    https://github.com/hallard/NodeMCU-Gateway



  • Hi,

    If I want to use the GatewayESP8266MQTTClient sketch located in the development branch do I also need to use the mysensors libraries in that branch?

    Thank you,

    Mike


  • Admin



  • @hek Thanks for the code. I have few questions in my mind. Firstly do I just have to upload this ESP8266MQTTClient.ino sketch on esp8266 12-E model? or does it needs anything to add in the sketch except SSID and password? I want to use ESP-8266-E and NRF24L01+ as gateway for openhab. If it is possible then, do I have to adopt the same procedure for configuring openhab as ethernet gateway? Secondly, Can I make two gateways using this sketch, is this possible? As I want to add sensors which are 500 meters away at my farmhouse.



  • This is a bit off topic, but hopefully not too off 😉
    What about a port of the MySensors library /API to ESP8266 ? Instead of two "boards" (Arduino nano plus nRF24L01+) only one would be required. For simple sensors an ESP-01 would be sufficient - about the size of a nRF24, but with much more muscle than an Arduino. Of course, running off a battery probably would not work because of the high power consumption of the ESP.

    Or am I asking for something which is already possible ?

    Josh


  • Admin

    @vickey said:

    @hek Thanks for the code. I have few questions in my mind. Firstly do I just have to upload this ESP8266MQTTClient.ino sketch on esp8266 12-E model?

    Yes

    or does it needs anything to add in the sketch except SSID and password?

    Entering SSID/PW should be enough.

    I want to use ESP-8266-E and NRF24L01+ as gateway for openhab. If it is possible then, do I have to adopt the same procedure for configuring openhab as ethernet gateway?

    I'm not an expert on openhab.. so I'll let someone else answer this one. But the ESP variant behaves exactly like the W5100 version.

    Secondly, Can I make two gateways using this sketch, is this possible? As I want to add sensors which are 500 meters away at my farmhouse.

    If openhab supports multiple gateways, sure. But you might wanna run sensor networks on different frequencies or changing MY_RF24_BASE_RADIO_ID.

    @joshmosh

    Or am I asking for something which is already possible ?

    Yes, the code runs directly on the ESP8266.



  • @hek
    that's good news, thank you ! Now the most expensive part will be the power supply 😉

    Cheers
    Josh



  • @hek I have installed GatewayESP8266MQTTClient sketch on my ESP-8266 12E.
    Here is sketch I am using

    #include <EEPROM.h>
    #include <SPI.h>
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 9600
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_GATEWAY_MQTT_CLIENT
    
    // Set this nodes topic prefix
    #define MY_MQTT_TOPIC_PREFIX "mygateway"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-1"
    
    // Enable these if your MQTT broker requires usenrame/password
    //#define MY_MQTT_USER "admin"
    //#define MY_MQTT_PASSWORD "MyPassword"
    
    // Set WIFI SSID and password
    #define MY_ESP8266_SSID "Ahmed"
    #define MY_ESP8266_PASSWORD "MyPassword"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,0,31
    
    // If using static ip you need to define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
    #define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    
    // MQTT broker ip address.  
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 30
    
    // The MQTT broker port to to open 
    #define MY_PORT 1883      
    
     /*
    // Flash leds on rx/tx/err
    #define MY_LEDS_BLINKING_FEATURE
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // 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  3 
    
    #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 <ESP8266WiFi.h>
    #include <MySensor.h>
    
    void setup() { 
    }
    
    void presentation() {
      // Present locally attached sensors here    
    }
    
    
    void loop() {
      // Send locally attech sensors data here
    }
    

    Here is the debug

    0;0;3;0;9;Starting...
    scandone
    f 0, ....scandone
    state: 0 -> 2 (b0)
    .state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 1
    cnt 
    
    connected with Ahmed, channel 1
    ip:192.168.0.31,mask:255.255.255.0,gw:192.168.0.1
    .IP: 192.168.0.31
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;Attempting MQTT connection...
    

    And it keeps attempinng for MQTT connection.

    I have installed Domoticz on my RPi and added a hardware Mysensors Gateway with LAN interface with remote address i.e. 192.168.0.31 in my case and port 1883. Here is Domoticz log

    2015-10-17 12:50:26.675  Hardware Monitor: Fetching data (System sensors)
    2015-10-17 12:50:31.590  Error: MySensors: Error: Connection refused
    2015-10-17 12:50:31.590  Error: TCP: Error: Connection refused
    

    I don't have mosquitto installed in my Rpi.

    May someone suggest me any solution.



  • @hek
    Good morning. I had wired up my nodemcu a nRF24L01+, loaded the gateway sketch and bingo ! Zero problems, works like charm. Thanks a lot !!!

    I am using Domoticz as controller, with a serial USB gateway to connect my various sensors. In the serial console of the ESP8266 gateway I see that the messages of my sensors show up, but since I have not yet announced the gateway to Domoticz, there seems to be no interference. If I connect the ESP8266 gateway to a controller (in my case Domoticz), I guess that it will be required that the nodes need to choose the respective gateway (by using the parentNodeId) with which they like to communicate ? Currently, I am using parentNodeId = AUTO in all my nodes.
    I will do some testing to get an idea of the reach of my WiFi compared to the reach of my serial USB gateway (I have a nRF24L01+ with external antanna and booster in my gateway, so I am able to "see" a portable node even outside my house and 50 m away.

    Again, thank you for this very useful extension of MySensors. I think I have not yet an estimate of the full potential of it

    Cheers
    Josh



  • Hello,

    I also tried to build a WiFi gateway today.
    I get the following serial output when starting the gateway:

    ESP8266 MySensors Gateway
    Connecting to *************
    ...Connected!
    IP: 192.168.1.218
    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    

    Does this mean that everything is correct and I can integrate it into my FHEM solution?
    Currently I'm working with a serial gatway. Do I have to modify something in my sensors when I switch to the new gateway?


  • Mod

    @gloob said:

    I get the following serial output when starting the gateway:

    Looking good! Congrats!

    I have no experience using FHEM, but you should be able to use the WiFi gateway just like the regular ethernet gateway (as seen from FHEM).
    So look around on this forum for any posts regarding usage of FHEM & ethernet gateway and you should be good.


  • Mod

    @joshmosh You cannot have multiple gateways in a single MySensors network. The node-ID of the gateway is always hardcoded to 0.
    If you want to run multiple networks, each should have a unique RF24_CHANNEL & RF24_BASE_RADIO_ID combination. For best results make sure to have a separate RF24_CHANNEL for each network, and don't use directly adjacent channels.


  • Hardware Contributor

    Playing with AES signing and encryption I enabled verbose debug.

    #define MY_DEBUG_VERBOSE
    

    The sketch crashes with this setting but seems to work fine without verbose debug.

    Is this a problem of my setup or a problem in the code?

    The log pf the serial terminal:

    write_register(0x04,0x5F)
    write_register(0x06,0x27)
    write_register(0x06,0x07)
    write_register(0x00,0x0C)
    write_register(0x07,0x70)
    write_register(0x05,0x4C)
    write_register(0x00,0x0E)
    write_register(0x00,0x0E)
    STATUS		0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	0x0E0E0E0E0E 0303030303 
    RX_ADDR_P2-5	0xC3 C4 C5 C6 
    TX_ADDR		0x0E0E0E0E0E 
    RX_PW_P0-6	0x00 00 00 00 00 00 
    EN_AA		0x3F 
    EN_RXADDR	0x03 
    RF_CH		0x4C 
    RF_SETUP	0x07 
    CONFIG		0x0E 
    DYNPD/FEATURE	0x00 00 
    Data Rate	1MBPS
    Model		nRF24L01+
    CRC Length	16 bits
    PA Power	PA_MAX
    write_register(0x01,0x3F)
    write_register(0x01,0x3B)
    write_register(0x1D,0x06)
    FEATURE=0x06
    write_register(0x1C,0x03)
    write_regis
    

  • Mod

    @FotoFieber said:

    Is this a problem of my setup or a problem in the code?

    I'll opt for the first, but lets see:

    • What ESP hardware are you using?
    • Which Arduino/ESP8266 port/MySensors version are you using?
    • Did you define both DEBUG and MY_DEBUG_VERBOSE?
    • What did you do to 'Play with AES signing and encryption' ?
    • AES stuff is untested for ESP8266, however, you don't seen to get that far as it crashes during startup.
    • My startup log (see here ) shows what it shoes during startup with DEBUG and MY_DEBUG_VERBOSE enabled.

  • Hardware Contributor

    @Yveaux

    • ESP12E
    • Development Version
    • Defined both DEBUG AND VERBOSE
    • Playing with AES:
    #define MY_RF24_CHANNEL  13
    #define MY_RF24_BASE_RADIO_ID ((uint64_t)0xF8A813FC09CL)
    
    #define MY_RF24_ENABLE_ENCRYPTION
    #define MY_RF24_ENCRYPTKEY  secret....
    
    #define MY_SIGNING_SOFT // Software signing enabled
    
    #define MY_SIGNING_SOFT_SERIAL secret....
    // Key to use for HMAC calculation in soft signing (32 bytes)
    
    #define MY_SIGNING_SOFT_HMAC_KEY secret
    

    It seems to work perfect without the verbose debug.

    I will test now without AES. My gut tells me, I should look inside the AES stuff.



  • @Yveaux said:

    @joshmosh You cannot have multiple gateways in a single MySensors network. The node-ID of the gateway is always hardcoded to 0.
    If you want to run multiple networks, each should have a unique RF24_CHANNEL & RF24_BASE_RADIO_ID combination. For best results make sure to have a separate RF24_CHANNEL for each network, and don't use directly adjacent channels.

    @Yveaux
    Thank you for this piece of information - I was not aware of this fact.
    My idea was to reduce cost and parts count for sensors by using ESPs instead of nRF plus Arduino. Since I have Domoticz as controller, there is pehaps no need for an additional gateway, because Domoticz can handle TCP-attached sensors. Of course this would require to use WiFi instead of nRF24 as underlying transport for MySensors. My interpretation of some of hek's contributions is that he is working on it for realisation in version 1.6.


  • Hardware Contributor

    @Yveaux
    Downloaded the development branch again and used the sketch included as example. The sketch is hanging too. My gut was wrong, AES is not the problem.



  • Hi.
    I am having an issue with my ESP8266 gateway. I have tried all versions of mysensors including developmental versions, but my esp8266 does not show any serial debug, nor it gets connected to my router. I also enabled debug in configuration file. When I install AT firmware, it replies to AT command, it also works with nodemcu firmware, but it does not respond with Arduino firmware. May someone help me?



  • Finally I got my NodeMCU and tried the WiFi gateway too. But I get the following messages (with Serial.setDebugOutput(true);):

    ESP8266 MySensors Gateway
    Connecting to WLAN
    scandone
    f 0, ....scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt 
    ..................rm 0
    pm close 7 0 0/9299504
    ..reconnect
    f -240, ....scandone
    no WLAN found, reconnect after 1s
    .reconnect
    f 0, ....scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt 
    ................rm 0
    pm close 7 0 0/8288631
    ..reconnect
    f -240, ....scandone
    no WLAN found, reconnect after 1s
    .reconnect
    f 0, ....scandone
    .add 0
    aid 1
    pm open phy_2,type:2 0 0
    cnt 
    ................rm 0
    pm close 7 0 0/8124923
    ..reconnect
    
    

    Additionally I tried to use

      IPAddress ip(192, 168, 38, 18);  /* Set to whatever IP address you'd like the gateway to have */
      WiFi.config(ip);
    

    to avoid DHCP, but that gives error during compiling:

    no matching function for call to 'ESP8266WiFiClass::config(IPAddress&)'
    

    Any hints how to solve?

    Thanks

    Edit:
    to find the problem I tested to connect the ESP to the wifi-hotspot of my smartphone... worked. Is it maybe a problem if the password contain special characters which behave strange during compiling?


  • Mod

    @Anduril said:

    no WLAN found, reconnect after 1s

    That's a clear indication the ESP cannot connect to your WiFi accesspoint.
    Is the SSID matching your accesspoint ('WLAN')?
    Is the encryption supported by the ESP (see e.g. https://nurdspace.nl/ESP8266#Features -- not sure if it is accurate)
    Weird characters in the password could be problematic (and of course the password is case-sensitive).

    Changing between DHCP/Fixed IP won't make a difference here, as the ESP doesn't even connect. IP configuration starts once connected.



  • @Yveaux
    SSID is 'WLAN' (all capital). Encryption is WPA2 which should be supported. The password contains '|' (don't know the name, vertical line) and 'ß' (german character). I use them among other more common ones to raise the complexity of the encryption. As I am using a bunch of wifi devices I don't want to go around and change passwords for all if not absolutely necessary. Is there a way to specify these 'weird characters' e.g. by ASCII codes or anything else?

    Changing the IP was not to solve this problem but for future use, as my DHCP is not very good. Can you tell me how to fix IP else?


  • Mod

    @Anduril try to print your password to the serial console and see if it matches the password you entered in the sketch.



  • good idea @Yveaux, seems that 'ß' is the problem. serial.print shows ß at that position. Do you know how to avoid that?


  • Mod

    @Anduril probably Unicode problem of the editor. I assume you use the Arduino editor? Try a simple editor like notepad to type the problematic character, or directly type it in windows by setting your keyboard in numpad mode and type it's ascii code: alt+225


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts