-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use without API-password? #7
Comments
I can certainly double that, would be great to get some more instruction on how to set this plugin up for a token authentication. Where do I have to put the token to? |
I have not tried that, but maybe using whitelisting (https://www.home-assistant.io/docs/authentication/providers/) may work for a magic mirror use case, since all api accesses will come from the same IP address. |
I did get it to work! I had to extra file containing the environmental variable which actually the starts the mm.sh script I created a magic mirror.config.js in the same folder as the mm.sh
then I started the MM with pm2 reload magic mirror.config.js it works quite brilliantly EDIT1: Changed the rotation mark according to chrismag1c (see below) |
Sorry, I'm a newish to Magic Mirror. I've tried the HA Magic Mirror addon, and then running magic mirror from a Docker. I'm not sure how to approach the subject above. Where would i find the mm.sh? |
Can you please post your config.js |
|
@Kugelfang666 so I created the mirror.config.js file and copied your code and saved the file in the directory where the mm.sh is i.e. my home folder. I then added your above code to my config.js and when I restart my mm using "pm2 restart mm" I get invalid config. What have you done differently to mine? |
also I just realized I missed one } in the code I posted. please check your config |
Is this for hassio or long lived tokens? |
I created a user within the home assistant GUI dedicated for the magic mirror. For this very user I retrieved the long lived token and put it into the environmental variable list |
So you are not using hassio? |
I'm using hassio on a raspberry pi |
Ok I am running HA on docker |
ok, but does it make a difference on how this plugin interacts with home assistant? |
I don't think so |
yes it works, thanks. I created a new magic.config.js (MagicMirror/installers) with the content from above. And started: |
thanks for the finding, I must have screwed up the "" when removing my token, thanks for the finding. I edited my original post accordingly! |
sorry, I don not have mm.sh file. I only have a run-start.sh file in the MagicMirror folder. and it contains these code: I usually use the command "npm start "to run magic mirror. Can you tell me more details? |
i see, I just updated my MM and in the newer releases it works a bit different: I changed the pm2-MagicMirror.json to look like this:
then I created a new file in the same folder called mm.sh which noch contains:
this way pm2 starts the first file which contains the token. In turn this file then starts the mm.sh wich initiates the magidmirror. |
@Kugelfang666 I have absolutely the same setup as yours but I still get only up to the point where the module is loaded but it keeps on “Loading” in MM I do have the long lasting token in HA set up and copied to pm2-MagicMirror.json However my HA is only accessed via HTTPS, so the only change in my config is that https is true not false, however I tried both true and false and it still fails. Any thoughts? |
I’ve made some progress after following the instructions in #8 Now the module loads the sensors names, but the readings are “undefined” … The HA log shows “Login attempt or request with invalid authentication from XXX.XXX.X.X (the IP of the MM)”, however the LL token is correct. I deleted and created a new one and copy-pasted it in the json … don’t know what is going wrong... |
very wired. did you create a dedicated user for the mirror? if not try it. It could be that HASSIO does not like the identical user being logged in via different machines. What I did was to create a dedicated user on my HA. then I logged in as such and created a new permanent token |
Are you using a self signed certificate or letsencypt? And did you try without ssl? |
I am using LetsEncrypt in the DuckDNS addon. Here is my starting point as of now: configuration.yaml
DuckDNS config:
pm2_MagicMirror.json
config.js
I will keep trying without the SSL and DuckDNS to see if that makes difference and will report later. Thanks for the support @Kugelfang666 |
I am getting the following error in the pm2 logs on MM no matter if I use SSL or not:
|
the configuration of the pm2 file and the config.js looks ok to me, maybe just a simple question: from the error message I would assume that the actual connection is ok. did you try polling another sensor? Beyond this I'm afraid thy my expertise ends here :-) |
one more thing: does the SSL protocol also listen to port 8123?? |
@Kugelfang666 yeah I am out of ideas as well ... The connection is fine, I can see that MM is trying to pull the data from HA but fails to authenticate, so trying any other sensor also fails. I am sure that there is something fishy with the authentication but don't know what ... I tried with and without SSL, same thing ... I updated the module, raspbian, HA ... everything is up-to-date but still: I will leave that for now :) If I get inspired another day I will try harder to solve this :D Thanks for your input though :) |
Maybe it helps others in my situation. I run MM in a docker container in server-only mode. For this, add
to your docker command (instead of adding it to the pm2 json). |
[03:20:26.810] [ERROR] Error: Cannot find module 'underscore' |
After some Time I had to reset my token and ran into the same problem. After some digging I found the solution: There seems to be a bug so that pm2 does not read the pm2_MagicMirror.json correctly. SSH into the MM and going into the installers Folger I ran pm2 reload pm2_MagicMirror.json and the problem was gone |
Replace line 130 in hode_helper.js with: Then add a token parameter to your config:
Then just install with npm install and no need for environment parameters :) |
legend. Here we are in 2022, needing to apply work arounds. |
Since api password is being removed from Home Assistant, How to use without API-password?
The text was updated successfully, but these errors were encountered: