Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Gateway and dynamic wifi configuration

Gateway and dynamic wifi configuration

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 79 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Fumée BleueF Offline
    Fumée BleueF Offline
    Fumée Bleue
    wrote on last edited by
    #1

    Hello,

    I'm looking for an implementation of gateway based with esp8266 with a possibility to change SSID/password by web page and not static configuration as mysensors examples.
    What is your solution ?

    I'm trying wifimanager library but i have some difficulties about MY_WIFI_SSID and MY_WIFI_PASSWORD used by Mysensors but not wifimanager. Is it possible to use wifimanager with mysensors ?

    Tristan

    1 Reply Last reply
    0
    • BearWithBeardB Offline
      BearWithBeardB Offline
      BearWithBeard
      wrote on last edited by BearWithBeard
      #2

      Preprocessor directives like MY_WIFI_SSID are expanded before the code is compiled and cannot be changed at runtime. But you can replace the string literal with a variable:

      char dynamic_ssid[16] = "ssid";
      char dynamic_pw[16] = "123456";
      
      #define MY_WIFI_SSID dynamic_ssid
      #define MY_WIFI_PASSWORD dynamic_pw
      

      What you could do now, is storing the new value for SSID and PW somewhere in the flash memory of the ESP when you change it (with wifimanager or whatever you may use for this purpose) and initiate a reboot of the ESP.

      Then you could read the values from flash into the two char arrays. You'd want to do this in before(), so that MY_WIFI_SSID and MY_WIFI_PASSWORD represent the new values before MySensors initializes the WiFi connection.

      void before() 
      {
          // Read SSID and PW from flash and
          // assign to dynamic_ssid and dynamic_pw
      }
      

      In this case MySensors would always try to establish a WiFi connection with the login data you've stored in flash when the gateway boots up.


      Addendum: There are some threads with similar ideas from a few years ago here and here.

      Also, rebooting the ESP as mentioned above isn't neccessary. It's sufficient to call WiFi.disconnect() and WiFi.begin() with the new login data to connect to a different network.

      Another approach to this could be to send new login data to some V_TEXT childs from a controller to the gateway.

      There is also this project which seems to provide a custom web interface to configure WiFi and MQTT connections.

      1 Reply Last reply
      0
      • Fumée BleueF Offline
        Fumée BleueF Offline
        Fumée Bleue
        wrote on last edited by
        #3

        Thanks for your explanation and links :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        18

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular