Ethernet/WiFi-Client Gateway



  • hi everyone

    I have a bunch of ESP32DEVKIT modules lying arround and want to use them with wifi (please no discussion about the seperation of wifi and sensors...thats a wifi with only sensors, no IP connection to the inetrent is possible).

    so following the istructions I thought I understand teh following:
    if definde MY_GATEWAY_ESP32 and an IP-address in MY_CONTROLLER_IP let's the "gateway" act as a "client" and would connect to the "controller" via tcp/5003.

    but fact is: there is no outgoing connect to the given p-address 😞

    did I get something wrong ?

    cheers
    peter


  • Mod

    @peter-loeffler yes that should work. What does the debug output from the gateway say? Does it get an ip address (if using DHCP) / what settings are you using (if using static ip)? Is the controller on the same subnet or a different net?

    Did you set MY_CONTROLLER_IP (which doesn't exist) or did you set MY_CONTROLLER_IP_ADDRESS?



  • @mfalkvidd sorry, my typo ... is did set MY_CONTROLLER_IP_ADDRESS πŸ˜‰



  • UPDATE ... started with a completely empty example-sketch and ip-connection to the controller works, but: why is there no registration towards the controller?


  • Mod

    @peter-loeffler could you clarify what you mean by registration?



  • @mfalkvidd I thought, that when a gateway is on client mode, it would connect to the controller, ask for a "outside_node_id" and present itself and the topology behind ...


  • Mod

    @peter-loeffler a MySensors gateway always has MySensors node id 0. I am not sure what you mean by "outside_node_id" but by default the gateway will not ask the controller for anything.

    If the gateway has local sensors, these sensors will be presented if you have added stuff to the present() function in the gateway sketch.

    If a MySensors node presents itself, the gateway will forward this presentation to the controller when the presentation is received by the gateway.

    The gateway will store no information except the MySensors routing table. (The routing table won't be shared with the controller.



  • If you’re using sensors over wifi you don’t need MySensors, you can just use PubSubClient. MySensors is primarily for mesh network sensors not using wifi.


  • Hardware Contributor

    note: MySensors is using tree network topology, not mesh.

    I also agree with carywin comment, for wifi/ethernet nodes it's a lot more simple to use pubsub, or even using http calls/rest.



  • @scalz more simple? I don't agree!
    for example:
    I have like 20 equal sensors /4way soilmoisture per greenhouse (40mx8m) ... in 12 houses overall. they would all come with the same topic-id...so: no way!

    what I have built so far: wifi-ap with a telnetserver on 5003 that is bridget to a serial interface connected to an esp8266 gateway. The Idea was, that the esp32-gateways connect to that port and get rs485 nodes there.

    so I resume: i have to do the tcp-transport stuff myself, when I want simple nodes to connect via TCP...


  • Hardware Contributor

    @Peter-Loeffler
    well just re-read what I said, and what infos you gave us πŸ˜‰
    even atm I still don't really get it, you're now talking about rs485, serial to esp8266.. but you started by telling us "I have a bunch of ESP32DEVKIT modules lying arround and want to use them with wifi" . not much more

    mfalkvidd also explained that esp8266/32 can be used in gateway mode, and gateway id is 0.
    I don't see why topic-id would be the same when using a dedicated mqtt, rest lib

    what's the hw for the sensors nodes(I guess when you say 20 equal sensors you mean 20 nodes with 4 connected sensors per node)? gateways specs? your controller sw? the architecture (rs485, wifi, serial connections)? etc..
    then maybe I hope we can help/guide you better



  • @scalz

    ok, maybe the sort version was not so easy to nderstand. I give the long version a try:
    each of my big greenhouses will get the following quipment:
    WemosMiniD1Pro --> MySensors ESP8266Gateway (Wifi of the "backbone") and MY_RS485 (reasons: external antenna connector, seperation of all the following from the "internet")

    So Inside the greenhouse I could have 254 nodes comming from the RS485 side. that would make a cobweb of cables. So I decided to add a "wifi to serial bridge" aka esp8266 as WifI-AP (greenhouse-wifi), Telnetserver running on port 5003,sending everyting to serial1, where there is the mentioned Mini waiting.

    when I now deploy 20 SoilMoisturesensors (in every greenhouse) I dont want to do a seperate code for each sensor eg to set topics etc.
    they should connect to the telnetserver and act as nodes.
    May Idea was to make them GATEWAY_ESP32 with clientmode. (what sounded to be a "client")

    +*+
    OpenHAB gets configured one mysensors-ethernetgateway per greenhouse and everything is done.


  • Mod

    @peter-loeffler you can set one of these in the gateway sketch to differentiate between the gateways:
    MY_MQTT_CLIENT_ID
    MY_MQTT_PUBLISH_TOPIC_PREFIX

    I am not aware of any way a controller can supply a unique ID to a gateway unfortunately, but maybe the gateway<->controller interface can be extended to support that, so the gateway can set one of the above parameters.

    An alternative might be to set the value of one of the above parameters using a custom/dummy "sensor" on the gateway (using V_TEXT perhaps)



  • @mfalkvidd not the gateways ar the "problem" - the nodes inside are (in a way). I thought that a gateway in client mode would act as one...

    but what I dont get: @scalz says its a "tree-topology" how would you be able to make tree, if the gateways dont bundly their nodes and forward it to the uplink ?

    -----anyway----
    a feature lik "MY_SERIALoverIP" would be cool anyway...or a ethernet-gateway that is worth the name πŸ˜‰


  • Mod

    Sorry, it seems like I have misunderstood what the problem is. Would you mind explaining the problem in a different way? Or maybe I should just step back and let someone else (who understands the problem) answer.


 

208
Online

8.6k
Users

9.4k
Topics

99.0k
Posts