User Tools

Site Tools


ircterm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ircterm [2015-01-11 19:46] robircterm [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, such as [[http://helsinki.hacklab.fi|Helsinki Hacklab]].+Normal screen is currently <del>out of action</del> **gubbed**. Tim recommends checking caps however not enough time was available on the day of discovering the screen being out. A temporary screen has been put in place to allow for interim IRC usage.
  
-{{:img_20150111_150838.jpg?direct&200|}}+===== 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, such as [[http://helsinki.hacklab.fi|Helsinki Hacklab]].
  
-=== Main components ===+{{:img_20150111_150838.jpg?direct&300|}}
  
-  * Raspberry Pi A++===== Main Hardware Components ===== 
 + 
 +  * Raspberry Pi A+ & [[http://www.thingiverse.com/thing:566506|3D printed case]]
   * Some crappy 'PiHut' rt2800-based wifi dongle   * Some crappy 'PiHut' rt2800-based wifi dongle
-  * Optiquest Q22wb (Viewsonic/BENQ) 22" 1680x1050 (16:10) TFT mounted vertically+  * Optiquest Q22wb (Viewsonic/BENQ) 22" 1680x1050 (16:10) TFT mounted vertically, provided by shabble 
 +  * 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 ===+{{:img_20150110_015443.jpg?direct&300|}} 
 + 
 +===== 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 'cables for butchering' box. 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 'cables for butchering' box.
Line 20: Line 25:
 Pi, USB hub, and PSU are velcro'd on to the back of the monitor. The monitor is mounted on the wall using a wall bracket salvaged from a smashed TV that was being thrown out. The wall bracket is capable of a wide range of movement. Pi, USB hub, and PSU are velcro'd on to the back of the monitor. The monitor is mounted on the wall using a wall bracket salvaged from a smashed TV that was being thrown out. The wall bracket is capable of a wide range of movement.
  
 +{{:img_20150110_021538.jpg?direct&300|}}
  
-=== 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. 
 + 
 +{{:img_20150110_043139.jpg?direct&300|}} 
 + 
 +===== Wifi =====
  
 Terminal is connected to the main 'Hacklab' network. Wifi was showing to be very unreliable in 'n' mode. Having forced an arbitrary speed of 22Mbit/s, the wifi is now stable. Other Pis using similar dongles have experienced high latency and loss too. The problem doesn't exist when connected to different access points. Terminal is connected to the main 'Hacklab' network. Wifi was showing to be very unreliable in 'n' mode. Having forced an arbitrary speed of 22Mbit/s, the wifi is now stable. Other Pis using similar dongles have experienced high latency and loss too. The problem doesn't exist when connected to different access points.
Line 41: Line 51:
 </code> </code>
  
 +=== Automatically reconnecting wifi ===
  
-==== Software ====+/etc/rc.local: 
 +<code> 
 +/root/wifimonitor 2>&1 & 
 +</code> 
 + 
 +/root/wifimonitor: 
 +<code> 
 +#!/bin/bash 
 + 
 +while true ; do 
 +   if ifconfig wlan0 | grep -q "inet addr:" ; then 
 +      sleep 60 
 +   else 
 +      ifdown wlan0 
 +      sleep 10 
 +      ifup --force wlan0 
 +      sleep 10 
 +   fi 
 +done 
 +</code>
  
-=== 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 67: Line 97:
 It's run a screen session to allow easy remote irssi maintaining via screen -x. It's run a screen session to allow easy remote irssi maintaining via screen -x.
  
 +The console font has been changed using:
 +<code>
 +sudo dpkg-reconfigure console-setup
 +</code>
 +
 +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 79: Line 115:
 /home/pi/idle.py: /home/pi/idle.py:
 <code> <code>
-#!/usr/bin/python+#!/usr/bin/env python
  
-import logging +import paho.mqtt.client as mqtt 
-import os +import subprocess
-import pika +
-import time+
  
-logging.getLogger('').setLevel(logging.INFO) +last_state = None
-logging.getLogger('pika').setLevel(logging.ERROR)+
  
-amqp_host = "amqp.hacklab" +def on_connect(client, userdata, flags, rc): 
-amqp_exchange = "events" +    client.subscribe("sensor/global/presence")
-topic = "presence.status"+
  
-tvstate = False+def on_message(client, userdata, msg): 
 +    global last_state
  
-connection = pika.BlockingConnection(pika.ConnectionParameters(host=amqp_host)+    # ignore retained (non-realtimemessages 
-channel = connection.channel() +    #if msg.retain: 
-channel.exchange_declare(exchange=amqp_exchange, type="topic")+    #    return
  
-result channel.queue_declare(exclusive=True) +    if last_state !msg.payload: 
-queue_name = result.method.queue +        # state has changed 
-channel.queue_bind(exchange=amqp_exchangequeue=queue_name, routing_key=topic)+        if msg.payload == "active": 
 +            # screen on 
 +            subprocess.call("tvservice -p", shell=True) 
 +        elif msg.payload == "empty": 
 +            # screen off 
 +            subprocess.call("tvservice -o"shell=True) 
 +        last_state = msg.payload
  
-def callback(ch, method, properties, body): +m = mqtt.Client() 
-    global tvstate+m.on_connect = on_connect 
 +m.on_message = on_message 
 +m.connect("mqtt"
 +m.loop_forever() 
 +</code>
  
-    changed = properties.headers['changed'+Required to run:
-    state = properties.headers['state'+
-    old_state = properties.headers.get('old_state', None) +
- +
-    if state == 'ACTIVE': +
-        if tvstate == False: +
-            os.system("tvservice -p") +
-            tvstate = True +
-    elif state == 'EMPTY': +
-        os.system("tvservice -o") +
-        tvstate = False+
  
-channel.basic_consume(callback, +<code> 
-                      queue=queue_name, +apt-get install python-pip 
-                      no_ack=True) +pip install paho-mqtt
-channel.start_consuming()+
 </code> </code>
  
-Required to run:+Log file of TV status (due to people wondering if it doesn't actually ever turn off):
  
 <code> <code>
-apt-get install python-pika+~/idle.log
 </code> </code>
  
-=== 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 143: 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 = "yes";     autoconnect = "yes";
   }   }
Line 153: Line 185:
  
 chatnets = { chatnets = {
-  freenode = {+  libera = {
     type = "IRC";     type = "IRC";
     autosendcmd = "/^msg nickserv identify <PASSWORD>;/^win 2";     autosendcmd = "/^msg nickserv identify <PASSWORD>;/^win 2";
Line 162: Line 194:
   { name = "#irssi"; chatnet = "ircnet"; autojoin = "No"; },   { name = "#irssi"; chatnet = "ircnet"; autojoin = "No"; },
   { name = "silc"; chatnet = "silc"; autojoin = "No"; },   { name = "silc"; chatnet = "silc"; autojoin = "No"; },
-  { name = "#edinhacklab"; chatnet = "freenode"; autojoin = "yes"; }+  { name = "#edinhacklab"; chatnet = "libera"; autojoin = "yes"; }
 ); );
  
Line 360: Line 392:
         chat_type = "IRC";         chat_type = "IRC";
         name = "#edinhacklab";         name = "#edinhacklab";
-        tag = "freenode";+        tag = "libera";
       }       }
     );     );
Line 374: Line 406:
  
  
-=== Playing the sound ===+===== Playing the sound =====
  
 Part of the 'hacksense' stuff has been copied over: Part of the 'hacksense' stuff has been copied over:
  
   * /srv/hacksense/bin/request-soundfile   * /srv/hacksense/bin/request-soundfile
-  * /srv/hacksense/lib/hacksense.py 
- 
-The following was required for hacksense.py but has been suggested by Tim that any Redis stuff should be removed from hacksense.py instead. 
- 
-<code> 
-apt-get install python-redis 
-</code> 
  
   * 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 = "/srv/hacksense/bin/request-soundfile uhoh.mp3 &" In irssi config: beep_cmd = "/srv/hacksense/bin/request-soundfile uhoh.mp3 &"
ircterm.1421005578.txt.gz · Last modified: 2015-10-05 15:55 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki