Upgrading from emonpi to v9

sheppy's picture

Re: Upgrading from emonpi to v9

Over on the main thread Tom said

"

I verified MQTT publish to emoncms inputs works: emonhub is not required.

/var/www/emoncms/scripts/phpmqtt_input.php needs to be running and can be invoked using Paul's script mentioned above.

To publish to emoncms inputs:

Make sure MQTT is enabled with proper server IP in settings.php

Make sure userid number matches your id in file /var/www/emoncms/scripts/phpmqtt_input.php

also, basetopic is set there to rx

Subscribe to rx/#
Set topic to: rx/node/key
Set message to your data

If the key is not given, it defaults to "0"

Best Regards,

Tom"

 

sheppy's picture

Re: Upgrading from emonpi to v9

,

thanks for the reply.

In settings the server is set to 127.0.0.1 as its running on the pi - does it need the actual 192.168.x.x address?

phpmqtt_input.php is running via Pauls script

On the previous version the topics containing the information were found at topic:

emonhub/rx/10/values - does this all have to change? If so where?

In phpmqtt_input.php I have 

$mqttsettings = array(
        'userid' => 1,
        'basetopic' => "rx"
    );

which is exactly the same as in the previous version, what does the userid refer to - my login or something else?

I can subscribe to emonhub/rx/# with another program and see the messages flowing which EMONCMS doesn't see.

AND changing the basetopic to "emonhub/rx" doesn't seem to do anything

Paul Reed's picture

Re: Upgrading from emonpi to v9

In settings the server is set to 127.0.0.1 as its running on the pi - does it need the actual 192.168.x.x address? YES followed by the port number

emonhub/rx/10/values - does this all have to change? If so where?
by changing whatever you are using to send the mqtt message to use rx/10 instead of emonhub/rx/10

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

OK, I've changed that and as a test I've got openhab to translate the topic

emonhub/rx/10/values to rx/10/values

I now can see the full message on rx/10/values but I only see a single value in the inputs tab and nothing in nodes where it should be.

Paul Reed's picture

Re: Upgrading from emonpi to v9

So, has a node 10 been created in 'Inputs' whose value represents the mqtt value?

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

yes but only the first value

sheppy's picture

Re: Upgrading from emonpi to v9

Fortunately the topic is a single line in EMONHUB.conf as I've just discovered, and deleting the value changes the topic to rx/10

Paul Reed's picture

Re: Upgrading from emonpi to v9

What do you mean 'the first value'?

sheppy's picture

Re: Upgrading from emonpi to v9

From an EMONTX the data is something like 284,225,1,0,236.99,36,47,58,0,0,0,0

Inputs shows 284, whereas in Nodes we have

Rx ID Name Last updated Value
1 power1 inactive W
2 power2 inactive W
3 power3 inactive W
4 power4 inactive W
5 Vrms inactive V
6 temp1 inactive C
7 temp2 inactive C
8 temp3 inactive C
9 temp4 inactive C
10 temp5 inactive C
11 temp6 inactive C
12 pulse inactive p

 

where each line should be an output of the EMONTX

Paul Reed's picture

Re: Upgrading from emonpi to v9

Well, if I string comma delimited values together, say 50,60,70,80 it works fine for me, check the format that you are using to publish the messages.

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

I think its the "values" in the topic rx/10/values that is screwing it up. Problem is I can't find where that comes from, I know the emonhub in the original topic of "emonhub/rx/10/values" came from emonhub.conf as I've managed to remove it.

Changing the topic on my other MQTT inputs makes them work so that is at least progress.

How does emoncms usually get its RFM radio inputs - maybe I can retro fit this bit alone?

Paul Reed's picture

Re: Upgrading from emonpi to v9

...via a RF add-on module & emonhub

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

Which version of emonhub - is there an updated V9 version of it or is it the one you mentioned earlier in the other thread? I need to get publish to MQTT working first before I can switch though, and that doesn't work at the moment.

1 Log to feed  test (feed last value:78.00)
2 Publish to MQTT  /test/kevin

