delete unused files and make some changes

This commit is contained in:
anonymous 2024-10-31 16:04:08 +00:00
parent 5345d65940
commit e6f8277417
8 changed files with 62 additions and 217 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@ secrets.h
arduino/MQTT/secret.h
arduino/MQTT/secrets.h
venv
rule-listener/secrets.py
rule-listener/secrets.py
visualiser/secrets.el

View File

@ -6,30 +6,13 @@ date: Tuesday, October 22, 2024
# Listening Daemon
Current structure of the repository
Communication between things in this room goes via a server running a
Message Queuing Telemetry Transport (MQTT) broker. MQTT is a protocol
for communication in which participants publish and subscribe to
so-called topics. The broker acts a centralised point of exchange in
this process, ensuring messages reach their intended targets.
```
.
├── arduino
│ ├── motor_shield_one
│ │ ├── makefile
│ │ └── motor_shield_one.ino
│ ├── motor_shield_two
│ │ ├── makefile
│ │ └── motor_shield_two.ino
│ ├── relay_shield
│ │ ├── makefile
│ │ └── relay_shield.ino
│ └── sensors
│ ├── makefile
│ └── sensors.ino
└── tidal
├── boot
└── compositions
```
The `arduino` directory contains code for each microcontroller.
The `tidal` directory features a combination of boot files and
compositions.
The server is also hosting the webpage displayed on the screen. The
server is the Klankschool server. Klankschool are a growing community
of people working with sound in and around Rotterdam, which both of us
are part of.

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
<title></title>
</head>
<body>
<img class="center" src="main.svg">
</body>
<script>
setTimeout(() => { window.location.reload(); }, 1000);
</script>
</html>

View File

