How to simulate data sent from EmonTx to EmonHub in order to debug a reporter?

Hi,

I am trying to build a new reporter that works with sMap. What I have figured out so far is that I have to add a new class which derives from EmonHubReporter and to override the functions:

__init__

set

_process_post

in this class. Also, I have to edit the emonhub.conf file and add the reporter there.

Once I have done this, I would like to be able to send some random data to emonhub (in the correct format: unixtimestamp,nodeid, [data1, data2..]), in order to debug my new reporter. Any suggestions on how I could accomplish this?

P.S I am new to Python, but have a lot of experience with Java and C#.

Thanks in advance

 

pb66's picture

Re: How to simulate data sent from EmonTx to EmonHub in order to debug a reporter?

The easiest way to create a simple testing script is to define a socketinterfacer in emonhub.conf (a thread  on using EmonHubSocketInterfacer) then you have an open port listening for data which you can then use one or more test script to test emonhub.

I use them quite a lot I have a folder full of "one-shot" scripts I can just fire as I need or you could use a send and sleep loop to send a hard-coded packet or even incrementing values.

In the example in the linked thread the line "frame = "10 1 2 3 4"" can be anything that results in a nodeid val1 val2 val3 ...... string or "frame". By default the unix timestamp is automatically added upon receipt, but it can be defined in emonhub.conf to accept a pre-timestamped frame by using "timestamped=True" in the socketinterfacers runtimesettings.

I hope that works for you if you need more info just holla'

Paul

xzuttz's picture

Re: How to simulate data sent from EmonTx to EmonHub in order to debug a reporter?

Nice solution and thanks for the script in the other thread :)

Comment viewing options

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