Probs getting started with "interface script is not running" and "file_get_contents"

Hi there, 

I have some troubles in getting started.

When I connect to the Emoncms and click to the "Raspberry PI", I get:

   "Message: The RFM12 to PI interface script is not running, you may need to configure cron"

When I disconnect the RFM12 from PI an reconnect, then the LED is lightning for about 5 seconds and when I refresh the Emoncms-Website I get the green

    "Message: RFM12 to PI interface script is up and running"

for another some seconds, few time late it is the yellow warning again.

There is a second warning line:

    "Warning: file_get_contents(http:///time/local.json?apikey=): failed to open stream: operation failed in /var/www/emoncms/Modules/raspberrypi/raspberrypi_view.php on line 15"

The fields "Domain name" and "Write apikey" (I can't remember what was in this fields when starting), I don't want to send my data to an remote server now. 

 

I have set the frequency to "868 "(like my kit), Group to "210" and Base ID is at "15".

 

I Have one full-featured-EmonTX-Node, set to frequency 868, group 210,  nodeID 11.

My second Node ist an lowpower-temerature-EmonTX, set to F 868, G 210 and N 18

 

I have tried the communication withe the minicom like suggested in the docs, it seems to work fine: 

Available commands:                                                            
  123 x      - Toggle configuration change protection, 1=Unlocked              
  <nn> i     - set node ID (standard node ids are 1..26)                       
  <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)                        
  <nnn> g    - set network group (RFM12 only allows 212, 0 = any)              
  <n> c      - set collect mode (advanced, normally 0)                         
  ...,<nn> a - send data packet to node <nn>, with ack                         
  ...,<nn> s - send data packet to node <nn>, no ack                           
  <n> l      - turn activity LED on DIG8 on or off                             
Current configuration:                                                         
79 i15 g210 @ 868 MHz  Lock: 1

I can toggle the LED on and of with the command "1l" and "0l". 

My 

emonTX-Node-11 has a lightning LED, delightning every 9 sec. 

 

Do you have any suggestions, what to do to get started?

 

Many thanks

Stefan Krüger

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hi there, 

I did a second trial. Installed my Raspy completely fresh along the documentation, step by step from scratch. It was al lot to do, but now it works! I think my mistake was the renaming of the PI, I only editetd the hostname-File and forgot the hosts-File. I will check that later on. 

When I click on the "Raspberry PI"-Button in the emoncms, now there is the green "Message: RFM12 to PI interface script is up and running". 

Now I have some problems to understand how to setup my EmonTX-Nodes. Their firmeware is flashed, everything is mounted, the green LED is lightning. But I con not see any data...???

Under "Input" there are now "No Group", "Node 1" and Node 11", I can expand them and I see several blue-highlighted "id's", but the do not update, the seem to have no connection to my sensors/EmonTX-Boards.I'm quite a bit confused now. I say thanks for some Orientation.

 

Best regards

Stefan Krüger

 

 

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

I'm quite frustrated now!

The Problem withe the "PI interface script is not running" is not because the entry in the "Hosts"-file (see above).

I have setup a complete new installation from the "ready to go"-Image, did no customizations (straight out of the box) an run in the same problems.

Then I tryed to follow the manual setup, it went quite well. The LED on the RFM12PI-Board started to blink ca once a minute.

I restarted the PI and there was no more blinking of the LED.

Problem-01

 

 

 

 

Under "Input" I clicked with the "Input API helt" two Sektions, so it looks like this now:

Problem-02

But it seems so, that I dont get any data from my EmonTX-Board.

What do I do wrong? I can not see my problem. Any idears

 

Thanks for helping.

 

Stefan Krüger

TrystanLea's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hello Stefan, Looks like your almost there, does the time always stay at 17mins ago?, this may be due to incorrect time set on the raspberrypi. The raspberrypi may be 17mins behind your computer time, we had this issue for the first time in the course we ran last week where the PI's had no internet connection and so could not get an updated time. (The pi has no persistant realtime clock).

