Read the statement by Michael Teeuw here.
MMM-HomeKit | Control your MagicMirror with Apple HomeKit
-
@Sean said in MMM-HomeKit | Control your MagicMirror with Apple HomeKit:
Can we add additional cmdSwitch2 platform for other shell command? If so, module controlling could be added besides screen on/off
Yes! Absolutely. Just add this to the “switches” sections.
{ "name" : "Name of the HomeKit command", "on_cmd": "bash command to show a module", "off_cmd": "bash command to hide a module", "state_cmd": "bash command to get the hide / show status'", "manufacturer": "Raspberry Pi Foundation", "model": "Raspberry Pi 3 Model B", }
Your config.json should look something like this.
"platforms": [{ "platform": "cmdSwitch2", "name": "Raspberry Pi", "switches": [{ "name" : "Mirror", "on_cmd": "tvservice --preferred && sudo chvt 6 && sudo chvt 7", "off_cmd": "tvservice -o", "state_cmd": "tvservice --status | grep -i 'HDMI DMT'", "manufacturer": "Raspberry Pi Foundation", "model": "Raspberry Pi 3 Model B", }, { "name" : "Name of the HomeKit command", "on_cmd": "bash command to show a module", "off_cmd": "bash command to hide a module", "state_cmd": "bash command to get the hide / show status'", "manufacturer": "Raspberry Pi Foundation", "model": "Raspberry Pi 3 Model B", }] }]
-
Excellent module!
Got everything working fairly easily. I am attempting to add my own switches, but the issues I am having is that the “on_cmd” and “off_cmd” do not use npm correctly. Any ideas? This is the error it’s throwing. Didn’t have luck Googling.
[3/10/2019, 1:42:17 PM] [Raspberry Pi] npm ERR! path /home/pi/package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent
-
Okay, looks like something with my npm was broken. It was working before, so I think installing this module or Homebridge did it. Attempting to fix.
-
@p4lsec said in MMM-HomeKit | Control your MagicMirror with Apple HomeKit:
Excellent module!
Hello ! Thank you for that compliment.
Unfortunately, I don’t know where your problem comes from. What is the command you are executing that gives you this error?
Keep me informed :wink: -
@XC2DN
My Homebridge is at another Pi then the Mirror. How I have to use it? -
@Niggich Making connection to the other pi through ssh to send commands? Or if your using a module which allows to give commands through a url u can use curl… In this example I use both…
{ "name" : "Magic Mirror", "on_cmd": "curl -s 'http://192.168.X.XX:8080/remote?action=MONITORON'", "off_cmd": "curl -s 'http://192.168.X.XX:8080/remote?action=MONITOROFF'", "state_cmd": "sshpass -p 'sshpassword' ssh -oStrictHostKeyChecking=no pi@192.168.X.XX vcgencmd display_power | grep -q '1' && echo '1'", "polling": true, "interval": 10, "manufacturer": "XXX", "model": "v 1.0.0" }
You might need to install sshpass: apt-get install sshpass, which allows you to connect through ssh with password without being prompted on the command line for the password.
-
@Caimin Thank you a lot. It is working like this. I install sshpass to send the Commands via ssh.
-
This post is deleted! -
This post is deleted! -
Hi!
I need a little help setting it up…
When turning on the mirror in the HomeKit App I get the following log:[2020-3-29 22:26:16] [Raspberry Pi] Mirror is off. [2020-3-29 22:26:17] [Raspberry Pi] Failed to turn on Mirror [2020-3-29 22:26:17] [Raspberry Pi] Als het goed is hebt u de gebruikelijke informatie ontvangen van uw systeembeheerder. Gewoonlijk komt het neer op de volgende drie punten: 1. Respecteer de privacy van anderen. 2. Denk na voordat u iets doet. 3. Veel mogelijkheden betekent veel verantwoordelijkheid. sudo: geen terminal aanwezig en geen wachtwoordvraag(askpass)-programma opgegeven
Translated
[2020-3-29 22:26:16] [Raspberry Pi] Mirror is off. [2020-3-29 22:26:17] [Raspberry Pi] Failed to turn on Mirror [2020-3-29 22:26:17] [Raspberry Pi] "Als het goed is hebt u de gebruikelijke informatie ontvangen van uw systeembeheerder. Gewoonlijk komt het neer op de volgende drie punten: 1. Respecteer de privacy van anderen. 2. Denk na voordat u iets doet. 3. Veel mogelijkheden betekent veel verantwoordelijkheid." This is a little talk about privacy but then: sudo: no terminal available and no passwordask(askpass) programs gave up.
If anyone knows a solution, would be appreciated!