Serial-Direct connection between Pi and emonTx shield

Okay, we’re getting somewhere maybe as that extra line would have prevented emonHub starting, so remove that and try again. With the corrected url you should be in business (fingers crossed)

No, it’s not the point. :frowning:
I guess there are troubles with the permissions of the files and not only of the logfiles.
ie. /var/log/emonub/emonhub.log has never been changed since I first installed it (13.November 2016)
owner is emonhub in group root with rights -rw-r--r--
Not sure this is correct.

it is normally user emonhub and group emonhub, you can change it with

sudo chown emonhub:emonhub /var/log/emonhub/emonhub.log

but the files are recreated at every reboot so you should try rebooting and recheck the ownership afterwards too.

problem is, I’m not sure with which user I’ve installed emonhub.
I’m using user laci (instead of the initial pi) to login with ssh but using root if I’m about to changing something on the RPI.
I guess I have to reinstall all of the stuff from the beginning to get it working.
If I try to upgrade emonhub:

root@raspberrypi:/home/laci# git clone GitHub - emonhub/dev-emonhub: Script to install emonHub from git for development purposes ~/dev-emonhub && ~/dev-emonhub/upgrade
Cloning into ‘/root/dev-emonhub’…
remote: Counting objects: 98, done.
remote: Total 98 (delta 0), reused 0 (delta 0), pack-reused 98
Unpacking objects: 100% (98/98), done.
Checking connectivity… done.
emonHub is already installed, exiting without installing

seems all OK. But not.
any guess what all shouldbe removed before running a new installation?

The install script is designed to be used by the user not root.

using the root user will have installed the files to the root users home directory not to the users home directory. changing to a different user called “root” is not the same thing as escalating a user to use root privileges. the norm here and most places I visit is to use “sudo” to temporarily escalate a users privileges for the purpose of doing “root” tasks, the reason there is no root user login enabled by default on a Raspbian OS ( and Debian I believe) is that it is considered an unnecessary security risk. Each to there own though and if you prefer to use 2 profiles instead of one, that’s fine, you just need to translate “single user plus sudo” instructions and guides as you go.

To uninstall emonhub cleanly you will need to go through the install script to locate and delete all the symlinks that will currently be pointing to /root/emonhub instead of /home/laci/emonhub, all the ~/ paths mean current users home directory so you can see how changing user causes an issue.

thank you.
I will go through.
(seems not to be an easy way. :slight_smile: )
But I’ve days off until next monday. So time enough. :slight_smile:

so your suggestion is to do the reinstalling with the RPI’s default user?

I love the opensource community.
There is promptly much help.
Thank you All, however we are not at the end.
:slight_smile:
But I’m still optimistic. :slight_smile:

It’s tricky for me to make a recommendation as I do not know your skill level, but off the cuff, if you do not have any data collected on this system yet and you are still building, I might be inclined to start a fresh image because I assume you have used the same 2 user approach to installing emonCMS and possibly other stuff, so there’s no telling when another “difference” may come to light, possibly after spending days trying to resolve an issue.

Have a read of these 2 links, the first tells you how to add a new user (eg laci) to the “sudoers” list and then the second tells of the (minimum) additional precautions you should make if you insist on a root user account enabled. Both state that you would not ordinarily nor should you need to enable root user login.

https://www.raspberrypi.org/documentation/linux/usage/root.md

https://www.raspbian.org/RaspbianFAQ#How_do_I_make_a_proper_root_account.3F

If you have nothing of value on this image, you might want to start over and create a “laci” user with sudoer privileges and re-install everything as “laci” using sudo as needed. But to be honest unless you are going to be logging in and using this as a workstation there is little to be gained by using a different user name and you will always need to translate “pi” to “laci” every time you read install to “/home/pi” or “set ownership to pi:pi” etc etc.

I always tend to use the pi user as it is more portable and universal for sharing scripts and commands etc.

I see.
I will reinstall all with pi
Will come back soon.
thanks again.

Reinstalled emonhub with a normal user and managed to get entries in emonhub.log, but can’t locate any hints for the portto be used.

2017-01-06 09:21:46,581 INFO EmonHub Pre-Release Development Version (rc1.2)
2017-01-06 09:21:46,582 INFO Opening hub...
2017-01-06 09:21:46,583 INFO Logging level set to DEBUG
2017-01-06 09:21:46,583 INFO Creating EmonHubEmoncmsReporter 'emonCMS'
2017-01-06 09:21:46,585 INFO Set up reporter 'emonCMS' (buffer: memory | size: 1000)
2017-01-06 09:21:46,601 INFO Setting emonCMS url: http://localhost/emoncms
2017-01-06 09:21:46,602 INFO Setting emonCMS apikey: set

