emonCMS send failure: wanted 'ok' but got '<br />

I set up an SD card following the Full Image build guide and all works good until I transmit data to the rfm12b with some data where I get this error:

           WARNING emonCMS send failure: wanted 'ok' but got '<br />

Any ideas what's wrong?

Thanks lads

 

Here's the settings:

# This interfacer manages the RFM2Pi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
    [[[runtimesettings]]]
        group = 210
        frequency = 433
        baseid = 15

Here's how the log starts:

2015-03-23 11:40:24,007 INFO EmonHub Pre-Release Development Version (rc1.2)
2015-03-23 11:40:24,010 INFO Opening hub...
2015-03-23 11:40:24,013 INFO Logging level set to DEBUG
2015-03-23 11:40:24,016 INFO Creating EmonHubEmoncmsReporter 'emonCMS'
2015-03-23 11:40:24,024 INFO Set up reporter 'emonCMS' (buffer: memory | size: 1000)
2015-03-23 11:40:24,028 INFO Setting emonCMS url: http://localhost/emoncms
2015-03-23 11:40:24,031 INFO Setting emonCMS apikey: set
2015-03-23 11:40:24,034 INFO Creating EmonHubJeeInterfacer 'RFM2Pi'
2015-03-23 11:40:24,039 DEBUG Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2015-03-23 11:40:26,048 DEBUG Opening serial port: /dev/ttyAMA0 @ 9600 bits/s
2015-03-23 11:40:30,056 INFO RFM2Pi device firmware version & configuration: not available
2015-03-23 11:40:30,060 INFO Setting RFM2Pi frequency: 433 (4b)
2015-03-23 11:40:31,080 INFO Setting RFM2Pi group: 210 (210g)
2015-03-23 11:40:32,085 INFO Setting RFM2Pi quiet: 1 (1q)
2015-03-23 11:40:33,089 INFO Setting RFM2Pi baseid: 15 (15i)
2015-03-23 11:40:34,128 DEBUG RFM2Pi acknowledged command: > 4b
2015-03-23 11:40:34,637 DEBUG RFM2Pi acknowledged command: > 210g
2015-03-23 11:40:35,093 DEBUG RFM2Pi acknowledged command: > 1q
2015-03-23 11:40:35,321 DEBUG RFM2Pi acknowledged command: > 15i
2015-03-23 11:45:02,763 DEBUG 1 NEW FRAME : 1427111102.76  19 10 0 0 0 0 0 0 0
2015-03-23 11:45:02,771 DEBUG 1 Timestamp : 1427111102.76
2015-03-23 11:45:02,776 DEBUG 1      Node : 19
2015-03-23 11:45:02,782 DEBUG 1    Values : [10, 0, 0, 0]
2015-03-23 11:45:02,827 DEBUG 1 Append to 'emonCMS' buffer => time: 1427111102.76, data: [19, 10, 0, 0, 0], ref: 1
2015-03-23 11:45:02,935 INFO emonCMS sending: http://localhost/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1427111102.76,19,10,0,0,0]]&sentat=1427111102
2015-03-23 11:45:03,025 DEBUG 2 NEW FRAME : 1427111103.02  19 9 0 0 0 0 0 0 0
2015-03-23 11:45:03,039 DEBUG 2 Timestamp : 1427111103.02
2015-03-23 11:45:03,050 DEBUG 2      Node : 19
2015-03-23 11:45:03,059 DEBUG 2    Values : [9, 0, 0, 0]
2015-03-23 11:45:03,303 DEBUG 3 NEW FRAME : 1427111103.3  19 8 0 0 0 0 0 0 0
2015-03-23 11:45:03,311 DEBUG 3 Timestamp : 1427111103.3
2015-03-23 11:45:03,313 DEBUG 3      Node : 19
2015-03-23 11:45:03,315 DEBUG 3    Values : [8, 0, 0, 0]
2015-03-23 11:45:03,435 WARNING emonCMS send failure: wanted 'ok' but got '<br />
<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>61</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>80</b><br />
<br />
<b>Notice</b>:  Undefined index: write in <b>/var/www/emoncms/Modules/input/input_controller.php</b> on line <b>22</b><br />
<br />
<b>Fatal error</b>:  Call to a member function fetch_array() on a non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>476</b><br />
'
2015-03-23 11:45:03,446 DEBUG 2 Append to 'emonCMS' buffer => time: 1427111103.02, data: [19, 9, 0, 0, 0], ref: 2
2015-03-23 11:45:03,454 DEBUG 3 Append to 'emonCMS' buffer => time: 1427111103.3, data: [19, 8, 0, 0, 0], ref: 3
2015-03-23 11:45:03,552 DEBUG 4 NEW FRAME : 1427111103.55  19 7 0 0 0 0 0 0 0
2015-03-23 11:45:03,559 INFO emonCMS sending: http://localhost/emoncms/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1427111102.76,19,10,0,0,0],[1427111103.02,19,9,0,0,0],[1427111103.3,19,8,0,0,0]]&sentat=1427111103
2015-03-23 11:45:03,577 DEBUG 4 Timestamp : 1427111103.55
2015-03-23 11:45:03,586 DEBUG 4      Node : 19
2015-03-23 11:45:03,604 DEBUG 4    Values : [7, 0, 0, 0]
2015-03-23 11:45:03,841 DEBUG 5 NEW FRAME : 1427111103.84  19 6 0 0 0 0 0 0 0
2015-03-23 11:45:03,855 DEBUG 5 Timestamp : 1427111103.84
2015-03-23 11:45:03,869 DEBUG 5      Node : 19
2015-03-23 11:45:03,871 DEBUG 5    Values : [6, 0, 0, 0]
2015-03-23 11:45:03,985 WARNING emonCMS send failure: wanted 'ok' but got '<br />
<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>61</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>80</b><br />
<br />
<b>Notice</b>:  Undefined index: write in <b>/var/www/emoncms/Modules/input/input_controller.php</b> on line <b>22</b><br />
<br />
<b>Fatal error</b>:  Call to a member function fetch_array() on a non-object in <b>/var/www/emoncms/Modules/user/user_model.php</b> on line <b>476</b><br />
'

 

 

 

