Local Emoncms and multiple Esp8266

I realise that this idea would not be possible with emoncms.org But,

If i were using a local emoncms server Is it possible to have multiple Esp8266,sending data to the local server at there own free will.

I would imagine that if i did this with emoncms.org it would not work due to the rate limiter?

So basically there would be no server in between putting all the data together and sending it via api in 1 line to emoncms?

For instance:-

Esp8266 1 : sending Consumption data every 6secs

Esp8266 2 : sending Temprature data every 6secs

Esp8266 1 : sending Generation data every 6secs

But they all might send at the same time.

So hard to explain so i hope you can grasp what i am asking

 

 

mharizanov's picture

Re: Local Emoncms and multiple Esp8266

There is absolutely no problem to do that.

Robert Wall's picture

Re: Local Emoncms and multiple Esp8266

I'm not sure what your question is. If the WiFi module can handle the protocol correctly, which it should do, it will wait until the channel is clear before trying to send, therefore you won't have a collision that might otherwise occur when two attempt to transmit at the same time. Therefore there should not be a problem.

And "there would be no server in between putting all the data together and sending it" - I can't think what/which server you're thinking of there. There's only one in the system, either emoncms.org or your own (RPi?) running emoncms, not normally both (though you can do both). If you're thinking of your RPi running emonhub and forwarding data to emoncms.org, that's functioning as a base node, not as a server.

rmtucker's picture

Re: Local Emoncms and multiple Esp8266

Yes emonhub is what i was thinking of.

It is taking the data from different nodes but then sending it as one line to emoncms.

But am i right to assume that emoncms.org would not accept the data from multiple nodes in the scenario i describe?

 

So it looks like i will have to set an image up for the raspi,The existing one includes emonhub and i did not find the image to be very stable during my last tryout,Also missing quite a lot of new stuff.

Any way i think i will set it up on a hard drive this time.(so maybe a full install)

I have been using the esp8266 and emoncms.org for months without any problems and at £3.50ea it saves on all the electronics used normally.Emontx,Base etc.

 

pb66's picture

Re: Local Emoncms and multiple Esp8266

You can post direct to emoncms but the pro's and cons tip in favor of not sending directly (IMO) Aside from making the server work harder by rapid firing small data packets at it, you are also prone to losing data if it can't be posted due to network outage, server down or just increased server workload etc etc

using emonhub will not only buffer the data until it's receipt is acknowledged by emoncms but also allow you to set an interval on the reporter so no matter how much data you through at it emonhub will only "bulk post" to emoncms every 5 or 10 seconds for example, 

Posting via emonhub will also allow either or both a remote and local emoncms, Whilst managing the IP's, url's and api keys for you. Currently to change any of these will involve you re-configuring every device individually and leave you open to issues with changing IP address as per http://openenergymonitor.org/emon/node/10288.

I'm all in flavor of these devices I think they have fantastic potential but I don't think they can wholly replace the existing hardware just yet 

Paul

rmtucker's picture

Re: Local Emoncms and multiple Esp8266

Paul

Yes i agree on all of your points.

My intention was eventually to only post to emoncms every 60secs or so.

The above statements were just an example to get my question across .

It would be nice if emonhub could work with these devices as they are so easy to program and so cheap.

The esp8266 can be set up as a server and only serve data to emoncms when requested??

 

Paul Reed's picture

Re: Local Emoncms and multiple Esp8266

Yes, I think that we are still scratching the surface with the ESP8266, and there is a lot of potential still to be explored.
I'm surprised that there hasn't been more discussions about them here in the forum, so your post is very timely.

Paul

pb66's picture

Re: Local Emoncms and multiple Esp8266

I think it would be quite easy to change your code to point the esp8266 at emonhub. On the LAN no apikey is needed, just a string of "nodeid val1 val2 val3....." sent to a fixed LAN IP for the emonhub host (pi) at the port number defined in emonhub.conf.

The serving of data on request will be of great use on very large installs to synchronize RF traffic (although less necessary with wifi) or when continuous data is not required and can be sought on-demand.

For what we do the socket interfacer listening out for any transmissions is probally the better solution currently.

rmtucker's picture

Re: Local Emoncms and multiple Esp8266

That sounds like just the ticket!

But i can not find any details about this or any help files,Are these features documented anywhere?

 

pb66's picture

Re: Local Emoncms and multiple Esp8266

If you search for "socket interfacer" you may find some useful info. basically if you add something along the lines of

[[sockets]]

    Type = EmonHubSocketInterfacer

    [[[init_settings]]]

        port_nb = 50011

    [[[runtimesettings]]]

to the [interfacers] section of emonhub.conf (if you have a firewall enabled you may need to add the port to the "enabled" list) the name "sockets" can be any unique name and the com port can be any unused port.

Then each esp8266 will need to be configured to send nodeid val1 val2..... to the IP:PORT.

I've attached a socket_test.txt (replace the '.txt' with '.py' renamed to permit upload) for testing the interfacer, but with regard to the esp8266 I can't help you much as I have not played with one yet.

Paul

PS edit the "socket_test.py" data frame for an unused node during tests (I used node 10)

corrected - should of been "port_nb" not "port_no"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.