ircterm
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ircterm [2015-01-18 01:40] – rob | ircterm [2021-05-21 14:00] (current) – simon | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Project Background ==== | + | ===== Hardware Status ===== |
+ | |||
+ | Normal screen is currently < | ||
+ | |||
+ | ===== Project Background | ||
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, | 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, | ||
Line 5: | Line 9: | ||
{{: | {{: | ||
- | ==== Main Hardware Components ==== | + | ===== Main Hardware Components |
* Raspberry Pi A+ & [[http:// | * Raspberry Pi A+ & [[http:// | ||
Line 15: | Line 19: | ||
{{: | {{: | ||
- | ==== 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 27: | Line 31: | ||
{{: | {{: | ||
- | ==== Wifi ==== | + | ===== Wifi ===== |
Terminal is connected to the main ' | Terminal is connected to the main ' | ||
Line 47: | Line 51: | ||
</ | </ | ||
- | ===== Automatically reconnecting wifi ===== | + | === Automatically reconnecting wifi === |
/ | / | ||
Line 70: | Line 74: | ||
</ | </ | ||
- | ==== 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 100: | 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 111: | 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 175: | 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 185: | Line 185: | ||
chatnets = { | chatnets = { | ||
- | | + | |
type = " | type = " | ||
autosendcmd = "/^msg nickserv identify < | autosendcmd = "/^msg nickserv identify < | ||
Line 194: | Line 194: | ||
{ name = "# | { name = "# | ||
{ name = " | { name = " | ||
- | { name = "# | + | { name = "# |
); | ); | ||
Line 392: | Line 392: | ||
chat_type = " | chat_type = " | ||
name = "# | name = "# | ||
- | tag = "freenode"; | + | tag = "libera"; |
} | } | ||
); | ); | ||
Line 406: | 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