MQTT input into EMONCMS V Low Write - how?

I'm about to repurpose my Current Cost Bridge which in reality is a Arduino Ethernet Shield that will be running a take from Serial and output MQTT sketch that I've found here. The result will be an output of data using MQTT every 6 seconds which I want to input into the latest low write edition of OPENCMS.

Is this possible yet and if it is can anyone point me to any documentation?

pb's picture

Re: MQTT input into EMONCMS V Low Write - how?

I use an external program called mqttwarn to do this.  It has a plugin module for interfacing with EmonCMS.  Sumnerboy on this forum was heavily involved with writing both the program and the plugin so you could try contacting him if you have any issues.

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

Thanks very much.

Sadly the programmer that arrived this morning was DOA so there will be a pause before I can try it.

sumnerboy's picture

Re: MQTT input into EMONCMS V Low Write - how?

Happy to help ;).

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

The replacement programmer arrived and after a bit of a fight I think I've got the bridge spitting out MQTT messages to the pi. However doesn't the latest version, the EMONPi image have MQTT built in?

The EMONHUB / EMONCMS logs don't show anything however, although I can ping it

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

Further information, I've got 4 messages arriving at the EMONPI that I want to get into EMONCMS via MQTT (tested by shutting the Pi down and changing my desktop ip address)

Can someone advise what I need to do to get the MQTT messages below into EMONCMS? - the first 3 are power readings and the last one is temperature.

MQTT Topics below:

cc/900F25CE5FB48BC27310DC2C07E8DC0F/1/1
cc/900F25CE5FB48BC27310DC2C07E8DC0F/2/1
cc/900F25CE5FB48BC27310DC2C07E8DC0F/3/1

cc/900F25CE5FB48BC27310DC2C07E8DC0F/t

I just tried loading MQTTWARN and it can only see the EMONCMS posts from my only active Node 10, the ones above are missing, yet if I shutdown the pi and change my machines ip address to what the pi is I can see them.

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

To further update this, it seems one of my problems is the current EMONPI image has the MQTT Port Closed to the outside world, I cured this by typing  

sudo ufw allow 1883/tcp

Next question, can I subscribe to more than one topic with EMONCMS?

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

Another update - I've been assisted by Sumnerboy with MQTTWarn and discovered the MQTT > EMONCMS plugin doesn't work with the latest EMONPi partial MQTT implimentation.

HOWEVER it does work if its used to republish the MQTT messages in the form of 

emonhub/rx/1/values

emonhub/rx/2/values

Each node has a feed from one of the Current Cost Individual Appliance Monitors, and so far it seems reliable.

So in summary I have working with EMONCMS

Current Cost IAM > Current Cost ENVIR > Current Cost Bridge with different sketch > MQTTWarn on a Pi2 > EMONCMS via MQTT

​Thanks to everyone that helped!

TrystanLea's picture

Re: MQTT input into EMONCMS V Low Write - how?

Hello, good to hear you have it working!

The emoncms script that subscribes to the MQTT topic is found in:

/var/www/emoncms/Modules/nodes/nodes_mqtt_process.php

There's not a nice configuration file way of settings topics to subscribe to yet but you could add another topic manually on line 62:
https://github.com/emoncms/nodes/blob/master/nodes_mqtt_process.php#L62

the script can be restarted using:

sudo service emoncms-nodes-service restart
 

sheppy's picture

Re: MQTT input into EMONCMS V Low Write - how?

For now as its working I'll leave it be. MQTT offers many possibilities and I look forward to future developments, especially around remote relay operation which opens up many possibilities for efficiency savings.

Thanks for the reply, I thought it would be buried in there somewhere!

Comment viewing options

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