• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AdHoc - Defining MainDaemon
#1
Hi,

i am using the adhoc functionality, but some time the wrong pilight instance is starting as main daemon.

My setup:
bananaPi(MainDaemon - setting up all switches) <---> raspberryPi(SlaveDaemon - cleared config)

Some time due to restarts of both Pis, the raspberryPi is getting MainDaemon and pilight is using the cleared config.

Is there a way, i can define the bananaPi starting always as MainDaemon and the raspberryPi always as SlaveDaemon?

Thanks,
tobid
 
Reply
#2
Yes, start the slaves like this:
Code:
pilight-daemon -S x.x.x.x -P xxxx
So explicitly define to with master instance they should connect.
 
Reply
#3
ok, thanks for the reply.

But which line do i have to change in the /etc/init.d/pilight?

Somthing like this one?
Code:
DAEMON_ARGS= "-S 192.168.178.46 -P 5000"
 
Reply
#4
I believe so.
 
Reply
#5
Hi

what port is needed there? i was trying the default 5000,5001, etc, which is also in the config, but none of those are working. Is it the webserver port or what?
With the webserver ip and port it doesnt connect, but without the server parameters it finds and connect the master.

[EDIT]
shame on me, i should drink the coffee and read first:
pilight Manual > Configuration > Settings
Quote:port
Linux, *BSD, and Windows
no default value
"port": 5000
By default, pilight uses a random port for its socket server. Use the port setting If you want to set this to a
fixed port.
 
Reply
#6
Glad people appreciate the manual Smile
 
Reply
#7
Hmmm... not quite working for me...

If i start the daemon manually, it works:

Code:
root@raspberrypi:/home/pi# pilight-daemon -S 192.168.2.70
root@raspberrypi:/home/pi# service pilight stop
[ ok ] Stopping : pilight.

If i add an Argument to /etc/init.d/pilight

Code:
DAEMON_ARGS= "-S 192.168.2.70"

it doesn´t work

Code:
root@raspberrypi:/home/pi# service pilight start
/etc/init.d/pilight: 26: /etc/init.d/pilight: -S 192.168.2.70: not found
[ ok ] Starting : pilight.

Can anybody help pls?
 
Reply
#8
(07-07-2015, 11:51 AM)gregnau Wrote: pilight Manual > Configuration > Settings
Quote:port
Linux, *BSD, and Windows
no default value
"port": 5000
By default, pilight uses a random port for its socket server. Use the port setting If you want to set this to a
fixed port.

You also need to define the port that the daemon runs at in order to connect to it like this.
 
Reply
#9
Hmmm...

I defined the port on my main Pi to 5000

Code:
root@raspberrypi:/etc/pilight# ifconfig
eth0      Link encap:Ethernet  Hardware Adresse b8:27:eb:ad:13:ba
          inet Adresse:192.168.2.70  Bcast:192.168.2.255  Maske:255.255.255.0
Code:
"settings": {
                "log-level": 6,
                "pid-file": "/var/run/pilight.pid",
                "log-file": "/var/log/pilight.log",
                "webserver-enable": 1,
                "webserver-root": "/usr/local/share/pilight/",
                "webserver-http-port": 5001,
                "webserver-cache": 1,
                "port": 5000
        },

If i then add
Code:
DAEMON_ARGS= "-S 192.168.2.70 -P 5000"

to my Slave, the Result is:
Code:
root@raspberrypi:/home/pi# service pilight start
/etc/init.d/pilight: 26: /etc/init.d/pilight: -S 192.168.2.70 -P 5000: not found
[ ok ] pilight is running.
 
Reply
#10
Hi,

I am experiencing the same problem, but I think I am knowing the problem at least.

At first I tried this:
Code:
pi@raspberrypi ~ $ sudo pilight-daemon -S 192.168.178.46 -P 5000 -D
[Aug 09 11:12:39:590300] pilight-daemon: INFO: version v7.0
[Aug 09 11:12:39:593084] pilight-daemon: INFO: a pilight daemon was found, clientizing
That worked for me.

