Presenced - Setup on rPi

Begonnen von andyclimb, 12 August 2013, 19:28:36

Vorheriges Thema - Nächstes Thema

andyclimb

I've been struggling to get this to work reliably.....

I've downloaded : http://svn.code.sf.net/p/fhem/code/trunk/fhem/contrib/PRESENCE/deb/presenced-rpi-1.1.deb

and in the rPi run sudo dpkg -i presenced-rpi-1.1.deb which installed correctly.

I have this set up in the remote fhem

define AMiPhone PRESENCE lan-bluetooth 98:B8:E3:7A:38:0F  192.168.1.127:5111 which defines a fhem object that reads "disconnected"

if i restart fhem nothing happens.
if i run presenced -d 5111 on the rPi Then it works briefly, i get active, and sometimes a present, but then it always reads disconnected after a few min
if I run presenced -v then I get this


presenced -v
2013-08-12 18:08:05 - started with PID 3106
print() on closed filehandle PIDFILE at /usr/sbin/presenced line 122.
2013-08-12 18:08:05 - created socket on 0.0.0.0 with port 5111
2013-08-12 18:08:16 - new connection from 192.168.1.209
2013-08-12 18:08:16 - received new command from 192.168.1.209: 98:B8:E3:7A:38:0F|30
2013-08-12 18:08:16 - created thread 1 for processing device 98:B8:E3:7A:38:0F within 30 seconds for peer 192.168.1.209
2013-08-12 18:08:16 - new connection from 192.168.1.209
2013-08-12 18:08:16 - closed connection from 192.168.1.209
2013-08-12 18:08:16 - killing thread 1 for client 192.168.1.209
2013-08-12 18:08:16 - new connection from 192.168.1.209
2013-08-12 18:08:16 - received new command from 192.168.1.209: 98:B8:E3:7A:38:0F|30
2013-08-12 18:08:16 - created thread 2 for processing device 98:B8:E3:7A:38:0F within 30 seconds for peer 192.168.1.209
2013-08-12 18:08:16 - new connection from 192.168.1.209
2013-08-12 18:08:16 - closed connection from 192.168.1.209
2013-08-12 18:08:16 - killing thread 2 for client 192.168.1.209
2013-08-12 18:08:16 - received new command from 192.168.1.209: 98:B8:E3:7A:38:0F|30
------------(lots of the same here.......
2013-08-12 18:12:02 - created thread 224 for processing device 00:26:08:66:B9:6B within 30 seconds for peer 192.168.1.209
2013-08-12 18:12:02 - new connection from 192.168.1.209
2013-08-12 18:12:02 - closed connection from 192.168.1.209
2013-08-12 18:12:02 - killing thread 224 for client 192.168.1.209
2013-08-12 18:12:02 - received new command from 192.168.1.209: 00:26:08:66:B9:6B|30
2013-08-12 18:12:03 - created thread 225 for processing device 00:26:08:66:B9:6B within 30 seconds for peer 192.168.1.209
2013-08-12 18:12:03 - new connection from 192.168.1.209
2013-08-12 18:12:03 - closed connection from 192.168.1.209
2013-08-12 18:12:03 - killing thread 225 for client 192.168.1.209
2013-08-12 18:12:03 - received new command from 192.168.1.209: 00:26:08:66:B9:6B|30
2013-08-12 18:12:03 - created thread 226 for processing device 00:26:08:66:B9:6B within 30 seconds for peer 192.168.1.209
2013-08-12 18:12:03 - new connection from 192.168.1.209
2013-08-12 18:12:03 - closed connection from 192.168.1.209
2013-08-12 18:12:03 - killing thread 226 for client 192.168.1.209
2013-08-12 18:12:03 - received new command from 192.168.1.209: 00:26:08:66:B9:6B|30
2013-08-12 18:12:03 - created thread 227 for processing device 00:26:08:66:B9:6B within 30 seconds for peer 192.168.1.209
2013-08-12 18:12:03 - new connection from 192.168.1.209
pi@raspberrypi ~ $


And then it just stops.....  

Does anyone have any idea why it just stops?

How can I have it auto start....  I have tried

sudo update-rc.d defaults presenced

but this does not seem to work. although it might be because it just crashes...

any help appreciated?

Andrew
AM

Markus Bloch

Hi Andrew,

which FHEM version do you have exactly installed? Please run the command "version" in the command line in FHEMWEB.

I fixed this error quite a while ago. Maybe you just need to execute the "update" command in the command line and afterwards perform a "shutdown restart" command.

Cheers
Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

andyclimb

Hi,

Thank you for the vey fast reply.  

So, I was running the latest version on my server, and forgot that I've not updated the raspberry pi.....  So performed the update and it works...  

The only thing to change was the rc-d command which is inverted...  the correct command is

sudo update-rc.d presenced defaults

I also wanted to mention for others that the commandref still has the wrong setup for the PRESENCE LAN-Bluetooth...

it currently reads  

Zitatdefine iPhone PRESENCE lan-bluetooth 127.0.0.1:5222 0a:4f:36:d8:f9:89

it should read

Zitatdefine iPhone PRESENCE lan-bluetooth 0a:4f:36:d8:f9:89 127.0.0.1:5222

I actually ended up editing the code of 73_PRESENCE.pm to remove the check for correct bluetooth address...  finding out that it was still none functional.. and then discovering the four post using google translate.....

if you get this error "given address is not a bluetooth hardware address"  then you have the IP and the bluetooth address the wrong way round...

Thank you again for the help.

Andrew
AM

Markus Bloch

Hi Andrew,

i just fixed this mistake in the commandref directly.

Thanks for your help too.

Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

andyclimb

Thanks for fixing that.

I do have another question.  I've been running precenced on two raspberry pi computers.  The only thing is on both of them, on running the standard raspberry pi debian, the other Xbian the presenced process occupies almost all the CPU time.  I've attached a picture.  This seems to be a little high for a bluetooth ping...

have others found this as well?

Andrew
AM

Markus Bloch

Hi Andrew,

that sounds a little strange to me, as presenced does not a cpu intensive task.

What is the output of "presenced -v" directly executed on the shell on your Xbian Pi?

Thank you

Markus

Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

andyclimb

Hi,

So the output from the shell with presences -v is below, and it seems to be ok.  no errors.

(siehe Anhang / see attachement)

If I run presenced the CPU usage us low, it is not until a connection is made from either FHEM or Collectord that the CPU goes to 98%.  

I've attached an image below of the sysstat module showing quite clearly when the presenced is running.

(siehe Anhang / see attachement)

I do have a slightly unrelated question.  Im running a raspberry pi with the bluetooth, CUL and an RFXcom, but the main FHEM is being run an ubuntu server machine as it is much faster.  I still have FHEM running on the rPi and a fhem2fhem set up.  it is all working fine.  

I have a lan-ping set up that works perfectly on the rPi and gives me present.  However, on the linux machine, it just gives me active.  I'm confused as everything works..  if I ping my phone from the command line it works.  and the permissions for /bin/ping are ok for everyone to execute.. Do you have any idea what that doesn't work?

Third question, do you know the password of the fhem:dialout user:group that is created on install of fhem?

Sorry for so many question.  

Andrew
AM

rudolfkoenig

> do you know the password of the fhem:dialout user:group that is created on install of fhem?

The dialout group was created without specifying a passwort.
Up till now I did not know that you can specify a password for a group.

andyclimb

Sorry I should have said does anyone know the password for ths user fhem which is in the group dialout when fhem is installed on Linux?

Cheers

AM

rudolfkoenig

The user does not have a password, and is intended to be used by the FHEM program when started as root from the rc scripts.

Markus Bloch

Hi Andrew,

you're right. I checked my Raspberry's and they have also 100% cpu usage. I changed this and released new deb-Packages which you can download:

presenced-rpi-1.2.deb
presenced-1.2.deb

The new package links will be released via update tomorrow.

I'm sorry for this.

Have a nice day.

Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

andyclimb

Hi,

Thanks for getting a fix so quickly. I'm not home just now but will try it when I get home.

Have you got any idea why on my rPi fhem installation a LAN-ping give present/absent and works correctly. Whereas on my ubuntu server box I get only "active" as a state. If I ping my phone from the command line it works just fine. I thought it might be permissions that the fhem user is not allowed. But I can't su fhem, as it asks for a password which I don't know. I'm running ubuntu server 13.

Sorry for so many questions.
The help is appreciated.

Andrew

AM

andyclimb

Hi,

I've tried both 1.2 versions (normal and rPi) and i'm still getting immediately 95% CPU usage once the FHEM client connects.


(siehe Anhang / see attachement)
AM

Markus Bloch

You're right. I also saw this right after installing the new deb package on my Pi's. I directly uploaded new deb packages right afterwards, but these links are still pointing to the old version (i hate this new sourceforge system...).

Please use the following links to get the latest version:

http://svn.code.sf.net/p/fhem/code/trunk/fhem/contrib/PRESENCE/deb/presenced-1.2.deb
http://svn.code.sf.net/p/fhem/code/trunk/fhem/contrib/PRESENCE/deb/presenced-rpi-1.2.deb

I'm sorry for the confusion.

Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

andyclimb

Markus,

All works great!  Thanks for the rapid fix! presenced now does not really register in the top processes, and uses almost nothing.


(siehe Anhang / see attachement)


Can I ask if what the difference if between the normal and rpi version?

any ideas why my lan-ping might not be working?

A
AM