Nefit Easy™

Others (MiLight, Hue, Toon etc...)
Geitje
Posts: 11
Joined: Monday 22 January 2018 22:52
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by Geitje » Monday 09 July 2018 9:28

Any solutions to this problem? I have this issue for some weeks now, and follow these threads curiously. However solving seems to stagnate now? I experience the CPU spikes now and then, and every half hour or so the "nefit hardware thread has stopped" message in log. Every 2-3 weeks domoticz crashes.
I have updated Node, Nefit server and latest beta of Domoticz. Anyone working on this issue still?
Domoticz latest beta, on Raspberry Pi

peerke72
Posts: 9
Joined: Sunday 17 June 2018 17:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by peerke72 » Monday 16 July 2018 21:49

i (temporay) removed nefit easy http server from my raspberry pi and disabled it also in domoticz in the hardware menu.
domoticz is running as smooth as before ...

but i still wonder why this problem only seems to occur with the combination of
- domoticz
- nefit easy http server
- raspberry pi

and further based on the information of robert klep (see https://github.com/robertklep/nefit-easy-core/issues/14)
it could also depends on how often a Nefit Easy is offline.

maybe it's depending on the (in)stability of the internet/modem connection
so users with a very stable internet connection maybe don't have any issues.

btw my ziggo ubee wifi modem isn't known for it's stability ...
my nefit easy is connected to a seperate wifi router
but maybe there is a relationship with the issue.

for now i don't need to use my heating (today 30 degrees celcius outside pfff) so i can disable nefit easy server
that way domoticz stays running very stable without strange behaviour caused by nefit easy
but before we now it it's freezing again ...

i'm out of options ...
who can help?

mickmack82
Posts: 4
Joined: Wednesday 31 January 2018 16:04
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by mickmack82 » Wednesday 25 July 2018 10:03

Maybe I've found something in the errorlog of PM2 we can use to solve the issue.
The errorlog of PM2 is flooded with the following message:

Code: Select all

(node:29044) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null
    at Promise (/usr/lib/node_modules/nefit-easy-http-server/node_modules/@xmpp/connection/index.js:307:19)
    at new Promise (<anonymous>)
    at Client.write (/usr/lib/node_modules/nefit-easy-http-server/node_modules/@xmpp/connection/index.js:305:12)
    at Client.send (/usr/lib/node_modules/nefit-easy-http-server/node_modules/@xmpp/connection/index.js:292:17)
    at Client.Connection.send (/usr/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-core/lib/index.js:15:15)
    at Client.send (/usr/lib/node_modules/nefit-easy-http-server/node_modules/@xmpp/client-core/lib/Client.js:18:18)
    at Object.queue.add [as promiseGenerator] (/usr/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-core/lib/index.js:125:19)
    at Queue._dequeue (/usr/lib/node_modules/nefit-easy-http-server/node_modules/promise-queue/lib/index.js:153:30)
    at /usr/lib/node_modules/nefit-easy-http-server/node_modules/promise-queue/lib/index.js:109:18
    at new Promise (<anonymous>)
    at Queue.add (/usr/lib/node_modules/nefit-easy-http-server/node_modules/promise-queue/lib/index.js:94:16)
    at NefitEasyCommands.queueMessage (/usr/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-core/lib/index.js:122:23)
    at NefitEasyCommands.send (/usr/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-core/lib/index.js:197:17)
    at queueMessage.catch.e (/usr/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-core/lib/index.js:201:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:29044) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3088)
No Idea what the problem is... but something isn't going as expected.
I also experience more and more CPU and memory usage over time with domoticz. Maybe nodejs is encoutering a loop which takes more and more resources like a memory leak?

-Update-
Currently running a modified debug version of nefit-easy-core as provided by Robert. I'll let it know if things improve.

peerke72
Posts: 9
Joined: Sunday 17 June 2018 17:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by peerke72 » Friday 10 August 2018 18:39