There has also been an issue with the settings in the interface not being saved to the rfm12pi adapter board, this was due to an error in the raspberrypi_run.php script. The quick fix is to reboot your pi after setting the settings but it sounds like you confirmed that the settings where correct with minicom.

Hope that helps

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hello Trystan,

thanks for answering so quick. I'm not sure about the question with the time. This Installation I did completely without X-Desktop, only by SSH, so I could not see the time. I will check this. But in my other Installations (I made totally 3 now), I had no troubles with the time. And I think, the time-counting is ascending and not fix, it actualizes every few minutes.

Do you know anybody in Germany, who is engaged with the OEM/PI-Project? I would be interested in having some exchange.

I hope for some success and getting first data from my emonTX's. I love this project and I'm surprised about the work which is done by the project.

Stefan Krüger

Robert Wall's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Do you know anybody in Germany

You could try to contact Jörg Becker

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

FWIW, command

    $ date

displays system date and time.

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Thank you Trystan, Robert, Jérôme,

@ Robert: I've sent Jörg a message an hope to get in contact. Perhaps I can engage in making al localization for Germany

@ Jérôm: thanks for the command, I'm not so familiar with linux-commandline and my DOS-Commands are fare away, but I remember, that's quite similar. My Time and Date is ok!

@ Trystan: my Time and Date are ok. The time of last update is still rising (actual at about 23 hours) and I think there is really no connection to the emonTX. Is there any procedure to test the communication between the modules?

Stefan

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

> Is there any procedure to test the communication between the modules?

Yes.

You can use minicom to see if something is coming through the serial port (see wiki page about RFM2Pi).

You can launch raspberry_run.php it manually (and add prints if needed) to get a glimpse of what is happening.

You can try the python script rfm2pigateway.py instead of raspberry_run.php. It is integrated in master branch of the Raspberry Pi module. The documentation I wrote on my profile refers to the dev version, which is a bit more advanced, but your should figure everything out. Install dependencies, then

        /var/www/emoncms/Modules/raspberrypi/rfm2pigateway.py

and there should be a log file in /var/www/emoncms/Modules/raspberrypi/rfm2pigateway/

If all of this is unclear, forget it and try to solve your problem first. I wouldn't like to add another layer of complexity.

