Open srd424 opened 3 weeks ago
Yeah, it was weird, I had a poke around with strace, ran the commands manually, couldn't figure out what was going on. It's also possible I got confused of course (particularly by the async stuff), I will try to remember to have another look!
FWIW, netstat
and ifconfig
(which that module also uses, I think) are both fairly old fashioned / deprecated on Linux now, you'll find that lots of environments don't include them by default (though mine do - as I am also old-fashioned!) ss(8)
is the modern equivalent to netstat
, and ip(8)
replaces ifconfig
, though it should also be possible to read a lot of that information directly out of files in /proc
or /sys
, I would think.
Hi,
I'm old fashioned linux guy too, but can confirm that module is older than 7 years, the only reason i choosed it, was to query the ip associated with the default route. As i see other modules do similar hacks, for example this: https://www.npmjs.com/package/default-gateway I guess the inbult "os" module interface lacks these features.
Your solution is a good way to go, but let me investigate later because i'm busy with other work nowadays.
BTW i'm using the web version of the script from the "dev" branch: https://github.com/suletom/EASUN-ISOLAR-SMX-II-CONTROL/blob/dev/demo.png Lot of cool features has been implemented on this (chart, monitoring, ups style energy management with solar prediction), but it also lacks some other functions, for example "plug pro" related things. Unfortunately lot of fixes needs to be merged to this branch too, but my plan is to add multiple device support to this version at the future.
For some reason, the attempt to get the local IP address hangs in one of my containers. This patch at least stops the code trying to fetch it if it's already specified on the command line. This is mostly whitespace/indent change. Do check it because I don't really know js!