emonbase not sending data after changing location

Hello,

i had a system emonTX3 + emonbase (raspberry with RockSolidGateway) sending data to my site with emoncms installed and working perfectly. Now i changed home and the emonbase (connected to internet with ethernet cable) does not send any data to site. I have updated the wpa_supplicant.conf file with the new ssid and psk but this not helped. Maybe i forgot something?

Thanks for the help

Emilio

 

 

pb66's picture

Re: emonbase not sending data after changing location

If you are connecting via Ethernet cable the wpa_supplicant.conf isn't used, it's only used for WiFi. 

If you are using a different router (assumed due to new ssid and psk)  are any fixed IP addresses the same as before?

When you say "my site" where is that hosted? has the IP address changed?

Paul

 

emicon's picture

Re: emonbase not sending data after changing location

yes i changed router and phone number and his IP address in my new location. But i dont remember i have used my router IP before in my settings. The internet site is hosted on a shared Linux server. I have installed emoncms 2 months ago and it worked fine all time.

Emilio

pb66's picture

Re: emonbase not sending data after changing location

You could use the troubleshooting section at the end of this guide  to check the gateway to see if any data is being forwarded and to where.

Also try manually sending a url from a browser to the server url to check it is accepting data. See http://emoncms.org/input/api

Paul

emicon's picture

Re: emonbase not sending data after changing location

Hello Paul, thanks for your answers :)

i'm used to control oemgateway's output using a SSH session, now it look something like this:

2014-09-10 10:50:01,194 INFO Sending to mydomain/emoncms
2014-09-10 10:50:01,517 WARNING Send failure
2014-09-10 10:50:01,721 DEBUG Server mydomain/emoncms -> send data: [10, 0, 3, 0, 0, 24052, 233], timestamp: 1410342135.12
2014-09-10 10:50:01,724 DEBUG Data string: &time=1410342135.12&node=10&json={1:0,2:3,3:0,4:0,5:24052,6:233}
2014-09-10 10:50:01,727 DEBUG URL string: http://mydomain/emoncms/input/post.json?apikey=8b3c8a4c604a532067f4274517e8ea5f&time=1410342135.12&node=10&json={1:0,2:3,3:0,4:0,5:24052,6:233}

When i send the data manually they are received fine and i can see the input and the node on my emoncms, for example using:
http://www.mydomain/emoncms/input/post.json?node=1&csv=100,200,300

In this URL i have the www. string that is not generated by oemgateway. But also putting www.mydomain in oemgateway.conf nothing change.

Thanks for your patience.

Emilio

pb66's picture

Re: emonbase not sending data after changing location

Ok so using ssh means the Pi is network connected.

"WARNING Send failure" means the gateway did not get an "ok" returned for the URL it sent.

With regards to the manual test you did, firstly there is no apikey in the URL you say was successful, so can I assume you were logged in to emoncms at the time? If so can you test while logged out (I normally have 2 different browsers open, chrome i'm logged in and internet explorer I'm not).

You say you had "www." in your URL but not originally in the gateway, did you have to add that to get it to work? did you or could you, try it without ?

You also state that nothing changed when you added "www." to oemgateway.conf, can you confirm if mean you still didn't receive data at emoncms or that the URL string sent by the gateway didn't change.

A good test is to cut and paste a URL string from the gateway's log to test from a browser that is not logged into emoncms, just change the node id so that it is clearly obvious if the data appears in emoncms that it was the manual url and not a delayed gateway post. So for example from your log above I would copy & paste the full "DEBUG URL string:" and change the node id to 1 like so

http://mydomain/emoncms/input/post.json?apikey=8b3c8a4c604a532067f4274517e8ea5f&time=1410342135.12&node=1&json={1:0,2:3,3:0,4:0,5:24052,6:233}

If this is then sent from a browser that is not logged in it tests several things in one go.

Paul

emicon's picture

Re: emonbase not sending data after changing location

Hello Paul,

 

i have posted that URL from a non logged browser and it generated the correct input (except the time that is 23 hours ago, cause the old timestamp ^^). I can see the 6 keys with values, it seem to work perfectly manually.

I have created now an account on emoncms.org setting new apikey and domain on oemgateway.conf file. I have attached an image of SSH session where we can see that the data received by emonbase never change and the timestamp maybe is wrong. It seems it's the sender emonTX working wrong. What you think about?