(I didn't go through all the posts in this thread again, so please forgive me if I'm missing or repeating something, I'm just answering this specific question.)

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Thank you for this hints! I will give it a try. Your description of the  PY-Version is good, I hope I can do this tonight.

Stefan

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hi,

my situation is not so amusing! Spent 2 more hours but no real result! I would prefer to work on the data but on an unviewable bug...

 

So, I tryed again the minicom and it seems to me, it works well!

Than I run the python script:

pi@raspberrypi ~ $ /var/www/emoncms/Modules/raspberrypi/rfm2pigateway.py
'remotepath'

 

what is the meaning of 'remotepath'? There is no forme interaction or output, I can see nothing...

yes, there is the logfile:

2013-04-05 21:15:12,310 DEBUG Opening serial port: /dev/ttyAMA0
2013-04-05 21:15:12,403 INFO Setting RFM2Pi | baseid: 15
2013-04-05 21:15:13,409 INFO Setting RFM2Pi | frequency: 8
2013-04-05 21:15:14,412 INFO Setting RFM2Pi | sgroup: 210
2013-04-05 22:07:36,955 DEBUG Opening serial port: /dev/ttyAMA0
2013-04-05 22:07:37,037 INFO Setting RFM2Pi | baseid: 15
2013-04-05 22:07:38,043 INFO Setting RFM2Pi | frequency: 8
2013-04-05 22:07:39,047 INFO Setting RFM2Pi | sgroup: 210

But I can not see any data from any othe node?

Any Idea where to find my problen and how to get started?

Stefan

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

The script sends data to local emonCMS installation and optionally to a remote server http://domain.tld/emoncms_path. (remote_protocol, remote_domain, remote_path).

The remote path should be entered through the raspberry pi settings tab of local emonCMS. If you enter empty or dummy values, sending to remote server is inhibited.

In the admin tab, upgrade database should be enough to initialize remotepath with an empty string. A DB upgrade is highly recommended after each emonCMS upgrade.

Apparently, the script fails on getting settings because of the remotepath issue. This happens just after opening COM port and sending radio config. This is why you only see those two first steps in the logs.

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

OK, I wondered about this entrys, I did not made at this point:

Forward data to remote emoncms server

Domain name emoncms.org

Path to emoncms <br /><b>Notice</b>:  Undefined index: remotepath in <b>/var/www/emoncms/Modules/raspberrypi/raspberrypi_view.php</b> on line <b>40</b><br />

Write apikey YOURAPIKEY

Notice: Undefined index: remotesend in /var/www/emoncms/Modules/raspberrypi/raspberrypi_view.php on line 42

Incorrect remote server details

I'm not able to change the value of "Path...", everytime I set and save this string ist in this field. Is that the problem?

What do you suggest to do?

Thanks

Stefan

 

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

This definitely is a problem. Did you do the DB upgrade (admin tab, I think) ?

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

ok, that was a point, admin-tab was right (I did not understand...), the update declared some feelds to be updated.

The path-problem is solved so far.

Now I did a reboot and afterwards i tested your python-script. But - sorry - exactly the same result. Only the entrys for baseid,frequency and sgroup, thats it.

Stefan

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

when I now "save" my settings on the raspberry pi site, I get a

Notice: Uninitialized string offset: 0 in /var/www/emoncms/Modules/raspberrypi/raspberrypi_controller.php on line 53

anything is going wrong in the script. Tryed to clear the field "Domain Name", saved without errormessage. Seems to be the entry "emoncms.org". aktualy I dont want to send the data to a second server, I would be glad to get them localy ;-)

Stefan

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

I understand you're using latest revision from master branch. Please tell us if this is incorrect.

I don't think you should bother about the "Notice" message. It is just the Pi that tries to contact remote server, which fails, then sets remotesend flag to false. I think. Anyway, let's ignore that for now.

Can you confirm that the RF settings are correct ? Frequency 866 and group 210 ?

And that you do receive stuff on minicom with the same settings ?

jonrescca's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hi Stefan,

I had a similar issue, with null values being registered from the EmonTX nodes. It happened to be a not very well inserted jack from the sensor. When I reseated the mini-jack plug from the sensor, data was not empty anymore.

 

It might help?

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Hi Jérôme, jonrescca,

thank you for thinking in my problem, it feels good not to be alone with this.

Yes Ican confirm that I have uses the latest ofiicial code from Git-hub, and updated the database. I have configured the RF settings on RFM12PI to F868, G210 and N15. My EmonTX is configured by Arduino 1.04 to

#define freq RF12_868MHZ
#define PHASE2 8
#define PHASE3 17
const int nodeID = 10; 

const int networkGroup = 210;

I have now connected to the EmonTX 3 x CR-Sensors and the one Voltage-Adapter. No Temp and no Impulse. The green LED on EmonTX is lightning and going out every ~10 sec. The jacks are all propper.

When I deactivate the the corm-job, reboot and run trhe minicom I get the declarations of the board

Available commands:                                                           
   123 x      - Toggle configuration change protection, 1=Unlocked             
   <nn> i     - set node ID (standard node ids are 1..26)                      
   <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)                       
   <nnn> g    - set network group (RFM12 only allows 212, 0 = any)             
   <n> c      - set collect mode (advanced, normally 0)                        
   ...,<nn> a - send data packet to node <nn>, with ack                        
   ...,<nn> s - send data packet to node <nn>, no ack                          
   <n> l      - turn activity LED on DIG8 on or off                            
