Feeds stopped working after firmware and emoncms upgrade

I had installed emoncms version dated around Dec 2016 and wanted to upgrade to the lastest version to use some of the new features, I have preformed the update using local emoncms by updated emoncms base. After the update I have done the database update and check. It applied an update and then was clear and then I rebooted the unit.
After rebooting , my feeds stopped working.
When I check the nodes, it seems there is a problem to log to feed and power to Kwh entried as they seem to have been delete or just not there with errors : “Feedid 29 does not exists or was deleted”
What could be causing this issue and how to fix it?

my current version is:

Emoncms Version low-write 9.8.7 | 2017.06.16
Modules admin app backup config dashboard eventp feed graph input postprocess process schedule setup time user vis wifi
Buffer 24 feed points pending write
Writer Daemon is running with sleep 60s
Server OS Linux 4.1.19-v7+
Host emonpi emonpi (127.0.1.1)
Date 2017-07-30 09:16:30 UTC
Uptime 09:16:30 up 6 min, 0 users, load average: 0.09, 0.24, 0.16
HTTP Server Apache/2.4.10 (Raspbian) HTTP/1.1 CGI/1.1 80
Database Version MySQL 5.5.44-0+deb8u1
Host localhost (127.0.0.1)
Date 2017-07-30 09:16:30 (UTC 00:00‌​)
Stats Uptime: 406 Threads: 3 Questions: 1323 Slow queries: 0 Opens: 58 Flush tables: 1 Open tables: 51 Queries per second avg: 3.258
Redis Version 2.8.17
Host localhost:6379 (127.0.0.1)
Size 63 keys (521.63K)Flush
Uptime 0 days
MQTT Version 1.4.8
Host localhost:1883 (127.0.0.1)

It makes a refreshing change to see the System Information posted, but can you post your emoncms log pls.

Paul

Hi, thanks for reply, below is the last entries on the log as well as the update log.

View last entries on the logfile: /var/log/emoncms.log

Auto refresh Download Log

2017-07-30 09:09:53.611|WARN|phpmqtt_input.php|Starting MQTT Input script
2017-07-30 09:09:55.057|WARN|phpmqtt_input.php|Subscribing to: emon/#
2017-07-30 09:09:55.057|WARN|phpmqtt_input.php|Not connected, retrying connection
2017-07-30 09:09:55.058|WARN|phpmqtt_input.php|Connecting to MQTT server: Connection Accepted.: code: 0
2017-07-30 09:09:55.058|WARN|phpmqtt_input.php|Subscribed to topic: emon/#
2017-07-30 09:09:58.928|WARN|phpmqtt_input.php|Starting MQTT Input script
2017-07-30 09:10:00.062|WARN|phpmqtt_input.php|Subscribing to: emon/#
2017-07-30 09:10:00.063|WARN|phpmqtt_input.php|Not connected, retrying connection
2017-07-30 09:10:00.063|WARN|phpmqtt_input.php|Connecting to MQTT server: Connection Accepted.: code: 0
2017-07-30 09:10:00.064|WARN|phpmqtt_input.php|Subscribed to topic: emon/#

 

UPDATE LOG:

I2C LCD DETECTED Ox27
Starting emonPi Update >
via service-runner-update.sh
EUID: 1000
Argument: rfm69pi
Sun 30 Jul 09:07:40 UTC 2017
#############################################################

emonSD version: emonSD-03May16

emonSD base image check passed...continue update

#############################################################
Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
git pull /home/pi/emonpi
* master
  wifiap
