Configure Emoncms input processes for gas meter pulse count input

I am using rltamr to decode the usage transmissions from my smart gas meter. I'm using node-red to tail the rtlamr log file, and it is forwarding messages in this format to emoncms:

{gas:265672}

The number is the lifetime gas usage in cubic feet. 

I've searched the site & have an understanding of the general steps that are needed to process this input, but I seem to be setting something up incorrectly. Here is a screenshot of my current configuration:

https://www.dropbox.com/s/77enborv07r1g8g/Screenshot%202014-12-28%2009.0...

Can someone spot my error or errors in this configuration? 

jonrescca's picture

Re: Configure Emoncms input processes for gas meter pulse count input

Hi ddcarter,

​I saw in a more recent post of yours, that you managed to get your data now right, can you explain how you did this  with an screendump of the input processing?

(oops, I see the screendump already in the new post here: http://openenergymonitor.org/emon/node/6373)

ddcarter's picture

Re: Configure Emoncms input processes for gas meter pulse count input

I *think* I have the processing set up correctly, but I haven't done anything yet with adding those feeds to visualizations, etc. Let me know if you find a better way of doing any of this. 

It seems that what is missing is a clear set of documentation on each of the processing transformations - expected inputs, outputs, etc. I've seen advice to place a log to feed after the first step, verify output, move the log down in the list, verify output, etc., essentially the equivalent of adding debug statements. I think this would be unnecessary in a lot of cases if we only had clear documentation. This lack of documentation plus the inability (or lack of clearly documented ability) to delete all the data in an input while retaining the processing configuration are two huge barriers to getting started with emoncms. It ends up being a lot of trial, error, and frustration. 

chandlerbing's picture

Re: Configure Emoncms input processes for gas meter pulse count input

Hi ddcarter,

I have a setup with rtlamr that is receiving the consumption messages from my gas meter as well, how did you set yours up? I am also interested in forwarding the consumption messages to emoncms. Currently I am saving the rtlamr information in to a log file in JSON format. What I haven't been able to do is to "connect the dots" on how to get the log entries parsed and sent to emoncms. Would you be able to share how you did this?

Cheers,

Chandler 

ddcarter's picture

Re: Configure Emoncms input processes for gas meter pulse count input

Chandler,

I have rtlamr sending output to a log file in JSON format. It is started with -filterid=xx -quiet=true -logfile=xx -format=json

I then have a node-red flow set up to tail that log file. (This approach will not work on Windows -- tail is Mac or Linux only.) Nodes are tail->change->parse_json->template->emoncms. 

Tail & parse json are straightforward, no parameters.

The change node is configured to "Set the value of the message property called msg.time to msg.payload.Time". This is extracting the Time from the rtlamr log record & using it to override the message time in the message that gets passed on the remaining steps. (I'm not sure that this is having the desired effect. According to the documentation for the emoncms node, this should cause a "&time=xx" value to be placed in the emoncms url, but I don't think this is happening right now. Maybe an issue with the way the datetime is formatted in the rtlamr log. Not a problem if you are processing messages more or less in real-time, but would be an issue if you are working with store-and-forward-later log records.)

The template node extracts the Message.Consumption value from the rtlamr log's json format & creates a new json message like this: (replace "gas" with whatever you want your input to be called on emoncms)

{gas:{{payload.Message.Consumption}}}

The emoncms node is configured with the base URL of http://emoncms.org/ and with my write api key. You could do this with the standard http request node as well, but it's fairly easy to install the emoncms node from the node-red node repository. 

I will probably get around to adding some additional logic to handle any error messages in the rtlamr log, or perhaps to restart the rtl_tcp & rtlamr processes if needed. A higher-priority enhancement would be finding a way to throttle the rate at which updates are passed on to emoncms, perhaps only updating every minute, 5 minutes, etc. Updates from my meter can be as frequent as every 15 seconds. 

Hope this helps. Let me know if you come up with any enhancements. 

Regards,

David

Comment viewing options

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