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:41] – rob | ircterm [2021-05-21 14:00] (current) – simon | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Hardware Status ===== | ||
+ | |||
+ | Normal screen is currently < | ||
+ | |||
===== Project Background ===== | ===== Project Background ===== | ||
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 |
</ | </ | ||
Line 166: | Line 166: | ||
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 411: | Line 411: | ||
* / | * / | ||
- | * / | ||
- | |||
- | 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.1421545272.txt.gz · Last modified: 2015-10-05 15:55 (external edit)