Problem setting up EmonCMS Sync - PHP errors

Am I the only person to have actually used the Sync module in anger? :confused:
Or, am I the only person to attempt to upgrade an older EmonCMS system and use it in anger?

Should I therefore just reinstall from scratch and try from there? :thinking:
But shouldn’t the lastest GIT updates have made them functionally identical?

Not sure what to do now???

I am trying to use sync to create a clone of my setup I have just updated my sync module however when I download the ‘inputs’ I get
“Notice: Uninitialized string offset: 1 in /home/pi/sync/sync-module/sync_controller.php on line 273
Fatal error: Cannot access empty property in /home/pi/sync/sync-module/sync_controller.php on line 273”

All I can determine from this is that this line fails :-

$process_type = $process_list->$process_id[1];

HI Roger,
I’ve not seen that error. The only thing I can suggest is to update the version of the Sync module you have, and made sure you’re running the latest version of EmonCMS.


I downloaded the image “emonSD-26Oct17.img” on 11 May and I had already updated Sync today using git pull before my initial post. I have just done a git pull on emonpi then run “./emoncmsupdate” (I guess this last step probably inherently repeats the previous step?). So as far as I can tell I am fully up to date. Maybe this is data dependent, so I would be happy for you to access my data if that would help.

Is there a manual way of getting the “inputs” data from onto my emoncms raspberry pi?


Thanks @rog, Im not sure how that bug escaped me, I have now fixed it. If you pull in the latest sync module it should work.

I am running raspbian stretch dated April 18, 2018.
I have installed emoncms ( | 9.8.30 | 2018.05.08) on a Pi 3, together with the sync module updated to the latest changes.

From the local server page, I can see the sync module. I see all my feeds/inputs.
I have 3 menu entries on the side: “Inputs”, “Feeds” and “Dashboards”.

My problem: If I try to download a feed, I just get a file with a couple of bytes, basically an empty file.

I checked the emoncms.log file. Everything looks Ok, no error messages, something like this when clicking on the download button:

2018-06-21 17:24:51.782|WARN|sync_model.php|remote save
2018-06-21 17:24:52.248|WARN|sync_model.php|{“success”:true,“userid”:9143,“apikey_write”:“my_write_key”,“apikey_read”:“my_read_key”}

Anything I need to verify to successfully download my data?



I have started the script manually from the sync folder:

sudo php sync_run.php
SYNC: Starting
SYNC: Home dir: /home/pi
SYNC: Connected to Redis

What should I typically get in the console when running the above script?


Hello @daturach it sounds like the feeds are not registering in the queue of feeds to download stored in redis ‘sync-queue’. Did you install the service runner as documented in the sync module readme? GitHub - emoncms/sync: In development: Download or upload emoncms feed data between local and remote emoncms server's

Hello @TrystanLea . Thanks for your quick answer. No I haven’t. I thought it was only for the EmonPi users.
Anyway, I will install it and report back.
Thanks again for this great tool.

Ok that’s fine I wanted to check if you had it running or not. Running sync_run manually should also work, if you first click on the feeds you wish to download and then run sync_run that should then run through the feeds you wish to download.

Your trick works just fine without using the service runner.

I have now checked all my feeds. There are a few I can’t download. I don’t know if this is related to the issue
you opened in Github. Maybe you could have a quick look. Here are the IDs:

Regarding the dashboards:
At some point you said you are working on it. That’s fine. I just would like to report a message I got
when running the download process from the web interface:

Fatal error:  Uncaught Error: Call to a member function bind_param() on boolean in /home/pi/sync/sync-module/sync_controller.php:344
Stack trace:
#0 /var/www/emoncms/core.php(64): sync_controller()
#1 /var/www/emoncms/index.php(189): controller('sync')
#2 {main}
  thrown in /home/pi/sync/sync-module/sync_controller.php on line 344



1 Like

Would it not make sense to move the service-runner to the emoncms repo? We can expand the emoncms install guide to include the service-runner rather than documenting how to install the whole emonpi repo, setup and use the service-runner in each module repo that uses it.

Yes I think that’s a good idea, it makes sense that it can be used for different self-hosted setups. Perhaps to be reviewed alongside @Paul and your suggestions about wider emoncms installation changes.

When I sync’d with this I got the list of inputs with all the processing lists intact but the feed in each case was the first feed in the feed list. I went through all of the inputs correcting this but now when I display the feeds the waiting symbol appears in the browser and finally the error:

Notice: Array to string conversion in /var/www/emoncms/Theme/basic/theme.php on line 165

Also I don’t have either of my multigraphs present, shouldn’t they have copied too?

It looks to me there is a problem downloading feeds if their names contain square brackets.
I have renamed such feeds and now I can download them.
That resolved problem reported in some of my feeds.

I have still a few “ERROR” in Process list. I will try to fix them and report if I can’t.

I have fixed all my errors. The dashboards are now working. I was missing the modules…That’s why I was getting an error in “sync_controller.php on line 344”.

A few processes were on “Errors”. I just recreated them.
So far so good…

Same here, I couldn’t get the Sync module to Sync the data out, but the Backup module worked great after I deleted the folders & reset the permissions as suggest in the other thread. The Sync module then copied over all the Dashboards correctly, and the Inputs (with Process Lists) mostly OK. I had to manually fix some of the feeds it was logging to for some reason. It’s now seems to logging locally OK, a few days of testing will hopefully confirm all is well.

I have setup sync module, and now it appears in Setup area. When I fill up Host, Username, Password and press Connect, then it try to connect and failed with authentication failure. I checked Host, Username and Password in a browser for the remote host and they are correct.
When I check apache error log I can see following PHP warning and errors every time sync module is trying to connect remote host:

PHP Notice: Trying to get property ‘host’ of non-object in /home/emoncms/sync/sync-module/sync_controller.php on line 50, referer:
PHP Notice: Trying to get property ‘apikey_read’ of non-object in /home/emoncms/sync/sync-module/sync_controller.php on line 50, referer:
PHP Warning: file_get_contents(/feed/listwithmeta.json?apikey=): failed to open stream: No such file or directory in /home/emoncms/sync/sync-module/sync_controller.php on line 50, referer:
PHP Warning: Invalid argument supplied for foreach() in /home/emoncms/sync/sync-module/sync_controller.php on line 82, referer:

Looks like sync_controller cannot initialize $remote object properly.
Is there any PHP or PECL modules required for sync module to operate properly for http, as well https remote hosts?


Hello @kazak, is you remote server emoncms version up to date? The /feed/listwithmeta.json end point is relatively recent. Have you also run emoncms database update after installing the sync module?

Seems I’ve overlooked database update and sync table is missing. After database updated and sync table in place, everything is OK with sync module now. Thank you!