On branch master
Your branch is behind 'origin/master' by 161 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   .gitignore
	modified:   .travis.yml
	modified:   README.md
	modified:   docs/SD-card-build.md
	modified:   emoncmsupdate
	modified:   emonpiupdate
	modified:   factoryreset
	modified:   firmware/compiled/latest.hex
	modified:   firmware/compiled/readme.md
	modified:   firmware/libraries/Readme.md
	modified:   firmware/platformio.ini
	modified:   firmware/readme.md
	modified:   firstbootupdate
	modified:   lcd/emonPiLCD.py
	modified:   lcd/emonPiLCD_update.py
	modified:   lcd/lcd_test.py
	modified:   lcd/lcddriver.py
	modified:   logrotate.conf
	deleted:    master
	modified:   rc.local_jessieminimal
	modified:   service-runner
	modified:   service-runner-update.sh
	modified:   sudo_crontab
	modified:   sudoers
	modified:   update
	modified:   wifiAP/hostapd.conf
	modified:   wifiAP/wifiAP.sh

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	1
	UDPBroadcast/
	bash-rw-indicator
	emoncms-filesystem
	emoncms-setup/
	emonhub-sudoers
	firmware/compiled/archive/emonPi_V2.7.hex
	firmware/compiled/archive/emonPi_V2.8.1.hex
	firmware/compiled/archive/emonPi_V2.8.2.hex
	firmware/compiled/archive/emonPi_V2.8.hex
	firmware/test_sketches/i2c_scan/
	hardware/emonpi/emonpi2c/
	md5sum.py
	motd
	ntp_update.sh
	rfm69piupdate.sh
	wifiAP/networklog.sh
	wifiAP/startAP.sh
	wifiAP/stopAP.sh
	wifiAP/wpa_supplicant_check.conf

no changes added to commit (use "git add" and/or "git commit -a")
Updating 857eae4..31f25b4
git pull /home/pi/RFM2Pi
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/emonhub
  K0den-wibeee_interface
* emon-pi
  hmm01i-syslogging
On branch emon-pi
Your branch is up-to-date with 'origin/emon-pi'.
nothing to commit, working directory clean
Already up-to-date.
git pull /home/pi/oem_openHab
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
git pull /home/pi/usefulscripts
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
git pull /home/pi/huawei-hilink-status
* master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

Running RFM69Pi firmware update:
RFM69Pi Update Started
date
Getting latest RFM69Pi release info from github
Latest RFM69Pi firmware: V1.4.0
downloading latest RFM69Pi firmware from github releases:
https://github.com/openenergymonitor/RFM2Pi/releases/download/1.4.0/firmware.hex
Saving to /home/pi/data/firmware/rfm69pi-1.4.0.hex

=================================
RFM69Pi update started
=================================

Flashing RFM69Pi with V 1.4.0

avrdude-original: Using autoreset DTR on GPIO Pin 7
Flashing RFM69Pi with V 1.4.0  done


Start emonhub update script:

=================================
EmonPi update started
=================================
Running emonhub automatic node addition script
EUID: 1000
EUID: 1000
[[5]]
Node 5 already present
[[6]]
Node 6 already present
[[7]]
Node 7 already present
[[8]]
Node 8 already present
[[9]]
Node 9 already present
[[10]]
Node 10 already present
[[11]]
Node 11 already present
[[12]]
Node 12 already present
[[13]]
Node 13 already present
[[14]]
Node 14 already present
[[19]]
Node 19 already present
[[20]]
Node 20 already present
[[21]]
Node 21 already present
[[22]]
Node 22 already present
[[23]]
Node 23 already present
[[24]]
Node 24 already present
[[25]]
Node 25 already present
[[26]]
Node 26 already present

Start emoncms update:

=================================
Emoncms update started
Update script V1.1.0

Sun 30 Jul 09:08:10 UTC 2017

#############################################################

emonSD version: emonSD-03May16

emonSD base image check pass...continue update

#############################################################
EUID: 1000
Checking cron tab for service runner entry...
service runner crontab entry already installed

current settings.php md5: 4f7cff355dc044a298ce2083a6c366a2
Default settings.php md5: 4f7cff355dc044a298ce2083a6c366a2

git pull /var/www/emoncms
  dev-mosquitto-php
  master
* stable
  symlinked_modules
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.

NEW default settings.php md5: 4f7cff355dc044a298ce2083a6c366a2
settings.php had NOT been user modifed
No update required to settings.php


git pull /var/www/emoncms/Modules/app
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/config
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/wifi
  9.0
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.
git pull /var/www/emoncms/Modules/dashboard
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /var/www/emoncms/Modules/graph
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.

git pull /home/pi/postprocess
Your branch is up-to-date with 'remotes/origin/emonpi'.
Already up-to-date.
git pull /home/pi/backup
  master
