HTTP request from gateway to controller



  • Does MySenors allow for the gateway to send an HTTP request (POST or GET) to the controller and also to receive a request from the controller? I'm doing that right now on an esp8266 as the gateway but I'm using the receive() function on the gateway to send the request after it's received from a sensor to the controller. Is this functionality already provided in the MySenors library and I'm just not seeing it? If so how do I do this?


  • Mod

    @mhkid MySensors does not have support for incoming or outgoing HTTP. The interface towards controllers is either serial, ethernet (tcp or udp) or mqtt client.

    Is there a (more or less) standardized way to communicate with controllers over http? A standardized and well-documented way would make it easier to implement and more valuable since many controllers could utilize it.



  • @mfalkvidd, More trying to figure out if MySensors gateway can make connection to controller via http not so much changing the message format. Either the serial or mqtt message format could still be utilized and just serialized/deserislized to/from json for instance.

    I can do it in the receive function was just wondering if this was already provided for via an http connection and I was missing something, but it doesn't sound like it.


  • Mod

    Maybe you could use node-red for that



  • @gohan, if I'm understanding node-red correctly I'd have another controller that my esp8266 gateway would talk to, then node-red would talk to the controller via http. Is that correct?

    I can make the http request from the receive() function on the gateway, which I've already got that part working as a test. It's not fully functional yet but I've tested and confirmed I can make the call when I receive a sensor message and I can pass it on to the controller from the gateway. What would the advantage be of using node-red in this case?

    The reason I was asking about existing capability in MySenors is that I'd refactor and use the functionality that's already in MySenors if it was available. However, adding another piece of hardware and software integration adds more complexity which I don't think I need, unless I'm not understanding?


  • Mod

    Yes, it is more complex but node-red is a lot more flexible when it comes to do these things. A lot of people are using node-red as an addition to the home automation. I don't really know what is your setup so I went for a more universal solution.



  • @gohan - Thanks. Looking at it a little closer it's actually a not a bad suggestion at all and it does look pretty cool. I think I'm going to get this working first so I can get things up and going. But I'm going to put Node-red on my future feature list to look at possibly implementing.


  • Mod

    I hope you know some javascript, as it will be very handy with node-red


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts