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. General Discussion
  3. How can I communicate with the Gateway exposing a Rest API?

How can I communicate with the Gateway exposing a Rest API?

Scheduled Pinned Locked Moved General Discussion
4 Posts 2 Posters 834 Views 2 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.
  • I Offline
    I Offline
    Ivan Fontanals
    wrote on last edited by
    #1

    Hi all!
    I'm new using mySensors and also this will be my first project using sensors, rf24 modules, etc...I think that I'm a little bit confused about how the Gateway works...and I just would like to confirm with you which is the best way to achieve the following:

    • I have configured several Arduinos + RF24 that will control my lights, sensor temperature, etc... All the "sensors" should communicate with the Gateway, which currently is a Raspberry Pi with a RF24 module. The current gateway is an Ethernet Gateway, so the port 5003 has been exposed.
    • My idea is to be able to control each light from Internet, cell phone, or whatever...so what I had in mind was to publish a REST API inside the gateway to capture the command and then, send the correct data to the correct arduino / sensor / relay.

    For instance, if I have 2 lights, I could switch the first one ON with : POST htpp://xxxxx/1/ON

    And here my questions:

    • I have not found any example reading from a REST API from the gateway and re-sending the request to the remote sensor (using rf24) . How I have to use the gateway to achieve that?
      Do I need a Controller or I can easily add this behaviour into the Ethernet Gateway?

    I can imagine other solutions...for instance, a Python or NodeJS program acting as HTTP server, and sending MQTT messages into the gateway...but I think should be easier to consume http request inside the gateway.

    Am I wrong? Which are your thoughts?

    Thank you very much in advance!

    Regards

    mfalkviddM 1 Reply Last reply
    0
    • I Ivan Fontanals

      Hi all!
      I'm new using mySensors and also this will be my first project using sensors, rf24 modules, etc...I think that I'm a little bit confused about how the Gateway works...and I just would like to confirm with you which is the best way to achieve the following:

      • I have configured several Arduinos + RF24 that will control my lights, sensor temperature, etc... All the "sensors" should communicate with the Gateway, which currently is a Raspberry Pi with a RF24 module. The current gateway is an Ethernet Gateway, so the port 5003 has been exposed.
      • My idea is to be able to control each light from Internet, cell phone, or whatever...so what I had in mind was to publish a REST API inside the gateway to capture the command and then, send the correct data to the correct arduino / sensor / relay.

      For instance, if I have 2 lights, I could switch the first one ON with : POST htpp://xxxxx/1/ON

      And here my questions:

      • I have not found any example reading from a REST API from the gateway and re-sending the request to the remote sensor (using rf24) . How I have to use the gateway to achieve that?
        Do I need a Controller or I can easily add this behaviour into the Ethernet Gateway?

      I can imagine other solutions...for instance, a Python or NodeJS program acting as HTTP server, and sending MQTT messages into the gateway...but I think should be easier to consume http request inside the gateway.

      Am I wrong? Which are your thoughts?

      Thank you very much in advance!

      Regards

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      Welcome to the forum @ivan-fontanals
      Most controllers already have a REST API. It would probably be possible to extend the gateway so it becomes a controller if you want to (and have enough time and skills to do so).

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Ivan Fontanals
        wrote on last edited by
        #3

        Thanks @mfalkvidd for your answer.
        Let's see if I understood what you meant.

        I could use an existing controller ( For instance Home assistance ), use MySensors Gateway ( without touching anything ) and link it to my arduino via RF24? I would like to avoid extending the gateway if it's not the way :)

        But, how will the Home assistance know that I have a new Arduino with a RF24 module? The Controller will only talk to the gateway, correct? My arduino, in the other side, will have also the MySensors library and will implement the "presentation" method...but as far as I know, this communication is against the gateway.

        So...the controller will be able to talk with this gateway and send commands to each sensor ( via gateway ) ? Is that the way?

        I have the skills ( I hope at least :) )....but it's my first time that I will work with this kind of gateways, Controllers, etc...and as you can see, I'm a little bit lost about the responsibility of each component.

        Again...thank you so much!

        mfalkviddM 1 Reply Last reply
        0
        • I Ivan Fontanals

          Thanks @mfalkvidd for your answer.
          Let's see if I understood what you meant.

          I could use an existing controller ( For instance Home assistance ), use MySensors Gateway ( without touching anything ) and link it to my arduino via RF24? I would like to avoid extending the gateway if it's not the way :)

          But, how will the Home assistance know that I have a new Arduino with a RF24 module? The Controller will only talk to the gateway, correct? My arduino, in the other side, will have also the MySensors library and will implement the "presentation" method...but as far as I know, this communication is against the gateway.

          So...the controller will be able to talk with this gateway and send commands to each sensor ( via gateway ) ? Is that the way?

          I have the skills ( I hope at least :) )....but it's my first time that I will work with this kind of gateways, Controllers, etc...and as you can see, I'm a little bit lost about the responsibility of each component.

          Again...thank you so much!

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #4

          @ivan-fontanals yes you got it right. The controller can communicate with all MySensors nodes through the gateway.

          https://www.mysensors.org/about/network has an overview of how the different parts fit together. If anything is unclear, just post a question and we'll try to help.

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


          11

          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