* stable
On branch stable
Your branch is up-to-date with 'origin/stable'.
nothing to commit, working directory clean
Already up-to-date.
Your branch is up-to-date with 'origin/stable'.
Cannot find emoncms-setup module, please update ~/emonpi repo

update mqtt_input systemd unit file

Update Emoncms database
[]

Restarting Services...
Restarting OpenEnergyMonitor emonHub: emonhub has been restarted ok.
Log is turned off
Restarting feedwriter

Restarting openhab (via systemctl): openhab.service.


set log rotate config owner to root
Restarting Services...


Starting emonPi LCD service..

Filesystem is locked - Read Only access
type ' rpi-rw ' to unlock
Sun 30 Jul 09:09:07 UTC 2017


...................
emonPi update done

Anyone with any idea of what could be causing the problem?

How to do install the econcms from scratch on the emonpi and start afresh? It seems that the database has been corrupted?

Hi @philip

Sorry to hear you’re having trouble. All looks correct from your update log and emoncms log. Could I trouble you to also provide your emonhub log? This can be downloaded from local Emoncms under Setup > emonHub

The Emoncms log details are as follows:

2017-08-02 22:11:37,656 INFO     RFM2Pi     Publishing: emon/emonpi/rssi 0
2017-08-02 22:11:37,657 INFO     RFM2Pi     Publishing: emonhub/rx/5/values -1338,1389,51,216.55,0,0,0,0,0,0,0
2017-08-02 22:11:37,659 INFO     RFM2Pi     Publishing: emonhub/rx/5/rssi 0
2017-08-02 22:11:37,661 DEBUG    RFM2Pi     60990 adding frame to buffer => [1501711897.627707, 5, -1338, 1389, 51, 216.55, 0, 0, 0, 0, 0, 0, 0]
2017-08-02 22:11:37,661 DEBUG    RFM2Pi     60990 Sent to channel(end)' : ToEmonCMS
2017-08-02 22:11:38,367 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 16 36 32 50 165 160 0 8 48 72 134 32 0 0 0 5 182 160 21 176 64 (-107)
2017-08-02 22:11:39,088 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 0 32 32 2 32 0 10 29 64 51 224 0 29 204 3 0 16 0 60 32 24 (-108)
2017-08-02 22:11:39,193 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 30 32 136 131 192 20 108 173 16 0 32 32 14 60 130 54 168 156 0 0 32 (-105)
2017-08-02 22:11:40,422 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 0 0 0 0 53 20 108 173 16 0 32 32 14 60 130 54 168 156 0 0 32 (-105)
2017-08-02 22:11:42,667 DEBUG    RFM2Pi     60991 NEW FRAME : OK 5 229 250 83 5 56 0 183 84 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
2017-08-02 22:11:42,671 DEBUG    RFM2Pi     60991 Timestamp : 1501711902.67
2017-08-02 22:11:42,671 DEBUG    RFM2Pi     60991 From Node : 5
2017-08-02 22:11:42,672 DEBUG    RFM2Pi     60991    Values : [-1307, 1363, 56, 216.87, 0, 0, 0, 0, 0, 0, 0]
2017-08-02 22:11:42,673 DEBUG    RFM2Pi     60991 Sent to channel(start)' : ToEmonCMS
2017-08-02 22:11:42,673 INFO     RFM2Pi     Publishing: emon/emonpi/power1 -1307
2017-08-02 22:11:42,675 INFO     RFM2Pi     Publishing: emon/emonpi/power2 1363
2017-08-02 22:11:42,677 INFO     RFM2Pi     Publishing: emon/emonpi/power1pluspower2 56
2017-08-02 22:11:42,681 INFO     RFM2Pi     Publishing: emon/emonpi/vrms 216.87
2017-08-02 22:11:42,683 INFO     RFM2Pi     Publishing: emon/emonpi/t1 0
2017-08-02 22:11:42,685 INFO     RFM2Pi     Publishing: emon/emonpi/t2 0
2017-08-02 22:11:42,687 INFO     RFM2Pi     Publishing: emon/emonpi/t3 0
2017-08-02 22:11:42,689 INFO     RFM2Pi     Publishing: emon/emonpi/t4 0
2017-08-02 22:11:42,691 INFO     RFM2Pi     Publishing: emon/emonpi/t5 0
2017-08-02 22:11:42,693 INFO     RFM2Pi     Publishing: emon/emonpi/t6 0
2017-08-02 22:11:42,695 INFO     RFM2Pi     Publishing: emon/emonpi/pulsecount 0
2017-08-02 22:11:42,697 INFO     RFM2Pi     Publishing: emon/emonpi/rssi 0
2017-08-02 22:11:42,699 INFO     RFM2Pi     Publishing: emonhub/rx/5/values -1307,1363,56,216.87,0,0,0,0,0,0,0
2017-08-02 22:11:42,701 INFO     RFM2Pi     Publishing: emonhub/rx/5/rssi 0
2017-08-02 22:11:42,703 DEBUG    RFM2Pi     60991 adding frame to buffer => [1501711902.667567, 5, -1307, 1363, 56, 216.87, 0, 0, 0, 0, 0, 0, 0]
2017-08-02 22:11:42,704 DEBUG    RFM2Pi     60991 Sent to channel(end)' : ToEmonCMS

