Right, I think this is the only way too. It’s kind of annoying though because the value can change so I would need to send it to send node helper every single time it change to keep it up to date.
Oh well.
Read the statement by Michael Teeuw here.
Posts
-
RE: Synchronus socketNotification ?
-
RE: Synchronus socketNotification ?
@shbatm I could but then It would be asynchronus. I can"t have a function doing stuff, get the variable I want, continue to do stuff.
I would have to do stuff, send a socket notification to request the variable, receive the notificataion, send back the variable with another notification then get the notification and only then I would be able to continue what I was doing. This is a very slow process just to get a variable value. Also I would have to store a lot of variable so I can use them in two different function.What I want is similair to a function call you know ? doing stuff in the row. I don’t want to do stuff in two different fonction asynchronusly.
It can be usefull to do it like this in some cases don’t get me wrong, but’s it’s create somes issue as well in some other cases -
Synchronus socketNotification ?
Is there a way to have a synchronus socket notification or something similar ?
Let me explain, I have a module, that module have a node helper. I can send thing directly to the node_helper with a third party software. And I do it by making a GET. As an example, One of the get is about retreving a variable in previously set in config map. But to get that I have to send a socket notification and wait until I have the answer. But this is asynchronus so it doesn’t wait so I can’t send the answer back.
I though about sending the config to the node_helper in the start function but it’s kind of a pain because I would have to update it every so often if the value change.So is there a way to do some sort of synchronus request from the node_helper to the associate js file ?
-
RE: Html into Iframe
Scratch that, the first example is working. It’s just that, because of the body black background, the text inside the iframe wasn’t visible. Justed needed to to change the css for the iframe to overide the background of the body
-
Html into Iframe
Hello, I try to put my own html code into an iframe but it doesn’t work. How shoudl I that ?
I tryed :getDom: function() { var wrapper = document.createElement("div"); var iframe = document.createElement("iframe") iframe.src = this.file("biblop.html") wrapper.appendChild(iframe) return wrapper }
No error, (I can see the border of the iframe) yet nothing happen in it
I tryed to “write” the html into the iframe as well, thinking that I could use the node helper to read my html file to get the content eventually.
getDom: function() { var wrapper = document.createElement("div"); var iframe = document.createElement("iframe") var myContent = '' + 'My dynamic document' + '<p>Hello world</p>'; iframe.contentWindow.document.open('text/htmlreplace'); iframe.contentWindow.document.write(myContent); iframe.contentWindow.document.close(); wrapper.appendChild(iframe) return wrapper }
But content.Window is null every time so it can’t be open.
I tryed to tweak those two solution in different ways (like using absolute path) but the end result was the same.
How can I do that ?(PS: I tryed the first code I wrote above outside of the magic mirror first on my ubuntu and it was working just fine. Soemhow it’s the magic mirror itself that don’t like it)
-
RE: MMM-AlexaPi
@bminer1 That’s normal, there is multiple type of user in linux with different level of permission, it’s for safety (that you or a virus doesn’t destroy your operating system). When you are connected to your regular user (pi if you are using raspbian) you have only access in writing to your home folder. However, the pi user is also a “sudo” user, which mean that you can get higher permission in exchange of providing the right password (which is your regular password in raspbian).
To do that you writesudo your_command
, for examplesudo nano /etc/opt/AlexaPi/config.yaml
. you’ll be ask to enter a password and then you can edit your file.
It’s like being administrator on windows, but with a password instead of a window that ask you if you want to run as administrator -
Same notif received multiple time
I sometime receive the same notification multiple time, like if the mirror run my module twice or something. It’s not happening every time.
As an example, I have a module that send a socket notification in the start function to the node helper to initialise something. let’s call it Notif_A.
l catch it the notification, make sure it’s Notif_A with an if statement, and When the node helper did it’s job it send back the data he got. still with a send socket notification Let’s call it Notif_B.
The odd thing is that I sometime got into the if that check if it received Notif_B twice in a row. Like if I got the notif twice.
The thing is, I only send Notif_A in the start function And I only send Notif_B if I received Notif_A.I also noticed that the getDom function on some modules are callde 2 or 3 time in the raw at the begining (I checked with console.log)
So… what’s happening here ? Why is the notification is catched twice ? Is the start function runned twice for some reason ?
-
RE: MM does not boot when starting my raspberry
@RE_Magic_Mirror Not that I know of but I am not an expert in linux configuration.
But if your issue is about “seeing” the desktop, I might have some tricks for you.
Maybe you could change you desktop wallpaper to be a black screen for started and take away the trash icon so the desktop part is black and empty.
Then you could right click on the panel barr above your screen and enter the panel settings and play around with them to make the barre itself invisible and then take away the unnecessary icons on it.
It will not make your mirror start quicker but you won’t see the default wallpaper and menu as much -
RE: MM does not boot when starting my raspberry
@opensky727 did you put the
sudo
at the begining of the command ?
It should loook like this
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
You should have the permission as sudo