ESP8266 WiFi gateway port for MySensors


  • Mod

    @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?


  • Admin

    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?


  • Mod

    @Anduril Ok, did some tests:

    Copied your problematic example string from this topic into Arduino IDE (1.6.5), on Windows 10:

    upload-d3f2ea5f-8442-4f01-9f16-d77ffc2c4b49

    Saved the sketch.

    Viewed sketch.ino in notepad:
    upload-65587bba-2f55-4d38-9071-303fa5df2772
    Newlines are f*cked up, but "ß1ß" can clearly be recognized.

    Viewed the same sketch in HxD hex viewer:
    upload-d5300e08-17b9-4d7b-b069-dddba71f6649

    And there we are! The string is stored as Unicode characters!

    Reading it back in Arduino IDE:
    upload-01fb9b7d-3b1d-40c5-8916-6a1da46913fa

    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.


  • Mod

    @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).


  • Mod

    @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.


  • Admin

    You can set static ip in the dev-branch.


  • Mod

    @hek said:

    You can set static ip in the dev-branch.

    Even better :+1:



  • @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
    #endif

    and 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.


  • Mod

    @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.


  • Mod

    @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.


  • Mod

    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.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.