Ok, all looks good from the emohub log. I can see the emonPi is working and data s reaching MQTT. I can see power1: -1307W and power2: 1363W.

Is the issue that local Emoncms is not updating and or remote emoncms e.g emoncms.org?. If local emoncms is not updating the issue must be with the MQTT input script.

Can you connect via SSH then run:

sudo systemctl status mqtt_input.service

It should say that the MQTT input service is active (running). You can try restarting the service:

sudo systemctl restart mqtt_input.service

Have you tried to reboot the emonPi unit after performing the update?

Ok, this is the output from ssh below. The MQTT was running, I have restarted MQTT and rebooted.

SSH…
[email protected]’s password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

The file system is in Read Only (RO) mode. If you need to make changes,
use the command ‘rpi-rw’ to put the file system in Read Write (RW) mode.
Use ‘rpi-ro’ to return to RO mode. The /home/pi/data directory is always in RW m ode.

pi@emonpi(ro):~$ sudo systemctl status mqtt_input.service
● mqtt_input.service - Emoncms MQTT Input Script
Loaded: loaded (/etc/systemd/system/mqtt_input.service; enabled)
Active: active (running) since Sun 2017-07-30 09:09:58 UTC; 4 days ago
Docs: https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT. md
Main PID: 1936 (php)
CGroup: /system.slice/mqtt_input.service
└─1936 /usr/bin/php /var/www/emoncms/scripts/phpmqtt_input.php

Warning: Journal has been rotated since unit was started. Log output is incomple te or unavailable.
pi@emonpi(ro):~$ sudo systemctl restart mqtt_input.service


After the update I did reboot. The issue seems that when I go to the input page, the values are there which are correct but the process list has “wait…” against it. Then if I go to the Feeds page, nothing shows up and it seems to be waiting to load something.
I have attached some images.


I have the emonpi linked to emoncms.org and all the feeds seem to be updating there fine but something wrong on the local emonpi.

Thanks a lot for that. This is intriguing, so the issue is not with the mqtt input script. The data is successfully reaching emoncms inputs but there is obviously a something wrong with emoncms.

Does your browser developer tools give us any clues? Ctrl + shift + I on chrome to open the dev tools. Then refresh the page.

I use chromium and have tried just now with firefox with the same result.
On firefox I managed to get access to the dev tools and checked for the javascript error logs when on the Feeds pages which does not load. The following errors seem to be related to the page if I have checked correctly. I cannot seem to find any errors with Chrome dev tools.

I think it is trying to load a file; resource://gre/modules/services-common/blocklist-clients.js and is having some problem. Seems very strange. Maybe it is related to the database missing fields or something got corrupted so it cannot fetch any data. Should I do a fresh install on emonpi? How to do that?

Very sorry I’m not sure what’s going on here. Never seen this before. I have asked my colleague @TrystanLea to take a look. He will be in touch early next week.

Hello @philip Could you post the result of emoncms/feed/list.json?

