Closed arjunmenon closed 4 years ago
Look at the external_callback parameter in the comitup-conf man page.
Is there a more comprehensive FAQ for ComitUp? And is there a Slack or forum for this system/tool?
It is pretty fantastic, I've been hacking the pieces of this kind of system together for awhile; nice work on the part of the author.
If there is an FAQ I could contribute, and would definitely like to discuss tips & tricks.
Some FAQs: 1) What happens if I enter the WiFi password wrong? --- Does it show invalid connection or just hang? --- In that case, how do I get back to the point where I can put in the correct password? 2) Can I clear out the known access points in a straightforward manner? If so, how? 3) If I use NGINX as the "back end" can I easily revert back to another access point assuming I'm in an environment where I have multiple WiFI networks?
I can dig through the source code to find this out, but if this info is already somewhere I'd be glad to contribute & help with editing it.
BTW, I'm using this (ComitUp) in my Eink Badge Project at Hackaday.io @
The FAQ is on the wiki (I've added a link to the home page). According to GitHub, any logged in user can modify.
There hasn't been a clamoring for a support forum.
To answer your questions:
If you type the password wrong, it will eventually fail and revert to the HOTSPOT mode. It will retry the connection every couple of minutes, unless someone is connected to the hotspot, in which case it will wait to be commanded. The failure is noted in the log. Edit - Once it is back in HOTSPOT mode, you can repeat the configuration, which will rewrite the old one.
Known connections are managed by NetworkManager, and can be deleted using features of that package. For instance, you can just delete the appropriate files in /etc/NetworkManager/system, or use nmcli to do it for you more cleanly. I usually use the 'delete' command in comitup-cli. You'll note in the comitup man page there is also a D-Bus call for this.
If you have multiple access points that you have configured that are visible at the same time, the AP selection process is undefined. Again, it is just NetworkManager underneath, so you could provide a way to query it and to connect to the desired AP. Comitup should tolerate that action, but I haven't tested it.
Looks like an interesting project - glad I could help. You have linked a particular image - note that they tend to disappear in 6 months or so (Edit - try http://steele.debian.net/comitup/).
David:
I just attempted to update the FAQ on GITHUB; I cloned locally and then pushed back up to the master.
Sorry, I'm used to using GITHUB locally and frankly haven't used it in awhile. Hope I didn't mess anything up.
Charlie
From: David Steele <notifications@github.com>
To: davesteele/comitup comitup@noreply.github.com Cc: Charlie Lindahl cyberchuck2000@yahoo.com; Comment comment@noreply.github.com Sent: Tuesday, July 10, 2018 1:48 PM Subject: Re: [davesteele/comitup] Events (#11)
The FAQ is on the wiki (I've added a link to the home page). According to GitHub, any logged in user can modify.There hasn't been a clamoring for a support forum.To answer your questions:
David:
Looks like an interesting project - glad I could help. You have linked a particular image - note that they tend to disappear in 6 months or so. I don't understand your point. I downloaded this image to my machine and then pushed back up to the hackaday.io site (it is nota URL but a "local" image to the site). Or am I misunderstanding you?
Thanks,Charlie
Images are updated about every 3 months (I track upstream), and I keep the last two. So in 6 months, don't be surprised if the "2018-06-29" image disappears.
Try http://steele.debian.net/comitup/. That won't change.
Also, do you want to make Comitup step 1? If you user goes with the img option, he's going to undo the InkyPHAT install. Edit - never mind - it's hardware.
There's no damage to the Wiki, but I don't see any changes either.
David:
Weird. I don't know why the changes didn't get propagated.
As I said, used the GitHub Desktop on my Mac, and sometimes that system does some weird stuff under the hood. I"ll go back & do it CLI-based so I cansee what's going on. Here are the additions (questions by me, answers by you):
What happens if I enter the WiFi password wrong?
If you type the password wrong, it will eventually fail and revert to the HOTSPOT mode. It will retry the connection every couple of minutes, unless someone is connected to the hotspot, in which case it will wait to be commanded. The failure is noted in the log.
Can I clear out the known access points in a straightforward manner? If so, how?
Known connections are managed by NetworkManager, and can be deleted using features of that package. For instance, you can just delete the appropriate files in /etc/NetworkManager/system, or use nmcli to do it for you more cleanly. I usually use the 'delete' command in comitup-cli. You'll note in the comitup man page there is also a D-Bus call for this.
If I use NGINX as the "back end" can I easily revert back to another access point assuming I'm in an environment where I have multiple WiFI networks?
If you have multiple access points that you have configured that are visible at the same time, the AP selection process is undefined. Again, it is just NetworkManager underneath, so you could provide a way to query it and to connect to the desired AP. Comitup should tolerate that action, but I haven't tested it.
From: David Steele <notifications@github.com>
To: davesteele/comitup comitup@noreply.github.com Cc: Charlie Lindahl cyberchuck2000@yahoo.com; Comment comment@noreply.github.com Sent: Tuesday, July 10, 2018 3:42 PM Subject: Re: [davesteele/comitup] Events (#11)
Images are updated about every 3 months (I track upstream), and I keep the last two. So in 6 months, don't be surprised if the "2018-06-29" image disappears.Try http://steele.debian.net/comitup/. That won't change.Also, do you want to make Comitup step 1? If you user goes with the img option, he's going to undo the InkyPHAT install.There's no damage to the Wiki, but I don't see any changes either.— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
David:
Ah. When you say "image" you mean "disk image". For some odd reason I was thinking aboutthe "image" on my Hackaday.io page.
Also, do you want to make Comitup step 1? If you user goes with the img option, he's going to undo the InkyPHAT install.Whups. Great feedback, thanks. Charlie
From: David Steele <notifications@github.com>
To: davesteele/comitup comitup@noreply.github.com Cc: Charlie Lindahl cyberchuck2000@yahoo.com; Comment comment@noreply.github.com Sent: Tuesday, July 10, 2018 3:42 PM Subject: Re: [davesteele/comitup] Events (#11)
Images are updated about every 3 months (I track upstream), and I keep the last two. So in 6 months, don't be surprised if the "2018-06-29" image disappears.Try http://steele.debian.net/comitup/. That won't change.Also, do you want to make Comitup step 1? If you user goes with the img option, he's going to undo the InkyPHAT install.There's no damage to the Wiki, but I don't see any changes either.— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Hey for external_callback when you say
It will include a single argument, either 'HOTSPOT', 'CONNECTING', or 'CONNECTED'.
Where exactly should it be included in the eg given, external_callback: /usr/local/bin/comitup-callback
The script will be called with that value as the first argument, e.g. "/usr/local/bin/comitup-callback CONNECTING". If that script is a shell script, it is available as the variable "$1".
Need more clarification. I have a ruby server which I want to run on CONNECTED
/home/pi/server/run.rb CONNECTED
Now it is clear that my script run.rb should account for the args, question is twofold.
run.rb
suppose to do with that args?run.rb
? Is run.rb
suppose to call any comitup commands? Or comitup is only looking for those key constants and simply figure out which scripts to run based off that? I dont have to do anythin else?Hey About note 2 Basically to be safe I should have a script which would trigger other scripts,.? I can have a bash file which can start stop the ruby server, right.
Yes
Hey
I have a simple bash file which I am trying to run but it fails, There is no mention of it even in the logs even though per your suggestion, conf is configured accordingly
Bash file - comit.sh located in /home/pi
#!/bin/bash
Logfile="logfile.txt"
touch $Logfile
echo "the is from the comitup external_callback" >> $Logfile
if [ "$1" == "CONNECTING" ]; then
echo "args CONNECTING" >> $Logfile
elif [ "$1" == "HOTSPOT" ]; then
echo "args HOTSPOT" >> $Logfile
elif [ "$1" == "CONNECTED" ]; then
echo "args CONNECTED" >> $Logfile
else
echo "Invalid args" >> $Logfile
fi
But it doesn't work from the callback. No file is created neither any mention of callback is there in the comitup logs
2018-07-26 08:43:22,813 - comitup - INFO - Starting comitup
2018-07-26 08:43:23,117 - comitup - INFO - Setting state to HOTSPOT
2018-07-26 08:43:23,234 - comitup - INFO - Activating hotspot
2018-07-26 08:43:29,971 - comitup - INFO - AP active - skipping CONNECTING scan
2018-07-26 08:43:34,977 - comitup - INFO - AP active - skipping CONNECTING scan
.
.
2018-07-26 08:46:05,025 - comitup - INFO - Setting state to CONNECTING
2018-07-26 08:46:05,177 - comitup - INFO - Attempting connection to DUMMY
2018-07-26 08:46:31,979 - comitup - INFO - Setting state to CONNECTING
2018-07-26 08:46:32,259 - comitup - INFO - Attempting connection to DUMMY
2018-07-26 08:46:57,978 - comitup - INFO - Setting state to HOTSPOT
2018-07-26 08:46:58,166 - comitup - INFO - Activating hotspot
2018-07-26 08:49:25,834 - comitup - INFO - Setting state to CONNECTING
2018-07-26 08:49:25,969 - comitup - INFO - Attempting connection to ACTUAL_CONNECTION
2018-07-26 08:49:30,263 - comitup - INFO - Setting state to CONNECTED
2018-07-26 09:09:51,190 - comitup - INFO - Setting state to HOTSPOT
2018-07-26 09:09:51,380 - comitup - INFO - Activating hotspot
2018-07-26 09:10:17,628 - comitup - INFO - Setting state to CONNECTING
2018-07-26 09:10:17,770 - comitup - INFO - Attempting connection to ACTUAL_CONNECTION
2018-07-26 09:10:21,363 - comitup - INFO - Setting state to CONNECTED
You can see that nowhere the call back is mentioned
The comit.sh
is located in /home/pi
with permissions
pi@raspberrypi:~ $ ls -l comit.sh
-rwxr-xr-x 1 root root 429 Jul 26 09:09 comit.sh
set using chmod a+x comit.sh
Comitup.conf - comitup version 1.1
.
.
# external_callback
#
# An external script that is called on comitup state changes. It will
# include a single argument, either 'HOTSPOT', 'CONNECTING', or
# 'CONNECTED'.
#
# The script must be executable, and must be owned by root.
#
# external_callback: /usr/local/bin/comitup-callback
external_callback: /home/pi/comit.sh $1
In the conf file, the "$1" is not necessary, and likely why your aren't seeing logs (it doesn't log in the case where the file doesn't exist).
Regarding the "touch", don't assume that you know what the current working directory is.
And, oops, there is a bug in comitup that causes a crash if your script is not owned by the root owner and group. Added as #14.
In the conf file, the "$1" is not necessary, and likely why your aren't seeing logs (it doesn't log in the case where the file doesn't exist).
"Not necessary" does it also mean that it wouldn't matter if it is present? It would also be helpful to see atleast some information in comitup logs that the user made an attempt to do something with the callback?
Regarding the "touch", don't assume that you know what the current working directory is.
Well I did try to do locate logfile.txt
. No result. Perhaps I can pipe it to system logs then.
And, oops, there is a bug in comitup that causes a crash if your script is not owned by the root owner and group. Added as #14.
It is owned by root. I even changed the permissions to 777 to be absolutely clear. Still nothing happened.
I think it would be fair to trouble you for a small example ;)
Your example is fine - just add a full path for the logfile, and remove " $1" from the callback (comitup is checking for the existence of the file "/home/pi/comit.sh $1", which is not present). The callback code is here. The isfile() call is currently returning false. Notice in subprocess.call() that the command to run is separated into individual elements. The "$1" is not split off of the executable path here, and so is considered part of the script name.
Hey I have certain scripts that I would like to run when comitup successfully establishes wifi connection. Is it possible to have comitup run them? I dont want to use rc.local or crontab or other ways. I was looking to make it depended on comitup.
In addition to comitup starting scripts on boot, so if wifi temporarily goes out of range, comitup stops those scripts and if the wifi comes back up, comitup re-runs those scripts.
Is it possible?
PS - comitup running in Raspberry Pi3, with one Ruby script and other a python script