Contrôle Mac via HomeBridge

Bonjour,
je souhaiterais pouvoir contrôler (mettre en veille et réactiver) mon Mac mini 2014 via le plugin Hombridge (https://github.com/alexgustafsson/homebridge-wol#readme).
Jusqu’ici, le statut fonctionne correctement dans Apple Home, mais je n’ai pas réussi à aller plus loin car je ne connaît pas et ne comprend pas les commandes qui sont attendues dans la configuration du plugin (« wakeCommand »: et « shutdownCommand »: ).
Je reste évidemment disponible s’il faut plus de détails sur l’installation pour répondre à ma question.
merci à vous

Hello,

Je ne vois pas le problème, ils indiquent toutes les infos nécessaires sur leur page… et donnent des exemples

J’imagine que le problème c’est moi qui ne comprend pas comment se paramétre le fichier de configuration…
Voilà le log qui indique une erreur lorsque je tente d’éteindre le Mac sur Apple home (a partir de 9h29, avant c’est juste un test qui montre que le statut se met bien à jour quand je le met en veille et le rallume directement sur macOS) :

[7/14/2021, 8:28:07 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Online" to "Offline"
[7/14/2021, 8:28:56 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Offline" to "Online"
[7/14/2021, 8:29:04 PM] [Mac mini 2014] NetworkDevice shutdown cycle started for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 8:29:04 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Online" to "Shutting Down"
[7/14/2021, 8:29:04 PM] [Mac mini 2014] Attempting to shut down "Mac mini 2014" (10.0.0.13) using "ssh"
[7/14/2021, 8:29:04 PM] [Mac mini 2014] An error occured while trying to shut down "Mac mini 2014" (10.0.0.13): Error: Command failed: ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now
/bin/sh: ssh: not found

    at ChildProcess.exithandler (child_process.js:319:12)
    at ChildProcess.emit (events.js:375:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Socket.<anonymous> (internal/child_process.js:441:11)
    at Socket.emit (events.js:375:28)
    at Pipe.<anonymous> (net.js:675:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: 'ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now',
  stdout: '',
  stderr: '/bin/sh: ssh: not found\n'
}
[7/14/2021, 8:29:04 PM] [Mac mini 2014] Waiting for shutdown grace time (15000ms) for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 8:29:19 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Shutting Down" to "Online"

Tu ne semble pas avoir la commande ssh… ajouté un sudo devant peut être… ou bien donné le chemin complet (que tu trouves avec whereis ssh)

Merci pour la réponse.
J’ai ajouté sudo avant la commande de shutdown
Le message d’erreur est différent :

[7/14/2021, 9:20:53 PM] [Mac mini 2014] NetworkDevice shutdown cycle started for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 9:20:53 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Online" to "Shutting Down"
[7/14/2021, 9:20:53 PM] [Mac mini 2014] Attempting to shut down "Mac mini 2014" (10.0.0.13) using "sudo"
[7/14/2021, 9:20:53 PM] [Mac mini 2014] An error occured while trying to shut down "Mac mini 2014" (10.0.0.13): Error: Command failed: sudo ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required

    at ChildProcess.exithandler (child_process.js:319:12)
    at ChildProcess.emit (events.js:375:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Socket.<anonymous> (internal/child_process.js:441:11)
    at Socket.emit (events.js:375:28)
    at Pipe.<anonymous> (net.js:675:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'sudo ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now',
  stdout: '',
  stderr: '\n' +
    'We trust you have received the usual lecture from the local System\n' +
    'Administrator. It usually boils down to these three things:\n' +
    '\n' +
    '    #1) Respect the privacy of others.\n' +
    '    #2) Think before you type.\n' +
    '    #3) With great power comes great responsibility.\n' +
    '\n' +
    'sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper\n' +
    'sudo: a password is required\n'
}
[7/14/2021, 9:20:53 PM] [Mac mini 2014] Waiting for shutdown grace time (15000ms) for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 9:21:08 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Shutting Down" to "Online"

La partie correspondante du fichier de config :

{
            "name": "Mac mini 2014",
            "ip": "10.0.0.13",
            "pingInterval": 2,
            "pingsToChange": 5,
            "pingTimeout": 1,
            "pingCommandTimeout": 0,
            "mac": "L’adresse Mac du Mac mini 2014",
            "startCommandTimeout": 0,
            "wakeGraceTime": 45,
            "wakeCommand": "sudo ssh Mac-mini-2014-de-Florian.local caffeinate -u -t 300",
            "wakeCommandTimeout": 0,
            "shutdownCommand": "sudo ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now",
            "shutdownGraceTime": 15,
            "shutdownCommandTimeout": 0,
            "log": true,
            "logPinger": false,
            "debugLog": false,
            "returnEarly": false,
            "accessory": "NetworkDevice"
        }

Et ici le message en essayant de mettre l’adresse ssh complète donnée par la commande que tu m’as indiqué, dans le terminal :

[7/14/2021, 9:20:07 PM] [Mac mini 2014] NetworkDevice shutdown cycle started for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 9:20:07 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Online" to "Shutting Down"
[7/14/2021, 9:20:07 PM] [Mac mini 2014] Attempting to shut down "Mac mini 2014" (10.0.0.13) using "/usr/bin/ssh"
[7/14/2021, 9:20:07 PM] [Mac mini 2014] An error occured while trying to shut down "Mac mini 2014" (10.0.0.13): Error: Command failed: /usr/bin/ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now
/bin/sh: /usr/bin/ssh: not found

    at ChildProcess.exithandler (child_process.js:319:12)
    at ChildProcess.emit (events.js:375:28)
    at maybeClose (internal/child_process.js:1055:16)
    at Socket.<anonymous> (internal/child_process.js:441:11)
    at Socket.emit (events.js:375:28)
    at Pipe.<anonymous> (net.js:675:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: '/usr/bin/ssh Mac-mini-2014-de-Florian.local sudo shutdown -h now',
  stdout: '',
  stderr: '/bin/sh: /usr/bin/ssh: not found\n'
}
[7/14/2021, 9:20:07 PM] [Mac mini 2014] Waiting for shutdown grace time (15000ms) for "Mac mini 2014" (10.0.0.13)
[7/14/2021, 9:20:22 PM] [Mac mini 2014] NetworkDevice "Mac mini 2014" (10.0.0.13) went from status "Shutting Down" to "Online"

Je suis désolé mais il y a trop a t’expliquer pour que ça marche… donc assez difficile…

La wake command moi je la ferait pas , elle est pas nécessaire si tu la comprends pas.

La shutdown le principe c’est que ça doit être une commande qui doit être capable d’éteindre ton mac… donc à la base , c’est une connexion ssh sur celui ci et elle lance une commande shutdown pour l’éteindre… mais classiquement si tu ne veux pas mettre ton pass dans cette commande il faut commencer à jouer avec une clé ssh etc… et vu ton niveau ça ne semble pas facile à faire… si tu trouves une telle commande et qu’elle fonctionne tu pourras l’utiliser avec homebridge… mais la c’est pas homebridge ton problème au final…

Merci pour la réponse, je vais creuser un peu avec ces explications, mais oui ça semble clairement dépasser mes compétences donc pas sur que j’aille au bout.

Bonjour,
À l’avenir veuillez faire attention de mettre vos logs dans une balise Texte préformaté
J’ai corrigé tout vos posts.

1 « J'aime »