i've been on holiday for a few weeks.
did installing the 'debug version' improve things or give some usefull log information ?

i see on robert klep's site https://github.com/robertklep/nefit-easy-core/issues/14
that he's still looking into some issues.
maybe they are related to our problem.

martk
Posts: 30
Joined: Monday 14 March 2016 14:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by martk » Wednesday 15 August 2018 21:36

My memory and cpu usage is also extreme lately.

I use a workaround to fix this until robert or domoticz has a solution.

Every night at 03:00 I start a script to restart the nefit easy server with LUA:

(script_time_blabla)

Code: Select all

if (os.date("%H:%M") == "03:00") then
	print("Nefit Easy Server wordt opnieuw gestart!")
	os.execute("/home/pi/domoticz/scripts/restarteasy.sh")
end
The script contains:

Code: Select all

sudo -u pi /usr/bin/pm2 restart nefiteasy

This way my domoticz won't hang after 2-3 weeks.

peerke72
Posts: 9
Joined: Sunday 17 June 2018 17:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Nefit Easy™

Post by peerke72 » Monday 20 August 2018 21:24

Robert Klep released a new beta version.

This seems to make cpu consumption and memory consumption stable again.
It's still a beta version but it works a lot better for me.

More details can be found on: https://github.com/robertklep/nefit-eas ... -414141929

edit1: 21-8-2018, version 5.02 is now final and released, so @all please check if it solves also your problems.

edit2: 26-8-2018, i'm running the new version about week now and it's still running stable

jurgen
Posts: 40
Joined: Friday 02 October 2015 19:09
Target OS: NAS (Synology & others)
Domoticz version: stable
Contact:

Re: Nefit Easy™

Post by jurgen » Sunday 16 September 2018 17:02

Hi All,

Previously i had some issues with Nefit on my synology with version DSM 6.1.7-15284 Update 2 while my old DSM version 6.0.2 has no issues.

XMPP Authentication failure, so i decided to update nefit with npm update neftit-easy-http-server -g but it get's worse.

After that Nefit won't even start anymore.

Then updated NODE JS and NPM to the following versions

node -v v8.9.4
npm -v 5.6.0

but without any luck.

Then i decided to remove everything, NPM,node and nefit and rebooted the NAS.

Then i installted node js 8.9.4 and NPM 5.6.0 and installed nefit again. The installation seems fine, but nefit won't start.

-ash: ./easy-server: No such file or directory

So i went to /usr/local/bin and saw that the symbolic link was not removed during the uninstallation process. Normally this is not a problem but the link linked to something does not exist anymore.

root@DS411:/usr/local/bin# ls -l
total 12
lrwxrwxrwx 1 root root 58 Sep 14 15:25 easy-server -> ../lib/node_modules/nefit-easy-http-server/bin/easy-server

So i removed the symbolic link and created a new one.

root@DS411:/usr/local/bin# ln -s /volume1/@appstore/Node.js_v8/usr/local/bin/easy-server easy-server

and Nefit is started again!

root@DS411:/usr/local/etc/rc.d# netstat -a|grep 3000
tcp 0 0 localhost:3000 0.0.0.0:* LISTEN

Hopefully this will help other people.


For further information see my old tutorial:
https://www.domoticz.com/wiki/Synology# ... _DSM_6.0.2

JoeneH
Posts: 22
Joined: Saturday 24 February 2018 14:43
Target OS: NAS (Synology & others)
Domoticz version: v4.9700
Location: NL
Contact:

Re: Nefit Easy™

Post by JoeneH » Friday 26 October 2018 18:02

Thanks @jurgen,

early June I had similar problems.
I also found the 'old' link, removed it and was able to get the easy-server running again.

However, I used to use pm2, as suggested in https://www.domoticz.com/wiki/NefitEasy

Now I don't have pm2 any more and noticed it isn't needed any more.