​the feed works, but subscribing to /test/# shows no messages
 

Paul Reed's picture

Re: Upgrading from emonpi to v9

Works fine here!

It might be helpful to do a little work on the format of your mqtt messages, and how you want your overall system to work.

Good luck!
 

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

OK, I'll do further experiments to see just what I have to do to make this work. I'll start with deleting the EMONCMS folder and doing a straight install with nothing added, maybe that way publish to MQTT will work. Once I know what limitations I have on topics to make it work, I'll design a sensible topic tree. So far I've just used topics I haven't used before so I know anything new hasn't appeared before.

sheppy's picture

Re: Upgrading from emonpi to v9

I've tried renaming the emoncms instance, following the precedure on the other thread to git clone a new v9 and then renaming emonhub and installing a new one again from the procedure on the other page. It still didn't work and as a bonus the updates on the original when I restored them back was intermittent so I've restored the lot from an image.

I've then downloaded a fresh emonpi image to a blank memory card, checked the emontx was reporting values before I ran the update script. I then renamed emoncms to oldemoncms and git cloned v9. I ran the phpmqtt_input.php from a command prompt and after editing /home/pi/data/emonhub.conf to change the topic from emonhub/rx to rx I can see the messages flowing. Again only the first value is viewable because the word "values" is listed in the keys column on the inputs page. I then discovered I can't create feeds because the feed name already exists - it doesn't as this is a blank image, and the feeds tab sits there saying updating. The path the the feed engine I was trying to use exists but the location is empty as this is a new image with no feeds created. I then added publish to MQTT as the only action and no messages were published, although this may be misleading due to the feeds page being broken.

For now I think I've hit a blank and I'll live in hope that someone more knowledgeable than I can work out where the word "values" is coming from (my guess is possibly /home/pi/emonhub/src/interfacers/EmonHubMqttInterfacer.py which is linked to /usr/share/emonhub) Once this word no longer appears, the inputs may start to display all the values rather than the first one. Then the broken feeds page can be fixed etc.

I'll be out and about when the day shift returns so I'll wish whoever picks up this challenge good luck in finding what it is that needs to be done.

Paul Reed's picture

Re: Upgrading from emonpi to v9

I've then downloaded a fresh emonpi image to a blank memory card...and git cloned v9

Why download an image of specific software, and then try & change it? Wouldn't it be less problematic to simply follow the normal emoncms installation guide?

Paul

pb66's picture

Re: Upgrading from emonpi to v9

Without some input from Trystan you will need to delve into the code to decipher what there is, what you need and if that can be done in the settings or requires edits to the code.

For example the "inputs" topic appears to be hard coded in EmonHubMqttInterfacer.py#L96, you can try editing in your local copy to see if that resolves anything but if you are getting a single input value then I suspect there may be a message format issue, I couldn't find all the relevant parts to confirm that either way when I looked.

What is your end goal? I know you are trying to get v9 emoncms working but what are your overall requirements?

As Paul says why not create your own image? the image you have chosen is quite unique version wise as the "emon-pi" variant of emonHub and the "v8.5 low-write with the nodes module instead of a inputs module" are pretty much dedicated to each other.

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

Hi Paul and Paul,

My Goal is to upgrade whist retaining both the MQTT outputs from the incoming EMONTX data which I use as inputs into OpenHAB, and the monitoring data that I've accumulated so far. A lot of systems in my house rely on this so reinventing everything to do without MQTT will be time consuming and very disruptive, if indeed the OpenHAB Binding works with V9. I perhaps naively assumed that as the EMONPI was the latest energy monitoring system from the shop that it was going to be the one to follow into the future, especially as the image worked quite well out of the box and had been standardised for both EMONPI and the RFM69 module.

I downloaded another copy of the image as I was trying to isolate what on my setup if anything was causing this not to work. I also wanted a debugging environment that doesn't upset what I've got running reliably everytime I needed to try something to see if it fixes the problem.

Is it likely that the EMONPI Image will become a dead end development wise and those that are interested in V9 need to start again?

Kevin

