make-agent

This commit is contained in:
2026-10-06 14:27:41 +02:00
parent 99beaff4ca
commit 1d07a0c255
5 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -207,7 +207,7 @@ cd ~/voice-agent-install
sudo make install sudo make install
# 3. Configure # 3. Configure
sudo nano /etc/voice-agent/agent.yaml sudo nano /etc/voice-assistant/agent.yaml
# id: pc-bureau ← name used in MQTT topics # id: pc-bureau ← name used in MQTT topics
# mqtt.host: 192.168.1.104 ← broker IP address # mqtt.host: 192.168.1.104 ← broker IP address
# dry_run: false ← true to test without executing anything # dry_run: false ← true to test without executing anything
@@ -283,7 +283,7 @@ Current step: **15b — Linux machines on the network**. Steps 1 to 15 are valid
"Hey Mycroft, éteins le PC du bureau": each machine runs an **agent** "Hey Mycroft, éteins le PC du bureau": each machine runs an **agent**
([agent/voice_agent.py](agent/voice_agent.py)), a small MQTT client that only runs ([agent/voice_agent.py](agent/voice_agent.py)), a small MQTT client that only runs
the actions in **its own** list (`/etc/voice-agent/agent.yaml`): fixed commands, the actions in **its own** list (`/etc/voice-assistant/agent.yaml`): fixed commands,
no shell. The server only sends an action name. "Allume" wakes a machine that is no shell. The server only sends an action name. "Allume" wakes a machine that is
off through **Wake-on-LAN** (a network packet received by the sleeping network card). off through **Wake-on-LAN** (a network packet received by the sleeping network card).
@@ -298,7 +298,7 @@ off through **Wake-on-LAN** (a network packet received by the sleeping network c
2. `make run`, then "Hey Mycroft, éteins le PC du bureau" → confirmation → "oui": 2. `make run`, then "Hey Mycroft, éteins le PC du bureau" → confirmation → "oui":
the agent prints `essai : systemctl poweroff (non execute)`. the agent prints `essai : systemctl poweroff (non execute)`.
3. Real machine: copy `agent/` to it, `make -C agent install`, edit 3. Real machine: copy `agent/` to it, `make -C agent install`, edit
`/etc/voice-agent/agent.yaml`, and name it in `server/config.yaml` (`machines.list`). `/etc/voice-assistant/agent.yaml`, and name it in `server/config.yaml` (`machines.list`).
**Anonymous broker**: any device on the network can then publish on `agent/<machine>/command`. **Anonymous broker**: any device on the network can then publish on `agent/<machine>/command`.
In production, use the accounts and rights of step 15 (`mosquitto/acl` has the agent rules). In production, use the accounts and rights of step 15 (`mosquitto/acl` has the agent rules).
+3 -3
View File
@@ -208,7 +208,7 @@ cd ~/voice-agent
sudo make install sudo make install
# 3. Configurer # 3. Configurer
sudo nano /etc/voice-agent/agent.yaml sudo nano /etc/voice-assistant/agent.yaml
# id: pc-bureau ← nom dans les topics MQTT # id: pc-bureau ← nom dans les topics MQTT
# mqtt.host: 192.168.1.104 ← adresse IP du broker # mqtt.host: 192.168.1.104 ← adresse IP du broker
# dry_run: false ← true pour tester sans rien exécuter # dry_run: false ← true pour tester sans rien exécuter
@@ -284,7 +284,7 @@ L'état exact du projet, étape par étape, est dans **[CONTEXT.md](CONTEXT.md)*
« Hey Mycroft, éteins le PC du bureau » : chaque machine fait tourner un **agent** « Hey Mycroft, éteins le PC du bureau » : chaque machine fait tourner un **agent**
([agent/voice_agent.py](agent/voice_agent.py)), petit client MQTT qui n'exécute que ([agent/voice_agent.py](agent/voice_agent.py)), petit client MQTT qui n'exécute que
les actions de **sa** liste (`/etc/voice-agent/agent.yaml`), commandes fixes, sans les actions de **sa** liste (`/etc/voice-assistant/agent.yaml`), commandes fixes, sans
shell. Le serveur n'envoie qu'un nom d'action. « Allume » réveille une machine shell. Le serveur n'envoie qu'un nom d'action. « Allume » réveille une machine
éteinte par **Wake-on-LAN** (paquet réseau reçu par la carte réseau en veille). éteinte par **Wake-on-LAN** (paquet réseau reçu par la carte réseau en veille).
@@ -299,7 +299,7 @@ shell. Le serveur n'envoie qu'un nom d'action. « Allume » réveille une machin
2. `make run`, puis « Hey Mycroft, éteins le PC du bureau » → confirmation → « oui » : 2. `make run`, puis « Hey Mycroft, éteins le PC du bureau » → confirmation → « oui » :
l'agent affiche `essai : systemctl poweroff (non execute)`. l'agent affiche `essai : systemctl poweroff (non execute)`.
3. Machine réelle : copier `agent/` dessus, `make -C agent install`, régler 3. Machine réelle : copier `agent/` dessus, `make -C agent install`, régler
`/etc/voice-agent/agent.yaml`, et la nommer dans `server/config.yaml` (`machines.list`). `/etc/voice-assistant/agent.yaml`, et la nommer dans `server/config.yaml` (`machines.list`).
**Broker anonyme** : tout appareil du réseau peut alors publier sur `agent/<machine>/command`. **Broker anonyme** : tout appareil du réseau peut alors publier sur `agent/<machine>/command`.
En production, les comptes et droits de l'étape 15 (`mosquitto/acl` contient les règles des agents). En production, les comptes et droits de l'étape 15 (`mosquitto/acl` contient les règles des agents).
+1 -1
View File
@@ -4,7 +4,7 @@
SHELL := /bin/bash SHELL := /bin/bash
PREFIX := /opt/voice-agent PREFIX := /opt/voice-agent
CONFIG_DIR := /etc/voice-agent CONFIG_DIR := /etc/voice-assistant
# Mêmes versions que le serveur (server/pyproject.toml). # Mêmes versions que le serveur (server/pyproject.toml).
DEPS := paho-mqtt==2.1.0 PyYAML==6.0.2 DEPS := paho-mqtt==2.1.0 PyYAML==6.0.2
+1 -1
View File
@@ -1,6 +1,6 @@
# Agent de l'assistant vocal (étape 15b) : UNE machine Linux commandée par la voix. # Agent de l'assistant vocal (étape 15b) : UNE machine Linux commandée par la voix.
# #
# Installé par « make agent-install » dans /etc/voice-agent/agent.yaml (lisible par root # Installé par « make agent-install » dans /etc/voice-assistant/agent.yaml (lisible par root
# seulement : il peut contenir un mot de passe MQTT). Après modification : # seulement : il peut contenir un mot de passe MQTT). Après modification :
# sudo systemctl restart voice-agent # sudo systemctl restart voice-agent
# #
+1 -1
View File
@@ -5,7 +5,7 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
ExecStart=/opt/voice-agent/.venv/bin/python /opt/voice-agent/voice_agent.py --config /etc/voice-agent/agent.yaml ExecStart=/opt/voice-agent/.venv/bin/python /opt/voice-agent/voice_agent.py --config /etc/voice-assistant/agent.yaml
# Relancé s'il s'arrête (broker absent au démarrage, plantage...) : l'agent doit toujours répondre. # Relancé s'il s'arrête (broker absent au démarrage, plantage...) : l'agent doit toujours répondre.
Restart=always Restart=always
RestartSec=5 RestartSec=5