[emonCMS Raspberry Pi dev branch] Error using set settings

Hi.

When I use the "set settings" function of the API, I get the following output :

 

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 45

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 57

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 58

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 59

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 60

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 62

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 63

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 63

Warning: Creating default object from empty value in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 63

Notice: Undefined property: stdClass::$remoteapikey in /var/www/emoncms/Modules/raspberrypi/raspberrypi_model.php on line 65
{"success":true,"message":"Field updated","remotesend":false}

 

Apparently, $fields it not what it should be in

    public function set($userid,$apikey,$fields)
    {
        $fields = json_decode($fields);

 

Has anyone seen this already or should I investigate ?

BTW, I've got a cosmetic error I'm mentioning here although I doubt it would be related: In the Raspberry Pi page,

Raspberry Pi connected to emoncms user account:

the account name is not displayed. I do have a Username set in the account page.

 

TrystanLea's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

Hello Jerome, I didn't see that, but I can see why it would happen if you where not sending the set json string with all the properties present. I've fixed it by adding the isset() check to all the properties, the updated version is pushed to the master branch.

Jérôme's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

Thanks, I'll try that and keep you informed.

Which branch should I be using and sending pull requests to ? Is this the end of the dev branch ?

I was probably missing a parameter. I should check that all parameters (even newly created) are in the link in the API help page.

Anyway, even though I thought I was sending all parameters, I assumed it would work for a single parameter as well and I even tried that purposely while debugging. It's better with your fix, it provides much more flexibility.

Jérôme's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

I did a quick test with one parameter only. I didn't get any error message but it didn't work either :

my_url_to_emoncms/raspberrypi/set.json?fields={'sgroup':200}

gives me

{"success":true,"message":"Field updated","remotesend":false}

but the group is unchanged, and besides remotesend should not be false.

The settings are all unchanged, such that if I then click save in RapsberryPi tab, remotesend becomes true again and I'm back where I started.

gb095666's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

I am not sure if this is connected, but I have just upgraded both emoncms and the Raspberry Pi software using GIT and now when I go into the Raspberry PI config option I get

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_controller.php on line 27

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/raspberrypi/raspberrypi_controller.php on line 34

johny5_uk's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

If you have updated be sure to click admin in emoncms and then click update database.

 

gb095666's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

Yes, I did that, it finished ok and created some tables, if I do a check now if lists everything as ok, so I don't think that is the problem

Jérôme's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

I'm not sure it is related. In your case, it seems to be $route that is not what it should be.

The error message looks alike, but the symptom is not the same. Yet, it may well be the same cause.

gb095666's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

Yes, I was thinking that $route is not correct, I see lots of references to "localhost" in the scripts but I log onto the server using an IP address to look at the data.

http://192.168.1.150/emoncms/raspberrypi/config

Do you think thats the problem ?

Jérôme's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

I wrote :

BTW, I've got a cosmetic error I'm mentioning here although I doubt it would be related: In the Raspberry Pi page,

Raspberry Pi connected to emoncms user account:

the account name is not displayed. I do have a Username set in the account page.

 

Could this be due to the fact that I did not use

$updatelogin = true;

when moving to dev branch ?

Is it too late ?

Not sure what this does...

 

TrystanLea's picture

Re: [emonCMS Raspberry Pi dev branch] Error using set settings

Jerome, the missing username is a bug rather than any error on your part, something I missed adding back in when rebuilding the code.

Neil: It looks to me like you may have the latest version of the raspberrypi module but old version of emoncms core?

Comment viewing options

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