ircterm
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ircterm [2015-01-11 19:49] – rob | ircterm [2021-05-21 14:00] (current) – simon | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Project Background | + | ===== Hardware Status ===== |
- | Rob wanted a way to promote IRC use and make it feel more part of the lab rather than a separate 'IRC club', and also open it up to non-IRC users and provide a way to quickly reply. Similar IRC terminals exist at other hackerspaces, | + | Normal screen is currently < |
- | {{: | + | ===== Project Background ===== |
- | ==== Hardware ==== | + | Rob wanted a way to promote IRC use and make it feel more part of the lab rather than a separate 'IRC club', and also open it up to non-IRC users and provide a way to quickly reply. Similar IRC terminals exist at other hackerspaces, |
- | === Main components === | + | {{: |
- | | + | ===== Main Hardware Components ===== |
+ | |||
+ | | ||
* Some crappy ' | * Some crappy ' | ||
- | * Optiquest Q22wb (Viewsonic/ | + | * Optiquest Q22wb (Viewsonic/ |
+ | * Wall mount VESA arm | ||
* Also a passive USB 2.0 hub and a small USB keyboard | * Also a passive USB 2.0 hub and a small USB keyboard | ||
- | {{: | + | {{: |
- | === Piecing it together === | + | ===== Piecing it together |
The Pi is back-powered via the hub, which is in turn back-powered via a small in-line 5v 1A PSU originally for a Zip drive. There are a few of these useful PSUs in use in the lab. The back-powering is a result of only wanting to use bits in the ' | The Pi is back-powered via the hub, which is in turn back-powered via a small in-line 5v 1A PSU originally for a Zip drive. There are a few of these useful PSUs in use in the lab. The back-powering is a result of only wanting to use bits in the ' | ||
Line 24: | Line 27: | ||
{{: | {{: | ||
- | === Wifi === | + | The keyboard is bodged in place using lots of hot glue and some L brackets which are stuffed behind the conduit. Seems solid for now. |
+ | |||
+ | {{: | ||
+ | |||
+ | ===== Wifi ===== | ||
Terminal is connected to the main ' | Terminal is connected to the main ' | ||
Line 44: | Line 51: | ||
</ | </ | ||
+ | === Automatically reconnecting wifi === | ||
- | ==== Software ==== | + | / |
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | / | ||
+ | < | ||
+ | # | ||
+ | |||
+ | while true ; do | ||
+ | if ifconfig wlan0 | grep -q "inet addr:" ; then | ||
+ | sleep 60 | ||
+ | | ||
+ | ifdown wlan0 | ||
+ | sleep 10 | ||
+ | ifup --force wlan0 | ||
+ | sleep 10 | ||
+ | fi | ||
+ | done | ||
+ | </ | ||
- | === OS Config === | + | ===== OS Config |
Stock Raspbian with all x11-* and various other things removed. | Stock Raspbian with all x11-* and various other things removed. | ||
Line 77: | Line 104: | ||
Terminus font in UTF8, at size 16x32. | Terminus font in UTF8, at size 16x32. | ||
- | === Powering on/off the screen automatically === | + | ===== Powering on/off the screen automatically |
The screen turns off when the lab is empty and turns back on again as soon as someone enters the lab and triggers the PIR. This happens via the message bus and is handled by idle.py which is currently run from rc.local. idle.py was written by Tim initially. | The screen turns off when the lab is empty and turns back on again as soon as someone enters the lab and triggers the PIR. This happens via the message bus and is handled by idle.py which is currently run from rc.local. idle.py was written by Tim initially. | ||
Line 88: | Line 115: | ||
/ | / | ||
< | < | ||
- | # | + | #!/usr/bin/env python |
- | import | + | import |
- | import | + | import |
- | import pika | + | |
- | import time | + | |
- | logging.getLogger('' | + | last_state = None |
- | logging.getLogger(' | + | |
- | amqp_host = "amqp.hacklab" | + | def on_connect(client, |
- | amqp_exchange = " | + | client.subscribe("sensor/ |
- | topic = " | + | |
- | tvstate = False | + | def on_message(client, |
+ | global last_state | ||
- | connection = pika.BlockingConnection(pika.ConnectionParameters(host=amqp_host)) | + | # ignore retained |
- | channel = connection.channel() | + | #if msg.retain: |
- | channel.exchange_declare(exchange=amqp_exchange, | + | # |
- | result | + | if last_state != msg.payload: |
- | queue_name = result.method.queue | + | # state has changed |
- | channel.queue_bind(exchange=amqp_exchange, queue=queue_name, routing_key=topic) | + | if msg.payload == " |
+ | # screen on | ||
+ | subprocess.call(" | ||
+ | elif msg.payload == " | ||
+ | # screen off | ||
+ | subprocess.call(" | ||
+ | last_state = msg.payload | ||
- | def callback(ch, method, properties, body): | + | m = mqtt.Client() |
- | | + | m.on_connect = on_connect |
+ | m.on_message = on_message | ||
+ | m.connect(" | ||
+ | m.loop_forever() | ||
+ | </ | ||
- | changed = properties.headers[' | + | Required to run: |
- | state = properties.headers[' | + | |
- | old_state = properties.headers.get(' | + | |
- | if state == ' | + | < |
- | if tvstate == False: | + | apt-get install python-pip |
- | os.system(" | + | pip install paho-mqtt |
- | | + | |
- | elif state == ' | + | |
- | os.system(" | + | |
- | tvstate = False | + | |
- | + | ||
- | channel.basic_consume(callback, | + | |
- | queue=queue_name, | + | |
- | no_ack=True) | + | |
- | channel.start_consuming() | + | |
</ | </ | ||
- | Required | + | Log file of TV status (due to people wondering if it doesn' |
< | < | ||
- | apt-get install python-pika | + | ~/idle.log |
</ | </ | ||
- | === Irssi config === | + | ===== Irssi config |
Summary: | Summary: | ||
- | * Auto connect to freenode | + | * Auto connect to Libera |
* NickServ identification | * NickServ identification | ||
* Main channel window with only PUBLICS, ACTIONS and NICKS. | * Main channel window with only PUBLICS, ACTIONS and NICKS. | ||
Line 152: | Line 175: | ||
servers = ( | servers = ( | ||
{ | { | ||
- | address = "irc.freenode.net"; | + | address = "irc.libera.chat"; |
- | chatnet = "freenode"; | + | chatnet = "libera"; |
- | port = "6667"; | + | port = "6697"; |
- | use_ssl = "no"; | + | use_ssl = "yes"; |
- | ssl_verify = "no"; | + | ssl_verify = "yes"; |
autoconnect = " | autoconnect = " | ||
} | } | ||
Line 162: | Line 185: | ||
chatnets = { | chatnets = { | ||
- | | + | |
type = " | type = " | ||
autosendcmd = "/^msg nickserv identify < | autosendcmd = "/^msg nickserv identify < | ||
Line 171: | Line 194: | ||
{ name = "# | { name = "# | ||
{ name = " | { name = " | ||
- | { name = "# | + | { name = "# |
); | ); | ||
Line 369: | Line 392: | ||
chat_type = " | chat_type = " | ||
name = "# | name = "# | ||
- | tag = "freenode"; | + | tag = "libera"; |
} | } | ||
); | ); | ||
Line 383: | Line 406: | ||
- | === Playing the sound === | + | ===== Playing the sound ===== |
Part of the ' | Part of the ' | ||
* / | * / | ||
- | * / | ||
- | |||
- | The following was required for hacksense.py but has been suggested by Tim that any Redis stuff should be removed from hacksense.py instead. | ||
- | |||
- | < | ||
- | apt-get install python-redis | ||
- | </ | ||
* uhoh.mp3 is on doorbot which has the speaker attached to it. | * uhoh.mp3 is on doorbot which has the speaker attached to it. | ||
In irssi config: beep_cmd = "/ | In irssi config: beep_cmd = "/ |
ircterm.txt · Last modified: 2021-05-21 14:00 by simon