However, I don't understand how to create a startup script, as in, what should be written down in the easy-server.sh file.
Is what is written at the end of the wiki page https://www.domoticz.com/wiki/Synology# ... _DSM_6.0.2 the content for the script?
If so, what and where exactly should I change in this script for it to work? I have a very limited understanding of all those languages. I understand I have to put in the details of serial number, access key password, in the ENTERSERIAL, ENTERKEY and ENTERPASSWORD parts.
But do I remove all or some of the #?
Do I have to make other changes?

smaus
Posts: 5
Joined: Sunday 18 February 2018 10:32
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Nefit Easy™

Post by smaus » Sunday 28 October 2018 11:46

Hi All,

When i try to run the nefit server i get a error, can someone help me.


easy-server --serial=serialnumber --access-key=enteryourkey --password=enteryourpassword

module.js:540
throw err;
^

Error: Cannot find module 'node-xmpp-core'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-commands/node_modules/nefit-easy-core/lib/scram-auth-mechanism.js:4:19)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/nefit-easy-http-server/node_modules/nefit-easy-commands/node_modules/nefit-easy-core/lib/index.js:10:20)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:

jurgen
Posts: 40
Joined: Friday 02 October 2015 19:09
Target OS: NAS (Synology & others)
Domoticz version: stable
Contact:

Re: Nefit Easy™

Post by jurgen » Tuesday 13 November 2018 20:48

JoeneH wrote:
Friday 26 October 2018 18:02
Thanks @jurgen,

early June I had similar problems.
I also found the 'old' link, removed it and was able to get the easy-server running again.

However, I used to use pm2, as suggested in https://www.domoticz.com/wiki/NefitEasy

Now I don't have pm2 any more and noticed it isn't needed any more.

However, I don't understand how to create a startup script, as in, what should be written down in the easy-server.sh file.
Is what is written at the end of the wiki page https://www.domoticz.com/wiki/Synology# ... _DSM_6.0.2 the content for the script?
If so, what and where exactly should I change in this script for it to work? I have a very limited understanding of all those languages. I understand I have to put in the details of serial number, access key password, in the ENTERSERIAL, ENTERKEY and ENTERPASSWORD parts.
But do I remove all or some of the #?
Do I have to make other changes?
Hi Joeneh,

The link to wiki for synology with nefiteasy, i wrote that tutorial a while ago to put some pieces together for myself and other people who need that.
The following values needs to be edited:

NEFIT_SERIAL_NUMBER=SERIALNUMBERINVULLEN
NEFIT_ACCESS_KEY=ACCESSKEYINVULLEN
NEFIT_PASSWORD=WACHTWOORDINVULLEN

Place the script in the following directory:
/usr/local/etc/rc.d

Name it:
easy-server.sh

Edit the permissions:
chmod 755 easy-server.sh

for testing purposes you could start the script
./easy-server.sh


#! /bin/sh
### BEGIN INIT INFO
# Provides: nefit easy http server
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nefit-easy-http-server
# Description: This daemon will start the nefit-easy-http-server for use by Domoticz
### END INIT INFO

# Do NOT "set -e"

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DESC="Nefit Easy HTTP Server"
NAME=easy-server
USERNAME=root
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/usr/local/etc/rc.d/$NAME
NEFIT_SERIAL_NUMBER=SERIALNUMBERINVULLEN
NEFIT_ACCESS_KEY=ACCESSKEYINVULLEN
NEFIT_PASSWORD=WACHTWOORDINVULLEN
NEFIT_HOST=127.0.0.1
NEFIT_PORT=3000


DAEMON=/usr/local/bin/$NAME

DAEMON_ARGS="$DAEMON_ARGS --serial=$NEFIT_SERIAL_NUMBER"
DAEMON_ARGS="$DAEMON_ARGS --access-key=$NEFIT_ACCESS_KEY"
DAEMON_ARGS="$DAEMON_ARGS --password=$NEFIT_PASSWORD"
DAEMON_ARGS="$DAEMON_ARGS --host=$NEFIT_HOST"
DAEMON_ARGS="$DAEMON_ARGS --port=$NEFIT_PORT"


# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

#
# Function that starts the daemon/service
#
do_start()
{
nohup $DAEMON $DAEMON_ARGS &
echo `ps w | grep ${DAEMON} | grep -v -E 'grep' | awk '{print $1}' > $PIDFILE`

}

wait_for_status ()
{
counter=$2
while [ ${counter} -gt 0 ]; do
do_status
[ $? -eq $1 ] && return
let counter=counter-1
sleep 1
done
return 1
}

#
# Function that stops the daemon/service
#

do_stop()

{
# Kill the application
kill `cat ${PIDFILE}`
wait_for_status 1 20 || kill -9 `cat ${PIDFILE}`
rm -f ${PIDFILE}
}


do_status ()
{
if [ -f ${PIDFILE} ] && kill -0 `cat ${PIDFILE}` > /dev/null 2>&1; then
return
fi
rm -f ${PIDFILE}
return 1
}


case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 3
;;
esac

:

JoeneH
Posts: 22
Joined: Saturday 24 February 2018 14:43
Target OS: NAS (Synology & others)
Domoticz version: v4.9700
Location: NL
Contact:

Re: Nefit Easy™

Post by JoeneH » Thursday 15 November 2018 12:47

@jurgen,

thanks,
however, testing it gives the following:
-sh: ./easy-server.sh: /bin/sh^M: bad interpreter: No such file or directory

what's wrong?
I am running DSM 6.2.1

jurgen
Posts: 40
Joined: Friday 02 October 2015 19:09
Target OS: NAS (Synology & others)
Domoticz version: stable
Contact:

Re: Nefit Easy™

Post by jurgen » Thursday 29 November 2018 20:23

JoeneH wrote:
Thursday 15 November 2018 12:47
@jurgen,

thanks,
however, testing it gives the following:
-sh: ./easy-server.sh: /bin/sh^M: bad interpreter: No such file or directory

what's wrong?
I am running DSM 6.2.1
I think it is a copy paste issue. Copy the script from the forum to notepad and then copy the script in VI of NANO.

JoeneH
Posts: 22
Joined: Saturday 24 February 2018 14:43
Target OS: NAS (Synology & others)
Domoticz version: v4.9700
Location: NL
Contact:

Re: Nefit Easy™

Post by JoeneH » Sunday 02 December 2018 16:41

It is not a copy paste issue. Copying the forum text to notepad++ gives exactly the same as copying it to windows notepad and then to notepad++. I don't use VI or NANO.
I save the file in notepad++ as unix script file and then copy it to /usr/local/etc/rc.d and change the permission to 755.

I must say I have hardly a clue what the script does exactly, I have no experience writing scripts, but I noticed the following
The script has this line:
PIDFILE=/var/run/$NAME.pid but theer is no file called easy-server.pid in /var/run

And should the line
SCRIPTNAME=/usr/local/etc/rc.d/$NAME
perhaps end with $NAME.sh
Because the file is easy-server.sh and NAME=easy-server
It also has
USERNAME=root
but I never use root anywhere, I log on as admin when connecting to to the synology NAS, and I don't see $USERNAME anywhere in the script.

EDIT
Googling the error does point to a problem with DOS/Windows line endings. Using Notepad++ and saving the file as a unix script I would hope this is not the issue... Well, it was. I had to change the format of the file to Unix in the settings somewhere in Notepad++

Now, running ./easy-server.sh gives the following
Usage: /usr/local/etc/rc.d/easy-server {start|stop|restart}

Does that mean it works? Should I restart the NAS now? Or can I manually start the script and not rebooting the NAS?

SweetPants
Posts: 2397
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V4.10267
Location: The Netherlands
Contact:

Re: Nefit Easy™

Post by SweetPants » Sunday 02 December 2018 19:32

JoeneH wrote:
Sunday 02 December 2018 16:41
Now, running ./easy-server.sh gives the following
Usage: /usr/local/etc/rc.d/easy-server {start|stop|restart}