pb66's picture

Re: emonCMS send failure: wanted 'ok' but got '

Those error would suggest no users have been created but that raises the question where did you get the apikey from if you haven't created a user yet?

try logging into emoncms (if you have craeted a user) and run the "update and check " from the admin page

Paul

alex88's picture

Re: emonCMS send failure: wanted 'ok' but got '

Not sure how to "update and check" couldn't find an admin page on http://emoncms.org

But the same api works fine on a pre-built image. It's only with this new image I built that I'm experiencing this issue.

I noticed the emoncms database is empty, should that be like that?

 

pb66's picture

Re: emonCMS send failure: wanted 'ok' but got '

The log says "emonCMS sending: http://localhost/emoncms/input/bulk.json?apikey=......" this isn't emoncms.org it's sending to "localhost" so the admin tab/page will be found at http://IP.OF.THE.HOST/emoncms.

​The emoncms database is usually empty until you access the site via a browser, this is when the tables are created and then a user will be added to the user table when you register your first user. At that point you can log-in and get your apikey to put in emonhub.conf.

each emoncms account has it's own api keys. If you were previously sending data to emoncms.org from oemgateway you can still do that with the same apikey by specifying "http://emoncms.org" in the emoncms settings in emonhub.conf.

If, however you are trying to create a new local emoncms server on the same Pi you will need to resister a new user to get a new api as described above.

You can also do both if you prefer by creating 2 emoncms reporters in emonhub.conf (with different names eg emoncms_remote and emoncms_local) setting one to url = https://emoncms.org with your existing key and the other to url = http://localhost/emoncms and creating user and new apikey as above

Paul

coldpenguin's picture

Re: emonCMS send failure: wanted 'ok' but got '

@the op
I have been getting the same message, on a new install, however I might be having other issues as I am non-standard.
I found I didn't have a link which stated Admin
I had to log out, then log back in, and at the top-right there was now a link Admin
Clicking it, I do have an option to check the database, and mine was out of date, even though it is a new install and the initiation should have created what it needed.

In addition, I have traced some of my errors that are the same as yours down to:
1) Apache hanging
2) Something is locking out the emoncms user from the SQL database (even though it can edit the database using the emoncms web interface!)

The first can be fixed by
service apache2 restart
The second by
mysqladmin flush-hosts -p

However......
I am running a stock raspbian image, with the git emoncms at master
I am running an external MySQL server.

This is because I have a MySQL instance running with light to moderate use, so I might as well use it for any database servers. It isn't anywhere near overloaded, maybe averaging about 100 cmds per minute.
I naïvely thought that the data would be stored in th SQL database too, maybe some day.....

Just had a thought, the database lockout for my problem might be that I only authorised the user for an ipv4 address, where I also have ipv6

Anyway, I will have a bit more debugging and raise a separate thread if needs be

alex88's picture

Re: emonCMS send failure: wanted 'ok' but got '

Thanks Paul, that sorted me out there. I had missed that localhost bit.

 

Comment viewing options

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