2017-01-06 09:29:53,933 DEBUG SIGINT received.
2017-01-06 09:29:53,934 INFO Exiting hub...
2017-01-06 09:29:53,975 INFO Exit completed

2017-01-06 09:30:40,836 INFO EmonHub Pre-Release Development Version (rc1.2)
2017-01-06 09:30:40,837 INFO Opening hub...
2017-01-06 09:30:40,839 INFO Logging level set to DEBUG
2017-01-06 09:30:40,840 INFO Creating EmonHubEmoncmsReporter 'emonCMS'
2017-01-06 09:30:40,842 INFO Set up reporter 'emonCMS' (buffer: memory | size: 1000)
2017-01-06 09:30:40,843 INFO Setting emonCMS url: http://localhost/emoncms
2017-01-06 09:30:40,844 INFO Setting emonCMS apikey: set

Running screen again on /dev/ttyACM0 gave first reliable values but stopped at the fifth line as shown below.

10 -601.09 1.61 999.19 6.37 242.22
10 -599.09 -2.74 1008.47 9.85 242.40
10 -609.24 5.25 1000.19 -1.91 242.35
10 -598.75 -4.65 1004.87 8.

Your log shows 2 set-up cycles with an “exit” to restart in between them. however there is no evidence of any attempt to create any interfacers so I suspect there is an issue with emonhub.conf in the part that should read

[interfacers]
    [[Serial]]
        type = EmonHubSerialInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyACM0
            com_baud = 9600
        [[[runtimesettings]]]

check in particular the spelling of the interfacer type and that the interfacer name is unique, attach it here again if you are unsure.

Unfortunately I cannot explain that, except I must point out that only one software can have reliable access to any serial (USB) device at any one time, if it’s not an exclusive connection then the results may well not be what you expect. Plus, I am not familiar with Screen.

Focus on getting emonHub to at least attempt a connection first, you should see lines like “Creating EmonHubSerialInterfacer ‘Serial’” and “Attempting connection at 9600 baud” etc

emonhub.conf shows exactly what you suggest.
[interfacers]

[[Serial]]
    type = EmonHubSerialInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyACM0
        com_baud = 9600
    [[[runtime_settings]]]

So I guess the best at this point is to start with a brand new image and avoiding 2-user approach.

Just spotted the error, the “[[[runtimesettings]]]” should not be hyphenated!!!

Sorry, I made the mistake of previously copy and pasting from the conf you included. I do not know where that has come from but it should not be there.

Try it again with out the hyphen.

Unfortunatelly it wasn’t the rootcause.
Still the same entries in emonhub.conf, nothing like you mentioned[quote=“pb66, post:57, topic:2611”]
“Creating EmonHubSerialInterfacer ‘Serial’” and “Attempting connection at 9600 baud” etc
[/quote]

I started to download a Rasbian Jessie image. I will report back if succeeded.
And almost forgotten: Thank you very much to all of you!
It’s great to feel the readiness to help eachother in this community.
Thanks to your contribution I’ve learned a lot regarding linux, emoncms etc. But I also realised: “there is ‘some’ space for emprovement”. Cheers: László

Found now. Hyphenation is comming from this - probably old - article:
https://openenergymonitor.org/emon/node/3884

Thanks for letting us know, it is now corrected :slight_smile:

I’ve managed now to get inputs from TXShield via Arduino and USB to raspiPi.
The ‘clue’ was in the emonhub.conf.
I replaced ‘Type=JeeInterfacer’ with ‘EmonHubSerialInterfacer’ and commenteted ‘Group’, ‘frequency’ and ‘baseid’ out.
Replaced ‘/dev/ttyAMA0’ with ‘/dev/ttyACM0’ as we got to know from
sudo ls -la /dev/{tty{ACM,AMAS,USB},serial}*
With emonhub like this:

[interfacers]
[[RFM2Pi]]
    Type = EmonHubSerialInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyACM0
        com_baud = 9600
    [[[runtimesettings]]]
#        group = 210
#        frequency = 433
#        baseid = 15

I get now timesiries in my own emoncms db.

Next step is to get them populized and visualisied in emoncms.org.
:slight_smile:
Thank you All, again.

It works also for emoncms.org. :slight_smile:
There is the only work remaining how to manage inputs and feeds, charts etc. in the webapp.
Is there a description somewhere?