Hi Trystan, could you provide me some basic steps how to get the results from emoncms/feed/list.json ?
I cannot find a way to download that through the administration section of emoncms. Do I have to get this data through SSH?

SSH is not needed. Go to the Feeds web page. Then add .json to the URL.

Mine is:

http://emonpi.localdomain/emoncms/feed/list

becomes:

http://emonpi.localdomain/emoncms/feed/list.json

Thanks Jon

results are:

Fatal error: Uncaught exception ‘Exception’ with message ‘DateTimeZone::__construct(): Unknown or bad timezone ()’ in /var/www/emoncms/Modules/schedule/schedule_model.php:194 Stack trace: #0 /var/www/emoncms/Modules/schedule/schedule_model.php(194): DateTimeZone->__construct(’’) #1 /var/www/emoncms/Modules/schedule/schedule_model.php(147): Schedule->match_engine(NULL, NULL, ‘1501941600’, false) #2 /var/www/emoncms/Modules/schedule/schedule_processlist.php(54): Schedule->match(‘2’, ‘1501941600’) #3 [internal function]: Schedule_ProcessList->if_not_schedule_zero(‘2’, ‘1501941600’, 2926.8198762981, Array, Object(Process)) #4 /var/www/emoncms/Modules/process/process_model.php(60): call_user_func_array(Array, Array) #5 /var/www/emoncms/Modules/process/process_model.php(103): Process->__call(‘schedule__if_no…’, Array) #6 /var/www/emoncms/Modules/process/process_model.php(103): Process->schedule__if_not_schedule_zero(‘2’, ‘1501941600’, 2926.8198762981, Array) #7 /var/www/emoncms/Modules/feed/engine/VirtualFeed.php(84): Process in /var/www/emoncms/Modules/schedule/schedule_model.php on line 194

Thanks @philip, the quick fix might be to set your timezone in the emoncms account profile page.
You can do this by going to Setup > My Account and selecting your timezone from the dropdown menu.

We will look into the error and how to catch it so that it fails more graciously (if it is the result of a missing timezone setting) in the mean-time.

hmm, I have checked the time zone and it is correct and not missing. I have changed it to a similar time zone, rebooted and checked the feeds but the problem is still there.
I think it is not that the timezone is missing but maybe it has the wrong format or something else. The json file still shows the same error…

Please could you try and run emonPi update again? We have just made a stable release of Emoncms V9.8.8 which should have fixed this issue.

See discussion on this thread on this thread:

ok, I have done emonpi update to version 9.8.8, rebooted and have the same problem with the feeds page trying to load. I get the same json error below on the feed page. I did have virtual feeds before but I think my problem is slightly different to that of the other forum topic.
It seems for others the virtual feeds stopped working but normal feeds were ok. In my case both normal and virtual feeds will not display on the feeds page.
I am thinking maybe the best way is to do a fresh install of the latest version. What would be the best way to do that? I think something got corrupted and it might take a long time to work out what it actually is.

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone ()' in /var/www/emoncms/Modules/schedule/schedule_model.php:194 Stack trace: #0 /var/www/emoncms/Modules/schedule/schedule_model.php(194): DateTimeZone->__construct('') #1 /var/www/emoncms/Modules/schedule/schedule_model.php(147): Schedule->match_engine(NULL, NULL, '1502114400', false) #2 /var/www/emoncms/Modules/schedule/schedule_processlist.php(54): Schedule->match('2', '1502114400') #3 [internal function]: Schedule_ProcessList->if_not_schedule_zero('2', '1502114400', 2930.4362792969, Array, Object(Process)) #4 /var/www/emoncms/Modules/process/process_model.php(60): call_user_func_array(Array, Array) #5 /var/www/emoncms/Modules/process/process_model.php(103): Process->__call('schedule__if_no...', Array) #6 /var/www/emoncms/Modules/process/process_model.php(103): Process->schedule__if_not_schedule_zero('2', '1502114400', 2930.4362792969, Array) #7 /var/www/emoncms/Modules/feed/engine/VirtualFeed.php(84): Process in /var/www/emoncms/Modules/schedule/schedule_model.php on line 194

Any Idea? Anyone?