Page 2 of 37

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 9:43
by kraades
I am not familiar with Node-RED but is it also possible to "exec" bin/easy directly without the intermediate bash scripts?

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 9:44
by jannl
Yes, you only need to set the 3 environment variables.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 9:47
by pepijn
You can also add them as command line parameters.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 9:49
by jannl
Correct. When using a crontab script you will need te set them in the script.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:25
by pepijn
This is how it looks like within Domoticz:
Schermafbeelding 2016-01-03 om 10.24.05.png
Schermafbeelding 2016-01-03 om 10.24.05.png (131.54 KiB) Viewed 4599 times

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:28
by jannl
How often do you refresh?

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:38
by pepijn
jannl wrote:How often do you refresh?
Temperature : 30 seconds
Status Code : 10 seconds
Pressure : 5 min

The setpoint is changed real-time, if some other device changed the setpoint (thermostat, clock program, Easy app) the setpoint in Domoticz will be updated when updating the temperature.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:40
by jannl
That should be sufficient indeed. Gives me something to do next week.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:42
by kraades
Great! I will give a try later this week.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 10:43
by pepijn
Here is my current Node-RED flow, have fun.

Code: Select all

[{"id":"22a46350.4b5c8c","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"willQos":"0","birthQos":"0"},{"id":"8b0bfef4.74f4","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-update","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"x":210.92857360839844,"y":72.4285717010498,"wires":[["b358d0b9.4ca73"]]},{"id":"b358d0b9.4ca73","type":"exec","z":"b83a61b3.47c5a","command":"/opt/nefit/nefit-status","addpay":false,"append":"","useSpawn":"","name":"Nefit Status","x":366.3730163574219,"y":72.09524345397949,"wires":[["6ebefa6b.914104","5ddfad82.a22054"],[],[]]},{"id":"3876c9bf.c78936","type":"debug","z":"b83a61b3.47c5a","name":"","active":true,"console":"true","complete":"true","x":1248.1825561523438,"y":201.17855834960938,"wires":[]},{"id":"1caaaa11.e35556","type":"mqtt in","z":"b83a61b3.47c5a","name":"domoticz/out/#","topic":"domoticz/out/#","broker":"22a46350.4b5c8c","x":195.92855834960938,"y":371.4285717010498,"wires":[["577c156d.a883ec"]]},{"id":"577c156d.a883ec","type":"function","z":"b83a61b3.47c5a","name":"de-jsonify","func":"var payload = JSON.parse(msg.payload);\nreturn payload;","outputs":1,"noerr":0,"x":361.9285583496094,"y":371.4285717010498,"wires":[["342ad05e.cbd53"]]},{"id":"23467d6a.dcb982","type":"debug","z":"b83a61b3.47c5a","name":"","active":true,"console":"false","complete":"true","x":1073.1785583496094,"y":357.1785717010498,"wires":[]},{"id":"50e0c648.af1f38","type":"function","z":"b83a61b3.47c5a","name":"Get SetPoint Value","func":"msg.payload = msg.svalue1\nreturn msg;","outputs":1,"noerr":0,"x":741.1230239868164,"y":370.5118885040283,"wires":[["a97981c8.56868"]]},{"id":"342ad05e.cbd53","type":"switch","z":"b83a61b3.47c5a","name":"filter Setpoint IDX","property":"idx","rules":[{"t":"eq","v":"160"}],"checkall":"true","outputs":1,"x":540.3729858398438,"y":370.9841136932373,"wires":[["50e0c648.af1f38"]]},{"id":"a97981c8.56868","type":"exec","z":"b83a61b3.47c5a","command":"/opt/nefit/nefit-set","addpay":true,"append":"","useSpawn":"","name":"Nefit Set Temp","x":930.9285697937012,"y":370.17857551574707,"wires":[["23467d6a.dcb982"],[],[]]},{"id":"6440aca2.9bbf54","type":"comment","z":"b83a61b3.47c5a","name":"Read changes from Domoticz and send to Easy","info":"","x":296.9285583496094,"y":334.4285717010498,"wires":[]},{"id":"6ebefa6b.914104","type":"function","z":"b83a61b3.47c5a","name":"Domoticz MQTT","func":"// Configuration\nconst IDX_SetPoint = 160;\nconst IDX_RoomTemp = 161;\nconst IDX_Pressure = 162;\nconst IDX_StatusCode = 163;\n\n\nvar domoticz_msg = {};\ndomoticz_msg.topic = \"domoticz/in\";\ndomoticz_msg.payload = {};\n\nif (msg.topic == 'nefit-update')  {\n    var NefitJSON = JSON.parse(msg.payload);\n    domoticz_msg.payload.idx = IDX_RoomTemp;\n    domoticz_msg.payload.nvalue = 0;\n    domoticz_msg.payload.svalue = \"\" + NefitJSON['in house temp'];\n}\nif (msg.topic == 'nefit-pressure')  {\n    var NefitJSON = JSON.parse(msg.payload);\n    domoticz_msg.payload.idx = IDX_Pressure;\n    domoticz_msg.payload.nvalue = 0;\n    domoticz_msg.payload.svalue = \"\" + NefitJSON['pressure'];\n}\nif (msg.topic == 'nefit-setpoint')  {\n    domoticz_msg.payload.idx = IDX_SetPoint;\n    domoticz_msg.payload.nvalue = 0;\n    domoticz_msg.payload.svalue = \"\" + msg.payload;\n}\nif (msg.topic == 'nefit-statuscode')  {\n    domoticz_msg.payload.idx = IDX_StatusCode;\n    domoticz_msg.payload.nvalue = 0;\n    domoticz_msg.payload.svalue = \"\" + msg.payload;\n}\n\nreturn domoticz_msg;","outputs":1,"noerr":0,"x":1028.4285354614258,"y":140.78571891784668,"wires":[["5bc7035e.a438fc","3876c9bf.c78936"]]},{"id":"5bc7035e.a438fc","type":"mqtt out","z":"b83a61b3.47c5a","name":"Domoticz MQTT","topic":"","qos":"","retain":"","broker":"22a46350.4b5c8c","x":1273.1785507202148,"y":142.53571319580078,"wires":[]},{"id":"2f2db332.d0d24c","type":"exec","z":"b83a61b3.47c5a","command":"/opt/nefit/nefit-pressure","addpay":false,"append":"","useSpawn":"","name":"Nefit Easy Pressure","x":393.9285659790039,"y":211.17857551574707,"wires":[["6ebefa6b.914104"],[],[]]},{"id":"baf3b005.450c5","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-pressure","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":208.67857360839844,"y":211.17857551574707,"wires":[["2f2db332.d0d24c"]]},{"id":"2b4dca2.fd4b236","type":"comment","z":"b83a61b3.47c5a","name":"Publish data from Nefit Easy Client to Domoticz","info":"","x":289.9285583496094,"y":24.428571701049805,"wires":[]},{"id":"906bc261.6f944","type":"rbe","z":"b83a61b3.47c5a","name":"","func":"rbe","gap":"","x":794.1428527832031,"y":40.42856979370117,"wires":[["6ebefa6b.914104"]]},{"id":"5ddfad82.a22054","type":"function","z":"b83a61b3.47c5a","name":"Get Setpoint","func":"var NefitJSON = JSON.parse(msg.payload);\nmsg.topic = 'nefit-setpoint';\nmsg.payload = NefitJSON['temp setpoint'];\nreturn msg;","outputs":1,"noerr":0,"x":632,"y":40.571428298950195,"wires":[["906bc261.6f944"]]},{"id":"2296752e.dd698a","type":"inject","z":"b83a61b3.47c5a","name":"","topic":"nefit-statuscode","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"x":200.57141876220703,"y":145.6785717010498,"wires":[["4e5066ef.b1af98"]]},{"id":"4e5066ef.b1af98","type":"exec","z":"b83a61b3.47c5a","command":"/opt/nefit/nefit-code","addpay":false,"append":"","useSpawn":"","name":"Nefit Status Code","x":386.1785659790039,"y":145.92857360839844,"wires":[["8e61f998.719e08"],[],[]]},{"id":"8e61f998.719e08","type":"function","z":"b83a61b3.47c5a","name":"Get Status Code","func":"var NefitJSON = JSON.parse(msg.payload);\nmsg.topic = 'nefit-statuscode';\nmsg.payload = \"\"+\"[ \"+NefitJSON['code']+\" ] \"+NefitJSON['description'];\nreturn msg;","outputs":1,"noerr":0,"x":586.4285888671875,"y":132.92857360839844,"wires":[["8553f832.7aac08"]]},{"id":"8553f832.7aac08","type":"rbe","z":"b83a61b3.47c5a","name":"","func":"rbe","gap":"","x":741.5714111328125,"y":138.14286041259766,"wires":[["6ebefa6b.914104"]]}]

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 18:47
by jannl
I now update the values once a minute, is the easiest frequency with crontab.
One file to update them all.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 19:31
by dorenberg
Maybe somebody can help me.