Then I edited the /etc/init.d/pilight script with the following line.
Code:
DAEMON_ARGS="-S 192.168.178.45 -P5000"
Resulting into the follwing error.
Code:
pi@raspberrypi ~ $ sudo service pilight start
[....] Starting : pilightstart-stop-daemon: invalid process scheduler policy
Try 'start-stop-daemon --help' for more information.
failed!

If I edit it without the "" i get the error you described.
Code:
DAEMON_ARGS=-S 192.168.178.45 -P5000
Resutling error:
Quote:pi@raspberrypi ~ $ sudo service pilight start
/etc/init.d/pilight: 26: /etc/init.d/pilight: 192.168.178.45: not found
[ ok ] Starting : pilight.


After that I tried the following:
Code:
DAEMON_ARGS="-V"
And the result looks like this:
Code:
pi@raspberrypi ~ $ sudo service pilight start
[....] Starting : pilightstart-stop-daemon 1.16.16 for Debian

Written by Marek Michalkiewicz, public domain.
. ok

I think the problem is that this arguments a handed to the start-stop-daemon program or whatever it is.


Therefore i tried to edit some lines like that:
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON "-S 192.168.178.46 -P 5000" $DAEMON_ARGS \
resulting into:
Code:
pi@raspberrypi ~ $ sudo service pilight start
[....] Starting : pilightstart-stop-daemon: invalid option -- ' '
Try 'start-stop-daemon --help' for more information.
failed!

My last try was the following:
Code:
DAEMON="/usr/local/sbin/pilight-daemon -S192.168.178.46 -P 5000"
With the result of nothing.
Code:
pi@raspberrypi ~ $ sudo service pilight start
pi@raspberrypi ~ $

If someone knows how to give arguments to the pilight-daemon directly via this start-stop-daemon program, please let me know.


Greetings,
tobid

EDIT: I made a comment on the blog of the script creator. I'll give updates here, if I get an answere.

EDIT2: Found out how to hand the arguments to the pilight daemon. The current problem pilight is not starting anymore.
I changed the following:
Code:
DAEMON_ARGS=" -V"
[...]
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --$DAEMON_ARGS \
The space before the -V is important otherwise it it resulting in an error. I am getting the following results:
Code:
pi@raspberrypi ~ $ sudo service pilight start
[....] Starting : pilightpilight-daemon version v7.0
failed!
The argument is handed to the pilight-daemon, but it fails to start.

EDIT3: Got it to work!
Code:
DAEMON_ARGS=" -S 192.168.178.46 -P 5000 -D"
[...]
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --$DAEMON_ARGS \

Code:
pi@raspberrypi ~ $ sudo service pilight start
[....] Starting : pilight[Aug 09 12:12:15:891424] pilight-daemon: INFO: version v7.0
[Aug 09 12:12:15:894546] pilight-daemon: INFO: a pilight daemon was found, clientizing

Normally you dont want the -D prameter in the script, but I used it to check the connection. Just remove it for regular usage.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Issue send actions over Socket API in AdHoc network ggtrts 10 520 03-13-2019, 06:32 AM
Last Post: curlymo
  AdHoc network with 2 Raspberry and 2 GPIO transmitter not working webdandy 29 5,911 09-06-2017, 02:39 PM
Last Post: wseifert
  BUG: BMP180 in AdHoc Network Alex 5 1,464 06-19-2016, 02:24 PM
Last Post: Alex
  AdHoc network with different senders Mr.Montesa 6 2,580 02-11-2016, 01:29 PM
Last Post: Karel
  Disable adhoc network? heikoh81 5 3,325 09-17-2015, 09:01 PM
Last Post: heikoh81
  Sending with 2 transmitters (AdHoc) tobid 11 4,109 08-23-2015, 05:12 PM
Last Post: curlymo
  AdHoc bug with 3 or 4 raspberries causch 18 5,107 07-20-2015, 03:39 PM
Last Post: causch

Forum Jump:


Browsing: 1 Guest(s)