Read the statement by Michael Teeuw here.
Module Developer Challenge - I surrender!
-
@Sean said in Module Developer Challenge - I surrender!:
I think 99 is somehow too small. Use bigger values or timestamp for preventing duplicated.
Yes, see the edit to my post. I was writing that as you posted.
I’ll report back
-
So, after having tried Sean’s suggestion I realized my mistake in using a random number instead of timestamp. As I was about to try your suggestion I realized that I could use a part of Sean’s suggestion and a part of your suggestion.
I had already set up a var for random numbers, so I changed that to
var getTimeStamp = new Date().getTime();
which was your idea added to Sean’s idea of a random value. A quick check in the console showed me it was working.http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508717386975 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508717686862 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508717686866 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508717987939 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508717987944 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508718287819 MMM-SunRiseSet.js:166 http://api.usno.navy.mil/imagery/earth.png?date=today&seed=1508718287823
Then a simple edit to the url which was kinda, sorta, like the ideas you both had.
img.src = "http://api.usno.navy.mil/imagery/earth.png?date=today&seed=" + getTimeStamp;
And BOOM! Success! I’ll leave it running all night and check it in the morning but I don’t foresee any problems
So, thank you Strawberry and thank you Sean. You guys are truly amazing!!!
Commence embarrassment recovery
-
So far, so good. I have it running on my MacBuntu laptop. Here is a 2 frame animation so you get the idea. Obviously, there are quite a few updates absent from the gif and the shadow will move much more slowly and not jump across the planet. hehe
-
I am happy to report that the module ran for the last 11 hours without a hitch. The visual image shows day and night exactly where it should.
-
I find myself in a similar situation, again. :-)
This is my cry for help. I only do this when I’ve tried all the things I know
and googled the things I don’t know. I’ve even tried free form improvising but coding
seems to reject that sort of thing, at least in my case.About 2 weeks ago I wrote a module that gets system stats from a PC board running
ubuntu and MM. There is just one more thing that I want to include. I want to get the system
temperature (CPU?) and/or the temps of any other system components.So, it is with the utmost humility that I ask for your help, suggestions or directions. I won’t
object to any modifications that anyone cares to make, if that is the case. If it can’t be done,
I can live with that, too. Even if you look at the module and never make any comments regarding
my request, I still thank you for your time and interest.https://github.com/mykle1/MMM-PC-Stats
Peace
-
@Mykle1 It doesn’t seem that pc-stats has all the info you require. You might consider switching to the systeminformation package.
You can then use
si.cpu()
for your CPU stats andsi.cpuTemperature()
to retrieve an object that (if I read the docs right) looks like{ main: 0, max: 0, cores: [0, 0] }
with your core temps. You can then combine the two responses (or you may be able to have it return all within one request) and return those in a singlesendNotification()
call. -
You know, I started out with that package but had some trouble with it. Likely, the problem was me, but I moved to the pc-stats package and had no problems. However, as you saw, that package doesn’t offer the cpu temps. I then tried unsuccessfully to use other packages along with pc-stats to get the temps but my knowledge and abilities are woefully inadequate. For whatever reason, I was able to get a return from pc-stats. That’s no small miracle where I’m concerned. I do like the data that the return gives me, especially the multicore support.
Anyway, I did give it more than a few days and more than a few attempts but I will look at systeminformation again in the hopes that I can stumble across some success. Really, I am not qualified to be doing any of this. I just find it so fascinating that I keep trying until I get something right. And then there are the few special people that have taken pity on me and taught me what I needed to know at any given moment. They have my deepest gratitude and respect.
Thanks for pointing me back to where I should have been all along. :-)
-
@Mykle1 Depending on the style/implementation you’re using, you may want to read up on Promises in JS.
Also, see this note here about the
lm-sensors
package.Alternatively, have a look at MMM-SystemStats which uses
vcgencmd
on the CLI to retrieve the system temp, which would be far easier to integrate into your current module. -
@ninjabreadman said in Module Developer Challenge - I surrender!:
Alternatively, have a look at MMM-SystemStats which uses vcgencmd on the CLI to retrieve the system temp, which would be far easier to integrate into your current module.
Thanks ninja. I will give this a shot first. In fact, I’m going to look at that right now.
-