@ -1,154 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (0)
-->
<!-- Pages: 1 -->
<svg width="320pt" height="318pt"
viewBox="0.00 0.00 319.85 317.71" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 313.71)">
<polygon fill="white" stroke="none" points="-4,4 -4,-313.71 315.85,-313.71 315.85,4 -4,4"/>
<!-- fan_one -->
<g id="node1" class="node">
<title>fan_one</title>
<ellipse fill="yellow" stroke="yellow" cx="241" cy="-45.11" rx="18" ry="18"/>
</g>
<!-- fan_two -->
<g id="node2" class="node">
<title>fan_two</title>
<ellipse fill="blue" stroke="blue" cx="293.85" cy="-154.86" rx="18" ry="18"/>
</g>
<!-- fan_one&#45;&#45;fan_two -->
<g id="edge1" class="edge">
<title>fan_one&#45;&#45;fan_two</title>
<path fill="none" stroke="none" d="M248.79,-61.3C258.73,-81.93 275.81,-117.4 285.84,-138.24"/>
</g>
<!-- radio_one -->
<g id="node3" class="node">
<title>radio_one</title>
<polygon fill="none" stroke="none" points="11.23,-75.95 42.77,-75.95 54,-111.95 0,-111.95 11.23,-75.95"/>
</g>
<!-- fan_one&#45;&#45;radio_one -->
<g id="edge2" class="edge">
<title>fan_one&#45;&#45;radio_one</title>
<path fill="none" stroke="none" d="M223.12,-49.19C183.54,-58.22 88.74,-79.86 47.14,-89.35"/>
</g>
<!-- lamp_one -->
<g id="node4" class="node">
<title>lamp_one</title>
<path fill="orange" stroke="orange" d="M54,-230.49C54,-232.29 41.9,-233.76 27,-233.76 12.1,-233.76 0,-232.29 0,-230.49 0,-230.49 0,-201.03 0,-201.03 0,-199.23 12.1,-197.76 27,-197.76 41.9,-197.76 54,-199.23 54,-201.03 54,-201.03 54,-230.49 54,-230.49"/>
<path fill="none" stroke="orange" d="M54,-230.49C54,-228.68 41.9,-227.22 27,-227.22 12.1,-227.22 0,-228.68 0,-230.49"/>
</g>
<!-- fan_one&#45;&#45;lamp_one -->
<g id="edge3" class="edge">
<title>fan_one&#45;&#45;lamp_one</title>
<path fill="none" stroke="purple" d="M226.62,-56.57C189.98,-85.79 92.88,-163.22 49.04,-198.19"/>
</g>
<!-- lamp_two -->
<g id="node5" class="node">
<title>lamp_two</title>
<path fill="none" stroke="none" d="M149.24,-306.44C149.24,-308.24 137.14,-309.71 122.24,-309.71 107.34,-309.71 95.24,-308.24 95.24,-306.44 95.24,-306.44 95.24,-276.98 95.24,-276.98 95.24,-275.18 107.34,-273.71 122.24,-273.71 137.14,-273.71 149.24,-275.18 149.24,-276.98 149.24,-276.98 149.24,-306.44 149.24,-306.44"/>
<path fill="none" stroke="none" d="M149.24,-306.44C149.24,-304.63 137.14,-303.16 122.24,-303.16 107.34,-303.16 95.24,-304.63 95.24,-306.44"/>
</g>
<!-- fan_one&#45;&#45;lamp_two -->
<g id="edge4" class="edge">
<title>fan_one&#45;&#45;lamp_two</title>
<path fill="none" stroke="none" d="M233.02,-61.67C211.7,-105.95 153.48,-226.82 131.14,-273.23"/>
</g>
<!-- printer_one -->
<g id="node6" class="node">
<title>printer_one</title>
<polygon fill="none" stroke="none" points="268,-282.6 214,-282.6 214,-246.6 268,-246.6 268,-282.6"/>
</g>
<!-- fan_one&#45;&#45;printer_one -->
<g id="edge5" class="edge">
<title>fan_one&#45;&#45;printer_one</title>
<path fill="none" stroke="none" d="M241,-63.44C241,-104.76 241,-204.75 241,-246.17"/>
</g>
<!-- printer_two -->
<g id="node7" class="node">
<title>printer_two</title>
<polygon fill="purple" stroke="purple" points="149.24,-36 95.24,-36 95.24,0 149.24,0 149.24,-36"/>
</g>
<!-- fan_one&#45;&#45;printer_two -->
<g id="edge6" class="edge">
<title>fan_one&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M223.22,-41.05C203.67,-36.59 172.05,-29.37 149.4,-24.2"/>
</g>
<!-- fan_two&#45;&#45;radio_one -->
<g id="edge7" class="edge">
<title>fan_two&#45;&#45;radio_one</title>
<path fill="none" stroke="none" d="M275.92,-150.76C229.07,-140.07 102.91,-111.28 50.42,-99.29"/>
</g>
<!-- fan_two&#45;&#45;lamp_one -->
<g id="edge8" class="edge">
<title>fan_two&#45;&#45;lamp_one</title>
<path fill="none" stroke="none" d="M275.92,-158.95C230.23,-169.37 109.16,-197.01 54.48,-209.49"/>
</g>
<!-- fan_two&#45;&#45;lamp_two -->
<g id="edge9" class="edge">
<title>fan_two&#45;&#45;lamp_two</title>
<path fill="none" stroke="none" d="M279.51,-166.29C249.46,-190.25 179.73,-245.86 144.07,-274.3"/>
</g>
<!-- fan_two&#45;&#45;printer_one -->
<g id="edge10" class="edge">
<title>fan_two&#45;&#45;printer_one</title>
<path fill="none" stroke="none" d="M286.05,-171.05C276.4,-191.08 260.01,-225.11 249.89,-246.14"/>
</g>
<!-- fan_two&#45;&#45;printer_two -->
<g id="edge11" class="edge">
<title>fan_two&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M279.51,-143.42C249.79,-119.72 181.22,-65.03 145.23,-36.34"/>
</g>
<!-- radio_one&#45;&#45;lamp_one -->
<g id="edge12" class="edge">
<title>radio_one&#45;&#45;lamp_one</title>
<path fill="none" stroke="none" d="M27,-112.19C27,-135.15 27,-174.38 27,-197.4"/>
</g>
<!-- radio_one&#45;&#45;lamp_two -->
<g id="edge13" class="edge">
<title>radio_one&#45;&#45;lamp_two</title>
<path fill="none" stroke="none" d="M35.79,-112.2C53.89,-149.78 95.13,-235.43 113.33,-273.22"/>
</g>
<!-- radio_one&#45;&#45;printer_one -->
<g id="edge14" class="edge">
<title>radio_one&#45;&#45;printer_one</title>
<path fill="none" stroke="none" d="M49.9,-112.21C90.98,-144.97 176.74,-213.36 217.94,-246.21"/>
</g>
<!-- radio_one&#45;&#45;printer_two -->
<g id="edge15" class="edge">
<title>radio_one&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M44.47,-80.02C59.83,-67.77 82.29,-49.85 99.13,-36.42"/>
</g>
<!-- lamp_one&#45;&#45;lamp_two -->
<g id="edge16" class="edge">
<title>lamp_one&#45;&#45;lamp_two</title>
<path fill="none" stroke="none" d="M49.09,-233.38C64.47,-245.65 84.91,-261.94 100.27,-274.19"/>
</g>
<!-- lamp_one&#45;&#45;printer_one -->
<g id="edge17" class="edge">
<title>lamp_one&#45;&#45;printer_one</title>
<path fill="none" stroke="none" d="M54.1,-221.95C95.15,-231.32 172.66,-249.01 213.78,-258.39"/>
</g>
<!-- lamp_one&#45;&#45;printer_two -->
<g id="edge18" class="edge">
<title>lamp_one&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M35.79,-197.51C53.89,-159.93 95.13,-74.28 113.33,-36.49"/>
</g>
<!-- lamp_two&#45;&#45;printer_one -->
<g id="edge19" class="edge">
<title>lamp_two&#45;&#45;printer_one</title>
<path fill="none" stroke="none" d="M149.48,-285.49C168.79,-281.08 194.59,-275.2 213.88,-270.79"/>
</g>
<!-- lamp_two&#45;&#45;printer_two -->
<g id="edge20" class="edge">
<title>lamp_two&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M122.24,-273.33C122.24,-223.46 122.24,-86.07 122.24,-36.3"/>
</g>
<!-- printer_one&#45;&#45;printer_two -->
<g id="edge21" class="edge">
<title>printer_one&#45;&#45;printer_two</title>
<path fill="none" stroke="none" d="M232.26,-246.47C210.35,-200.98 153.24,-82.37 131.14,-36.5"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,15 +1,20 @@
;; visualiser.el
(load-file "~/.emacs.d/elpa/dash-20240510.1327/dash.elc")
(load-file "~/.emacs.d/elpa/mqtt-mode-20180611.1735/mqtt-mode.elc")
(require 'dash)
(require 'mqtt-mode)
;; (toggle-debug-on-error)
(setq mqtt-host "mqtt.klank.school")
(setq mqtt-port 7000)
(toggle-debug-on-error)
;; directory variables
(defconst graphviz-command "circo")
(defconst graph-output-format "svg")
(defconst graph-dir "graphs/")
(defconst image-dir (concat graph-output-format "s/"))
(defconst working-directory "/home/riviera/XPUB2/public-moment/performance/")
(defconst graphviz-graph-output-format "svg")
(defconst graphviz-graph-output-dir "graphs/")
(defconst graphviz-image-output-dir (concat graphviz-graph-output-format "s/"))
(defconst working-directory "~/Applications/listeningdaemon/visualiser/")
(load-file (concat working-directory "secrets.el"))
;; colors
;; (defconst on-color "black" "The default color for objects which are active")
@ -116,17 +121,17 @@
(defun graph-write-file-quietly ()
"Write the graph buffer to a graphviz file quietly"
(let ((inhibit-message t))
(write-file (concat working-directory graph-dir "graph" (number-to-string snapshot) ".dot") t)))
(write-file (concat working-directory graphviz-graph-output-dir "graph" (number-to-string snapshot) ".dot") t)))
(defun format-graph-image-numbered ()
"format the numbered image of the graph quietly, for the .gif"
(let ((inhibit-message t))
(shell-command
(concat graphviz-command " -T" graph-output-format " "
working-directory graph-dir (concat "graph" (number-to-string snapshot) ".dot")
(concat graphviz-command " -T" graphviz-graph-output-format " "
working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot")
" -o "
working-directory image-dir
(concat "graph" (number-to-string snapshot) "." graph-output-format)))))
working-directory graphviz-image-output-dir
(concat "graph" (number-to-string snapshot) "." graphviz-graph-output-format)))))
(defun format-graph-image-main ()
"format the image of the main graph quietly"
@ -134,13 +139,14 @@
nil
(let ((inhibit-message t))
(shell-command
(concat graphviz-command " -T" graph-output-format " "
working-directory graph-dir (concat "graph" (number-to-string snapshot) ".dot")
(concat graphviz-command " -T" graphviz-graph-output-format " "
working-directory graphviz-graph-output-dir (concat "graph" (number-to-string snapshot) ".dot")
" -o "
working-directory "main." graph-output-format
;; working-directory "main." graphviz-graph-output-format
;; output the generated image to /var/www/ so that the webpage stays updated
"/var/www/img/main." graphviz-graph-output-format
))))
(defun format-graph ()
"Series of functions to format the graph to display in the browser
and ultimately turn into a .gif"
@ -277,5 +283,5 @@ and ultimately turn into a .gif"
))))))
(format-graph)
(start-process-shell-command "browser" nil (concat "firefox " working-directory "main.html --kiosk"))
;; (start-process-shell-command "browser" nil (concat "firefox " working-directory "main.html --kiosk"))
(mqtt-start-consumer)

17
web/index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<title>free / abandoned / open / obsolete</title>
<script src="refreshImage.js"></script>
<script>
setInterval(() => {updateImage();}, 1000);
</script>
</head>
<body>
<img id="dynamicImage" class="center">
</body>
</html>

10
web/refreshImage.js Normal file
View File

@ -0,0 +1,10 @@
var newImage = new Image();
newImage.src = "img/main.svg";
function updateImage() {
if(newImage.complete) {
document.getElementById("dynamicImage").src = newImage.src;
newImage = new Image();
newImage.src = "img/main.svg#" + new Date().getTime();
}
}