Thanks again

Emilio

pb66's picture

Re: emonbase not sending data after changing location

The problem has now changed !

The gateway was previously attempting to post the data but not getting the response it expected, the error code in your latest log following your changes shows the gateway has decided the url is not suitable, there is now an error in the configuration or the software that wasn't previously there or wasn't effecting the previous URL.  

The latest log also shows the data has changed ac voltage has fluctuated slightly and the temp was 23.3 but has changed to 22.7 plus the timestamps refer to 8.45ish this morning not yesterday, so the emontx has worked today.

The manual URL test result tells us that particular URL was good (doesn't matter about the timestamp at the moment) however, was that URL string cut and pasted from the latest log or did you just post the example I gave you? the intention is a side by side test the gateway tries to send a url and doesn't get the response it expects, you then post that exact same url (with the node id edited) from a browser (not logged into emoncms) to see what response you get, 2 things you check for are, that the data is in emoncms and just as important is the response in the browser window is it 

ok

Just ok on it's own in lowercase, that is the response the gateway is expecting. with this info we can do other checks to narrow it down but if you change anything and it doesn't work the test should be done again unless you are absolutely sure the URL has not changed.

If you just set up the emoncms.org as a test I would recommend putting the settings back and continue with your server, if you want the .org acct working then the issue to resolve first is why doesn't the gateway like the new details?

Have you edited any of the gateway files other than the oemgateway.conf ?

I see at the end of the last log you exited the gateway so the previous buffered data will of cleared. Lets start from the beginning. Switch off the emonTx and reboot the Pi, check the log there should be no activity. edit the oemgateway.conf if needed to point to the server you wish to focus on. restart oemgateway with logging enabled and switch on the emontx for a while just to get a few lines of data. switch off the emontx, check the log if you can see "Send ok" fantastic if you see "Send failure" do the cut and paste URL test and report the results, but do not change anything, if neither then we have a different bridge to cross first!

Paul

emicon's picture

Re: emonbase not sending data after changing location

Hello Paul,

sorry if i waited so long but i was out for a trip.

Have you edited any of the gateway files other than the oemgateway.conf ?

Not at all.

I did the test as we planned and you can see the results on images i have attached.

The first one show the log and the URL generated by oem_gateway.

The second one show that URL copied and pasted on a not logged browser (with the 'ok' answer)

The third is the input page with the data correctly received.

The manual approach seems to work fine.

Thanks for your patience

Emilio

pb66's picture

Re: emonbase not sending data after changing location

Hi Emilio

The log looks fine except for the URLError, I believe that error is mainly caused by the url not being resolved to a ip (but I could be wrong) That makes me think the sub-domain may be the issue as I know from previous experience what a pain they can be.

Try adding "www." to the beginning or the url in the conf file or try using an alternative URL that points to the same sub-domain IP.ADD.OF.MAIN/sub-domain/emoncms or www.altervista.org/subdomain.

It looks like OEMG is doing as expected, leaving the issue to be either in the standard python libraries or in the way the url resolves, maybe if the sub-domain is a redirection of some sort it causes a problem that's easily handled by a browser.

I'm afraid I won't be of any help in this area ...

Paul

pb66's picture

Re: emonbase not sending data after changing location

Just an observation - Originally your error was "WARNING Send failure" so that must of been a different URL try that URL again to see if you get the "ok" after copying and pasting it to a browser from the log if it fails.

emicon's picture

Re: emonbase not sending data after changing location

Goodmorning Paul  :)

now i tried to connect the Raspberry via wireless (using an Edimax usb wifi adapter) instead of the ethernet cable,

and i get in my log "Couldn't send to server, HTTPError: 403".

The Wikipedia says about:  "A web server may return a 403 Forbidden HTTP status code in response to a request from a client for a web page or resource to indicate that the server can be reached and understood the request, but refuses to take any further action. Status code 403 responses are the result of the web server being configured to deny access, for some reason, to the requested resource by the client...."

I think you are right, the subdomain is the problem, maybe i need to contact the server staff. But i wonder why the system worked good for 2 months before when i was in my old house. Before it was a private phone number, now it is a business phone number (i have installed oem_gateway on my office) maybe the problem is there. I will contact the phone provider Vodafone.

You are really nice and helpful, I will never stop to thank you :)

Emilio

Comment viewing options

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