ESP8266 WiFi gateway port for MySensors
-
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.
-
-
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.
-
@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.
-
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.
-
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.
-
@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
~ldAny 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
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.
-
@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
cntconnected 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.222ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ldESP8266 MySensors Gateway
Connecting to MYWIFI
scandone
f 0, scandone
.add 0
aid 1
pm open phy_2,type:2 0 0
cntconnected 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.222ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ldESP8266 MySensors Gateway
Connecting to MYWIFI
scandone
f 0, scandone
.add 0
aid 1
pm open phy_2,type:2 0 0
cntconnected 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
-
Triple-check your radio wiring.
-
@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.
-
@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.
-
@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
cntconnected 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
~ldESP8266 MySensors Gateway
Connecting to ZEUS
scandone
f 0, scandone
.add 0
aid 1
pm open phy_2,type:2 0 0
cntconnected 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
-
@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 .
-
@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.
-
@miguelingles didn't know you were talking about rf69... Sorry but I cannot keep track of what everyone is using.
-
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
-
@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=UTF8Yes, 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!!!
-
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
-
I created a simple ESP-MQTT sketch a while ago. I've only done some simple tests using it. Feedback appreciated.
-
@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 }
-
@hek said:
I created a simple ESP-MQTT sketch a while ago. I've only done some simple tests using it. Feedback appreciated.
Testing the above sket from the development branch with a new sensbender micro I get:
mygateway/255/255/3/0/3 (null) on MQTTThis 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?
-
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.
-
@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:8Why is the payload in st=fail?
The messages sent to MQTT seem to make a merry go round and come back....
-
@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...
-
@hek
Loaded the ethernet ESP-8266 gateway and entered with telnet:
255;255;3;0;4;8It 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
-
Yes
-
@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
-
@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.
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 supplyCheers
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?
-
@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.
-
@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.
-
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
-
@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.
-
- 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.
-
@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?
-
@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?
-
@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?
-
@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
-
@Yveaux tried with a nano to print out "ß" to serial, no problems. After that I tried that sketch on ESP:
void setup() { Serial.begin(115200); const char *pass = "ß1ß"; Serial.println(" "); //to break line after rubbish at init Serial.println(pass); }
[not readable/copyable stuff] ß1ß
So in general it should be no problem compiling the char 'ß' even on ESP.. Also in the ESPGateway sketch I don't see anything that is changing the *pass, but maybe you know what is going on with this string in more detail.
edit: it seems to happen even before void setup in the gw sketch. I uncommented everything in setup, loop and output, but still get the distorted serial print of pass.
-
@Anduril I guess it shouldn't make a difference. What happens if you copy/paste the "ß1ß" string from your test sketch into the ESP gateway sketch as password and print that to serial? (make sure to use the same editor on both sketches)
-
@Yveaux already tried that. When using my own sketch I get "ß1ß", when using the gw sketch (with really everything commented out, so no functionality) I get "ß1ß". I thought that it might be a problem of UFT encoding, had this issue with transfering LaTeX files created on linux system to windows system and vice versa: the system that creates the file sets the charset.
But I also created a completely new .ino with the gateway-code inside and new created gatewayutil.h with data copied in notepad++, but no succes.
And yes I use Arduino IDE as editor. Is there a good way to use another editor and compile/upload without the IDE?
-
@Anduril I'm still convinced it has something to do with Unicode, but very hard to nail from a distance without the actual files...
Maybe @hek has seen this before?
-
Nope, not the slightest idea.
@Anduril
Couldn't you just temporarily change password on router to rule out other stuff?
-
@hek yeah already did this, when leaving out ß it works perfect. So no problem with router or ESP hardware. But changing the wifi password would be the worst case, as I have to reassign that to squeezeboxes, smartphones, laptops, wifi printer,... (and all guest devices of friends/familie) but still possible if all other things fail.
@Yveaux Would it help if I send you the files for verification? Is it possible inside this forum or only via email?
-
@Yveaux thank you very much for offering help with verification, but something strange happened during preperation of files: I took an example sketch and modified it to print the "ß1ß" on serial --> working fine.
But after saving the file I tried again, only reading rubbish. Thats strange! So it has something to do with saving the file and maybe setting a special encoding. Maybe thats related to the editor? Could you please try to redo what I explained and see if you get the same results? Thank you. @hek have you ever had such a problem of a sketch behaving differently after saving?
-
@Anduril Ok, did some tests:
Copied your problematic example string from this topic into Arduino IDE (1.6.5), on Windows 10:
Saved the sketch.
Viewed sketch.ino in notepad:
Newlines are f*cked up, but "ß1ß" can clearly be recognized.Viewed the same sketch in HxD hex viewer:
And there we are! The string is stored as Unicode characters!
Reading it back in Arduino IDE:
Everything looks fine again.
Apparently the unicode string gets compiled directly and shows as multiple, wrong characters in your sketch when used/printed...
Ok, one more idea: you can try to store the ß character as an escaped ASCII character in you string (refer to this ).
This will look strange in the code, but should print correctly to the console:The ASCII escape sequence for ß is \xE1 Your test sequence "ß1ß" then becomes "\xE11\xE1"
Please try this...
-
@Yveaux
hi
there is problem for sensor library when we intend use the its examples as following
In file included from \libraries\MySensors\MyGateway.cpp:13:0:\libraries\MySensors\utility/MsTimer2.h:7:2: error: #error MsTimer2 library only works on AVR architecture
#error MsTimer2 library only works on AVR architecture
^
In file included from \libraries\MySensors\MyGateway.cpp:14:0:
\libraries\MySensors\utility/PinChangeInt.h:103:19: fatal error: new.h: No such file or directory
#include <new.h>
^
compilation terminated.
Error compiling.
-
@mkeyno did you change anything to the gateway code, and which version of MySensors are you running?
I've ported the gateway code to ESP8266. That doesn't mean any sensor code will also automatically run on an ESP.
Packaged with MySensors are a lot of libraries that will not compile on ESP, so if you try to use one (pinchange int or timers) it will likely fail to compile.
-
@Yveaux SUCCES!!! Thank you very much, your way worked nearly perfect. ONly small change: "ß" is represented by hexcode DF, so using \eDF gives the correct wifi password for me.
Now a last thing as bonus: how to setup a fixed ip and not using dhcp? My dhcp is not very usable as it reassigns all IPs on reboot (stupid firmware by Deutsche Telekom).
-
@Anduril Great to hear you got it to work!
how to setup a fixed ip and not using dhcp?
Google'd a bit. Seems like Wifi.config requires 3 parameters:
// static ip, gateway, netmask WiFi.config(IPAddress(192,168,1,100), IPAddress(192,168,1,1), IPAddress(255,255,255,0));
Make sure to call it after WiFi.begin().
Btw. ESP8266 Arduino port follows the Arduino WiFi library API.
-
You can set static ip in the dev-branch.
-
-
@Yveaux no buddy I used the last update of your repository, my question is , are you aware that your esp8266 sample sketch call library that wont work with esp architecture? I've compare last update with previous library and I've find the for couple of header file following code has been added
#ifdef AVR
#include <avr/interrupt.h>
#else
#error MsTimer2 library only works on AVR architecture
#endifand I was wondering why your sample sketch call such file into the compiling
-
Hi @Yveaux
could you please assist in the error.
ESP8266 MySensors Gateway Connecting to HoUsEoFcLoWnS scandone f 0, scandone .add 0 aid 5 pm open phy_2,type:2 0 0 cnt connected with HoUsEoFcLoWnS, channel 11 dhcp client start... .ip:192.168.0.23,mask:255.255.255.0,gw:192.168.0.1 .Connected! IP: 192.168.0.23 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
The gateway just keeps looping and connecting.
I'm using a NodeMCU with a NRF ( both from ebay),
Using the Regular library, and default sketch with SSID/pass updated.i tried checking the error "rst cause:4, boot mode:(3,7)" but wasn't able to find something.
I even tried to power it using a USB cellphone charger, but i was unable to telnet so that rules out the power issue
Thanks in advance
-
update,
the error changed to "rst cause:4, boot mode:(3,6)" once i added a capacitor.
-
@D_dude said:
These ESP's seem to walk in mysterious ways...
A lot of people have them, running without any issues (including myself and hek) and some people can't seem to get them to run stable.
On the net, a lot of stability/reset issues are are claimed to have a relation to power supply.I even tried to power it using a USB cellphone charger, but i was unable to telnet so that rules out the power issue
There are a lot of assumptions in this sentence
What current rating is the cellphone charger? I'd advise one with at least 1amps, and a stable output.
Not being able to telnet to the gateway can have more issues then just the ESP crashing...
-
@Yveaux
Thank you for the response.As for the cell phone charger, I'm using a tablet charger Specifically original HP stream 7 charger, and it is able to provide more that 1amp. I Will try to use other charger/power supply to see if that helps.
PS: I reloaded the gateway sketch and the error went back to boot mode (3,7) even with cap present.
-
@D_dude I searched the net for a description of reset causes and boot modes but failed to find one.
I have no clue of what they mean.
-
@Yveaux
thank you for your assistance. I will try adding some debug in the code on the weekend to see what exactly is not running and possibly causing crash.
-
I got a suggestion here to erase the flash before flashing. Haven't tried it yet, but it might help you @D_dude
-
@mfalkvidd
Thank you, i will try this and post results.
-
@mfalkvidd
tried erasing the flash using the method suggested but doesn't seem to be working for me. same result.
Thanks for the tip though.
-
Too bad. Thanks for posting your results.
-
here is my ESP8266 wifi gateway installed in wifi repeater box, taking the advantage that its has a 5 volts power supply.
-
@luisgcu Nice housing!
Thanks for the pics!
-
I'd been using the ESP gateway for several weeks, but recently was having trouble adding a new sensor I am developing.
Since the copy of dev I built it with was now out of date, I went ahead and updated... still wasn't working right so while I had the serial link to it I checked and noticed it was crashing and cycling. It would work for hours, until I fired up my new node, then crash about immediately. A few dozen debug(PSTR())'s later, I found a cause.
In core/MySensorsCore.cpp the result of _msg.getConfig() is dereferenced in a comparison, and it's possible it could return NULL ( like when it's a new node ). I put a check around that and it's not crashing anymore. Which is more than what I can say for my new sensor node....
I have not tested this change with an AVR.
I submitted PR 264.
-
Great work @soward !
-
on some basic debugging, seems like my sketch is crashing in setupGateway.
infact even adding a print statement, it only prints first 3 chars.
My question is setupGateway takes output as an arg, which in turn is a function, should there be some parameters for this function?
also "Serial.print(serialBuffer);" does not print anything i added prints above and before and they don't show up either.va_end (args); Serial.print("A1"); Serial.print(serialBuffer); Serial.print("A2");
any suggestions?