Current configuration:                                                        
79 i15 g210 @ 868 MHz  Lock:
1

but not more, no data. I can switch the LED on RFM12PI with 1l on and 0l off.

Perhaps I have a problem in understanding what to do after config under "raspberry", when the green line is on:

Message: RFM12 to PI interface script is up and running

Under "Inputs" there is nothing, but

No inputs created

Inputs is the main entry point for your monitoring device. Configure your device to post values here, you may want to follow the Input API helper as a guide for generating your request.

What have I to do there withe the "API helper"?

 

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

It seems you're not receiving any data on the COM port.

It could be that the TX is too far from the base (I doubt it, but it's easy to check).

Can you make sure the TX is emitting data ? Perhaps the LED on the TX would tell. I'd rather use the serial monitor of the arduino IDE. You may add pirints if needed, to check you go through serial send function.

Which sketch are you using ? Name, or better, github link, if it is a "standard" sketch. Along with your modifications.

You shouldn't have anything to do with the API helper. When receiving data, inputs will be created automatically.

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

The distance between EmonTX and the RFM12PI can't be the problem, they ly side by side.

I load the "emonTx_CT123_3Phase_Voltage.ino":

https://www.dropbox.com/s/vzovf7tiud8nw50/03.JPG

I do not have any deeper knowlage about the arduino-tool, but will try to test something tonight.

Jérôme's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Perhaps can you copy-paste the code here. The screenshot doesn't show much.

In the Arduino GUI, there's a serial terminal you can access from the upper menu. It is a helpful debug tool : you can print there the values you want to monitor by adding print statements in the code.

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

ok, the serialport-monitor is good, I did not know that. I

t works, I get some quite realistic readings from my full-featured-EmonTX:

emonTX CT123 Voltage 3 Phase example
OpenEnergyMonitor.org
Node: 10 Freq: 868Mhz Network: 210
Voltage: 324.87
Current 1: 131.10 Power 1: 30323.05 VA 1: 42589.87 PF 1: 0.71
Current 2: 130.87 Power 2: 29714.33 VA 2: 42515.12 PF 2: 0.70
Current 3: 130.41 Power 3: 28391.72 VA 3: 42366.28 PF 3: 0.67

I had a load (electric heater) of about 1920 W, mesured 3 x the same line.

The low-power-tempreture-module does not send any data, thats mybe a second problem - will see later.

Ok - we have wa working EmonTX and a working Raspberry with RFM12PI but no comunication between.

!!! I FOUND IT: there was a broken solderpad at the RF-Module on the EmonTX 3rd from Antenna !!!

So, now I get data to the EmonCMS, there is a node "10" at the "Inputs"!

Node10_1    -2388?
Node10_2     1230?
Node10_3     1174?
Node10_4       227     I think that can be Volt

Changeing the CT-Clamps, the produce the same result, the problem is on the board or in the code...

My Load ist 1920 W electric heater (measured separatly)

I think I have now to read the Thread "...miles out...", or do you have any idea?

For this moment: many thanks staying on my side!!!

Stefan

fluppie007's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Robert Wall's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

If you are running the 3-phase sketch, you must calibrate it according to the notes in the sketch. It works by guessing that the voltage for phases 2 and 3 is the same as phase 1, and it stores the phase 1 voltages and uses them 1/3 and 2/3 cycle later for phase 2 and phase 3.  That delay needs to be correct for the power factors and powers to be correct.

tango's picture

Re: Probs getting started with "interface script is not running" and "file_get_contents"

Thank you for that hint. You are right, I started with the thre phase sketch and turned now over to the simple 123 one. Now it works properly so far, also the tempreture-module, that was a problem withe batteries.

My next skill ist to build a dashboard and a recording, have actual no idea how to start and will have to read a lot.

Stefan

Comment viewing options

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