Paul Reed's picture

Re: Upgrading from emonpi to v9

...Is it likely that the EMONPI Image will become a dead end development wise...

No, I would say most unlikely, because it was primarily written to support the emonpi hardware. It's just that v9 is in the spotlight at the moment because it is being actively developed by a third party.

Like most new product releases, any major issues experienced by users are being addressed fairly swiftly, and I'm sure that T & G are taking on board all feedback, and will make updates in due course.

Paul

pb66's picture

Re: Upgrading from emonpi to v9

"the MQTT outputs from the incoming EMONTX data which I use as inputs into OpenHAB" Do you mean emonhub posting the data it has received from the emonTx direct to openHab or the "publish to mqtt" from  emoncms? or both?

Currently only the "emon-pi" variant of emonHub and v8.5 low-write intercommunicate by mqtt so you are a bit tied to that image unless you construct your own image with a little chopping and hacking as the various bits are not as readily interchangeable as they could be , unless you just use the "publish to mqtt" processes.  

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

I use the v8.5 low-write intercommunicate by MQTT version, this version doesn't have a "publish to mqtt" from EMONCMS option, or if it does I can't find out how to enable it.

Using it this way I do need to double handle some inputs to get them added together in both EMONCMS and in OpenHAB, but it seems to work and I haven't hit the hardware limits yet.

I also don't have anywhere near enough knowledge to hack my own version so for now I'll sit back and hope that one day a MQTT compliant upgrade route appears for the EMONPI image.

Kevin

Paul Reed's picture

Re: Upgrading from emonpi to v9

What is your main difficulty in following the standard installation guide for v9?

That version would provide not perfect, but probably workable MQTT publish & subscribe, am I missing something?

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

I had no inputs when I did that and adding the nodes module gave me all my current inputs listed as they are in my current version but they didn't  update. Looking in the logs Emonhub was publishing them as MQTT and Openhab which is also running on the Pi saw them, so that bit was still working, but v9 did not. Starting the MQTT input script and changing the EMONHUB topics allowed the first output from my EMONTX to appear in "inputs" but the published topic having /values on the end seems to cause only the first one to appear. So to get it to work, I suspect it either needs EMONHUB to stop putting "values" on the end of the topic RX/10/Values or for EMONCMS V9 to work with it and spit the comma separated values into individual inputs as happens now in the V8.5 Low Write EMONPI Nodes module. My concern also is even if I do find out where "/values" and stop it that in the future an update will break it again.

Take a look at the bottom of the main V9 thread, it's all in there

Paul Reed's picture

Re: Upgrading from emonpi to v9

I had no inputs when I did that...

Did you do that - or did you download an emonpi image, delete the emoncms folder & install v9?? - which is the wrong way to go about it, for the reasons stated above.

Paul

sheppy's picture

Re: Upgrading from emonpi to v9

I've tried many different things, none of which worked, needing to retain a working system did limit the things I could do, which resulted ultimately in downloading the emonpi image onto a replacement card to see whether I could at least prove that it could be made to work without scrapping everything and starting again.

For now I've spent way too long on V9, so I've walked away until a definitive working upgrade path appears for the emonpi image, if it doesn't I'll stay on 8.5 VLow Write as it works albeit without the latest features 

JBlackham's picture

Re: Upgrading from emonpi to v9

I wish there was a V9 image that I could just flash my pi with an use with the EmonTX.  Sadly after many days I am walking away from this defeated.  

maze42's picture

Re: Upgrading from emonpi to v9

I have the same setup as sheepy (emoncms v 9, openhab and emonhub) and also run into this problem with the "/values" in the end of the mqtt messages sent from emonhub. I can´t see any input in emoncms but have no problem to get Txnode data into openhab from emonhub. 

Paul Reed's picture

Re: Upgrading from emonpi to v9

maze42's picture

Re: Upgrading from emonpi to v9

yes, I hear what you say, but I still  don`t know how to make emonhub not sending the last "/values" part of the mqtt message to emoncms. I must have missed some important part of the installation procedure.

Comment viewing options

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