Want to have the same as pepijn has but I am already stuck with upgrading Node.js to version 5.3.0. With the command sudo cp -R * /usr/local/ I get the following error.


cp: cannot create regular file `/usr/local/bin/node': Text file busy


Cannot delete or change permissions of this file.

Can somebody help me with this?

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 19:46
by pepijn
You need to stop all running node processes (like node red). Please note that nodejs 4 or higher will break the homebridge support

Nefit Easy™ thermostat support

Posted: Sunday 03 January 2016 21:17
by kraades
Robert Klep has developed a client in nodejs that can access the Nefit Easy™ thermostat. It would be great if this can be integrated natively in Domoticz.

https://github.com/robertklep/nefit-easy-client

More info @ viewtopic.php?f=4&t=9653.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 22:35
by geezerrr
Hope someone can make a wiki once there is a stable solution for the Nefit easy. I'm not a programmer but learning by the day!!Image. Unfortunately I'm stuck with the red-node part..
ImageUploadedByTapatalk1451856729.675784.jpg
ImageUploadedByTapatalk1451856729.675784.jpg (195.52 KiB) Viewed 4464 times
I'm getting syntax errors., so for now I give up... Thanx in advance for all the hard work.

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 22:48
by pepijn
geezerrr wrote:Hope someone can make a wiki once there is a stable solution for the Nefit easy. I'm not a programmer but learning by the day!!Image. Unfortunately I'm stuck with the red-node part..
ImageUploadedByTapatalk1451856729.675784.jpg
I'm getting syntax errors., so for now I give up... Thanx in advance for all the hard work.
Can you execute the scripts manualy?

Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 22:58
by geezerrr
The example script was working.. But I need to set my serial;acces-key and code each time I ssh to my Pi 2..

I think I have not enough program skills to solve it myselve

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 22:59
by pepijn
Thats why you need to edit the script and replace the XXXX's

Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 23:07
by geezerrr
Of course I've replaced the XXX's

I think it has to do that i run Dz on the prepared image and the Nefit client is installed in home/Pi/Nefit-easy-client. And not in opt/Nefit/nefit-easy

Re: Nefit Easy™ client library (How to install on the Pi)

Posted: Sunday 03 January 2016 23:10
by pepijn
If you place the scripts in a different location you have to edit the 'EXEC' nodes in Node-RED.
Do you have MQTT enabled on your Domoticz setup?