Event Module not saving events - [Sorted]

Does anyone have the latest Event Module version working OK under v8.3.6?

I haven't used the event module previously on this installation, but using latest Event Module git pull, and entering my Twitter credentials (& MQTT settings) in settings, I set the event criteria and then select 'Add'.
The event is not added, and the page returns to the default event page.

I have ensured that php5-mcrypt & php5-curl are installed, updated the database & rebooted the Pi.

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

There was a bug in the new MQTT event stuff that was only fixed last night. Can you check you have the very latest code from Github? Trystan merged it about 12 hours ago.

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

Updated about 1 hour ago, so yes it's the current version.
Are you running emoncms v8.3.6?

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Hmmm - no, only v8.3.5.

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Can you check your event_settings table schema in MySql? Does it have the new mqtt columns at the end?

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

Yes, it has the 4 mqtt columns, with the corresponding values.

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Can you check your Apache (or whatever web server you are using) logs? Is there anything in there that might shed some light on what is wrong?

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

The most recent entries in the Apache log are;

[Mon Oct 06 23:14:22 2014] [error] [client 92.18.235.205] 0, referer: http://digitalnut.co.uk/emoncms/event
[Mon Oct 06 23:14:22 2014] [error] [client 92.18.235.205] 0, referer: http://digitalnut.co.uk/emoncms/event
[Mon Oct 06 23:31:50 2014] [error] [client 92.18.235.205] 0, referer: http://digitalnut.co.uk/emoncms/event
[Mon Oct 06 23:31:50 2014] [error] [client 92.18.235.205] 0, referer: http://digitalnut.co.uk/emoncms/event

 

(92.18.235.205 is my public ip address, and http://digitalnut.co.uk/ is my domain)

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Found this when I try to access your EmonCMS: 

Undefined variable: result in /var/www/emoncms/Modules/event/event_controller.php on line 135.

This is the last line in the controller, where it is returning the $result variable after doing an action.

Looking at the code (https://github.com/emoncms/event/blob/master/event_controller.php) I can't see why it would be getting to the end of that method with no $result defined. Unless $session['write'] is false - but sorry I don't understand PHP so am not sure what is populating that etc.

Maybe it is due to you trying to access this over the internet (purely guessing here)? Can you access it locally?

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

Yes, accessed it via my private IP, and get the same results.

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Sorry Paul - not sure what the problem is then. I just tested and I am able to add a new MQTT event using the latest version of the event module (but on v8.3.5). Perhaps Trystan or someone who knows more about the core EmonCMS code can comment on what might have changed in v8.3.6?

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

Thanks Ben,having looked at the changes between v8.3.5 and v8.3.6 I doubt that that update is causing the problem. But as I said earlier, I have never used the event module on this installation, so I can't say when the problem arose.

The apache error log above may hold the key...

Paul

ianw's picture

Re: Event Module not saving events - [Sorted]

I had the same problem. There is a bug in the event_schema.php module which is probably causing this. Line 38 reads

'mqtttqos' => array('type' => 'int(3)', 'default'=>0)

It should read

'mqttqos' => array('type' => 'int(3)', 'default'=>0)

(ie mqttqos only has 2 t's.)

If you fix this in event_schema.php and update the database in the admin section, you still have to drop the column in the event table with the 3 t's

To do this go to the command line and type

mysql -u username -p      

then enter the password when prompted. (use a valid username on your system, not "username"!!)

Then at the mysql prompt type the following two lines

   use emoncms;

   alter table event drop mqtttqos;

then type exit to quit mysql.

After I did this it worked.

 

 

 

 

 

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Great stuff Ian - thanks for tracking that down - I manually added those columns on my instance of EmonCMS and hence never had any problems. Apologies to all - sloppy stuff from me :(. I have just created a pull request with this fixed so hopefully Trystan will merge that soon and it will be fine going forwards.

ianw's picture

Re: Event Module not saving events - [Sorted]

That's OK. I had checked the spelling several times before I spotted it, so it took a while.

Those who haven't yet upgraded their databases they will be fine with the fixed version.

Those who have already updated will need to drop the extra column as I described above (it may work with it there, but ...?).

Paul Reed's picture

Re: Event Module not saving events - [Sorted]

Back in business, thanks guys!
Rectified the bug, removed the column with phpmyadmin and am back working.

I don't know if Trystan still has MQTT in his todo list, but it would be a massive move forward if we could get feed values published to MQTT (without having to use the event function), then we can really join things together, and get them to play nice.
I wish that I understood more about MQTT, but hasn't most of the work already been done by Jason & Ben to move this forward?

 

Paul

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

Just to make sure the correct chap gets the credit, it was Nubble/Jason who did 90% of the MQTT event coding, I just tidied it up a bit (and introduced a bug or two!) and created the pull request. All credit should really go to him :).

I am not sure what would be involved in adding MQTT publishing to the inner bowels of EmonCMS - but hopefully what Jason has done will help whoever tackles it.

sumnerboy's picture

Re: Event Module not saving events - [Sorted]

The pull request for this fix has been accepted and merged, so the latest code on GitHub should be fine now.

Comment viewing options

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