Does that mean it works? Should I restart the NAS now? Or can I manually start the script and not rebooting the NAS?
Sounds like your script is executed. You don't have to reboot the NAS, just execute this command and add 'start'. But it is always good practice to reboot your NAS so you know that it starts after a reboot too.
Ubuntu 16.04.5 LTS, Intel NUC, MySensors 2.3.0-alpha, Pro Mini 3.3/8M RFM69(HW), ESP8266 (SDK2.2.0), Sonoff, RFLink, RFXcom, MQTT, NodeRed, Domoticz Beta (from source)

JoeneH
Posts: 22
Joined: Saturday 24 February 2018 14:43
Target OS: NAS (Synology & others)
Domoticz version: v4.9700
Location: NL
Contact:

Re: Nefit Easy™

Post by JoeneH » Sunday 02 December 2018 22:40

Domoticz wasn't getting any data from the Nefit-easy, so I tried ./easy-server.sh start and it showed the following:
./easy-server.sh: line 45: /var/run/easy-server.pid: Permission denied
nohup: appending output to ‘/var/services/homes/admin/nohup.out’

Using sudo ./easy-server.sh start the message was:
nohup: appending output to ‘nohup.out’

Now Domoticz is getting data. I'll try rebooting tomorrow. EDIT: script is running automatically after reboot. Thanks.

But what is this nohup.out file all about? Seems unnecessary to me. Can I somehow stop this form being created and filled?

The nohup.out file is filling up with data about every 30 seconds
The nohup.out file contains the following:
HTTP server listening on http://127.0.0.1:3000
127.0.0.1 - - [02/Dec/2018:20:08:00 +0000] "GET /bridge/ecus/rrc/uiStatus HTTP/1.1" 200 494 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:08:00 +0000] "GET /bridge/heatingCircuits/hc1/actualSupplyTemperature HTTP/1.1" 200 163 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:08:00 +0000] "GET /bridge/system/appliance/displaycode HTTP/1.1" 200 101 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:08:31 +0000] "GET /bridge/ecus/rrc/uiStatus HTTP/1.1" 200 494 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:08:31 +0000] "GET /bridge/heatingCircuits/hc1/actualSupplyTemperature HTTP/1.1" 200 161 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:08:31 +0000] "GET /bridge/system/appliance/displaycode HTTP/1.1" 200 101 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:01 +0000] "GET /bridge/ecus/rrc/uiStatus HTTP/1.1" 200 494 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:02 +0000] "GET /bridge/heatingCircuits/hc1/actualSupplyTemperature HTTP/1.1" 200 161 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:02 +0000] "GET /bridge/system/appliance/displaycode HTTP/1.1" 200 101 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:32 +0000] "GET /bridge/ecus/rrc/uiStatus HTTP/1.1" 200 494 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:33 +0000] "GET /bridge/heatingCircuits/hc1/actualSupplyTemperature HTTP/1.1" 200 163 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"
127.0.0.1 - - [02/Dec/2018:20:09:33 +0000] "GET /bridge/system/appliance/displaycode HTTP/1.1" 200 101 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/601.36 (KHTML, like Gecko) Chrome/53.0.59193.0 Safari/601.36"

jurgen
Posts: 40
Joined: Friday 02 October 2015 19:09
Target OS: NAS (Synology & others)
Domoticz version: stable
Contact:

Re: Nefit Easy™

Post by jurgen » Saturday 08 December 2018 17:33

Good news JoeneH, it seems like you have running nefit-easy.

I've got this issue also sometimes when i copy paste some scripts to unix, for me it helps to do it using notepad or notepad++.
Regarding your questions:

When you log on to your system you do it als admin but with root you have full access on your synology. I start always my scripts with root, it makes it easy so that permissions will not be an issue. (less secure, i know)

the PID file is created in var/run when the script is started, this is done so that it could not be possible to run it twice.

the nohup question, i don't know.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests