Page 5 of 37

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

Posted: Tuesday 05 January 2016 14:43
by pepijn
In my opinion Node-Red is not a script but IBM's way of connecting IoT. But you are free to build native support into Domoticz :)

The bash scripts in the example above have no error handeling for example they will start multiple times and have high CPU load. That's why creating a real node is a way better solution.

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

Posted: Tuesday 05 January 2016 14:59
by Dutchsea
Pepijn, can you consider a solution with the option to exclude the pressure data.
My CV does not support this date. Obviously i can exclude the pressure sensor i Domoticz.
But in that case the date request is still send to the easy and why ask for data when its not needed.

Thx

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

Posted: Tuesday 05 January 2016 15:01
by pepijn
Just delete the pressure nodes from your node-red flow :)

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

Posted: Tuesday 05 January 2016 15:27
by jannl
According to node-red.org it is build on node.js and propably takes more resources compared to my perl script, which indeed does not have too much error-handling at the time, but wrong values will not be handled, keeping them from getting into Domoticz.

node-red is most likely is some sort of code-generator, which is not bad of-course. Under the hood I suppose node-red also issue an "easy status"

And besides that, I like keeping it in perl.

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

Posted: Tuesday 05 January 2016 15:37
by Dutchsea
pepijn wrote:Just delete the pressure nodes from your node-red flow :)
That I did already. ;) And probably i will also remove the pressure code in Domoticz MQTT

Just saying that i hope your new version will also have option.

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

Posted: Tuesday 05 January 2016 15:43
by pepijn
jannl wrote:According to node-red.org it is build on node.js and propably takes more resources compared to my perl script, which indeed does not have too much error-handling at the time, but wrong values will not be handled, keeping them from getting into Domoticz.

node-red is most likely is some sort of code-generator, which is not bad of-course. Under the hood I suppose node-red also issue an "easy status"

And besides that, I like keeping it in perl.
That's not the way a node red nose works. It's using the library part of the nefit-easy-client directly.
So it will not issue easy status commands.

Just shared my work in progress to others so they can benefit from it.

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

Posted: Tuesday 05 January 2016 15:45
by pepijn
Dutchsea wrote:
pepijn wrote:Just delete the pressure nodes from your node-red flow :)
That I did already. ;) And probably i will also remove the pressure code in Domoticz MQTT

Just saying that i hope your new version will also have option.
It will be a node red object that can be used in your own flows but I will provide a sample flow ;-)

Just curious do you have the pressure option within the Nefit App?

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

Posted: Tuesday 05 January 2016 15:49
by Dutchsea
Dutchsea wrote:
dorenberg wrote:Got some errors too, but upgrade was succesful in the end. Everything seems to work over here. Including my domoticz, plugwise, nefit, and all other stuff.
Nice! I tried the latest code again after my "upgrade" but I still have the " rbe" error in node-red
Overnight my issue fixed itself so now the updated node-red is working and Pepijns code is working including the rbe node.
I receive temp and status in Domoticz!

Some comments in the debug

Code: Select all

5 januari 2016 14:41:38 CET8a346c68.75cb9
domoticz/in : msg : Object
{ "topic": "domoticz/in", "payload": { "idx": 221, "nvalue": 0, "svalue": "18.2" }, "_msgid": "6f292783.90d6d8" }
And

Code: Select all

5 januari 2016 14:41:38 CETDomoticz MQTT
function : (error)
SyntaxError: Unexpected end of input
Is this normal behaviour?

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

Posted: Tuesday 05 January 2016 15:53
by Dutchsea
Next, the set command does not result on a change on the Nefit easy.
I can set e new temperature in Domoticz which show the new temp.
But the thermostat does not show the new value thereafter.

Suggestion on what i can verify are appreciated.

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

Posted: Tuesday 05 January 2016 15:56
by Dutchsea
pepijn wrote:
Dutchsea wrote:
pepijn wrote:Just delete the pressure nodes from your node-red flow :)
That I did already. ;) And probably i will also remove the pressure code in Domoticz MQTT

Just saying that i hope your new version will also have option.
It will be a node red object that can be used in your own flows but I will provide a sample flow ;-)

Just curious do you have the pressure option within the Nefit App?
I dont see it in the app and my CV does not support it. See https://github.com/robertklep/nefit-eas ... t/issues/6
(I have a Nefit Ecomline)

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

Posted: Tuesday 05 January 2016 18:34
by kraades
pepijn wrote:In my opinion Node-Red is not a script but IBM's way of connecting IoT. But you are free to build native support into Domoticz :)
Matbe someone will have some spare time. :)
viewtopic.php?f=31&t=9734
Dutchsea wrote:Next, the set command does not result on a change on the Nefit easy.
I can set e new temperature in Domoticz which show the new temp.
But the thermostat does not show the new value thereafter.

Suggestion on what i can verify are appreciated.
Could this be related to thefollowing issue?
https://github.com/robertklep/nefit-eas ... -168806613
In other words you need the three commands to handle all situations (clock and manual).
At the moment the set temperature uses only two commands.

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

Posted: Tuesday 05 January 2016 19:23
by dorenberg
Well over here it works fine. I have a Bosch HRC II 35 at home. Pressure works and controlling the set point from domoticz results in a change in the thermostat.

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

Posted: Tuesday 05 January 2016 20:03
by Dutchsea
dorenberg wrote:Well over here it works fine. I have a Bosch HRC II 35 at home. Pressure works and controlling the set point from domoticz results in a change in the thermostat.
Is your thermostat in a manual program, clock programmering or other?

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

Posted: Tuesday 05 January 2016 20:23
by rostyk
Dutchsea wrote:Next, the set command does not result on a change on the Nefit easy.
I can set e new temperature in Domoticz which show the new temp.
But the thermostat does not show the new value thereafter.

Suggestion on what i can verify are appreciated.
To set temperature in timer (clock) mode you need 2 parameters.
Currently script works only when thermostat in manual mode, which is reasonable because in timer mode when next scheduled program are coming your set temperature gone.
What i did in mine situation just modify a script a littel bit in: npm\node_modules\nefit-easy-client\lib\commands.js (windows path, also i had some problems with windows interpretation of ' and " in a unix scripts so i did quick and dirty solution with aditional variable)

Code: Select all

  setTemperature(value) {
    var data = { value : Number(value) };
    var over_status = { value : "on" };  //place temperature override in 'clock' mode
    return Promise.all([
      this.put('/heatingCircuits/hc1/temperatureRoomManual',          data),
      this.put('/heatingCircuits/hc1/manualTempOverride/status', over_status), //place temperature override in 'clock' mode
      this.put('/heatingCircuits/hc1/manualTempOverride/temperature', data),
    ]).then(() => {
      return { status : 'ok' };
    });
  }

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

Posted: Tuesday 05 January 2016 21:22
by dorenberg
Dutchsea wrote:
dorenberg wrote:Well over here it works fine. I have a Bosch HRC II 35 at home. Pressure works and controlling the set point from domoticz results in a change in the thermostat.
Is your thermostat in a manual program, clock programmering or other?
It is in the clock programming mode.

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

Posted: Tuesday 05 January 2016 22:39
by Dutchsea
pepijn wrote:True :)

So if you change the script /opt/nefit/nefit-set to

Code: Select all

export NEFIT_SERIAL_NUMBER='XXXX'
export NEFIT_ACCESS_KEY='XXXX'
export NEFIT_PASSWORD='XXXX'

easy put /heatingCircuits/hc1/temperatureRoomManual \'{\"value\":$*}\'
easy put /heatingCircuits/hc1/manualTempOverride/status '{"value":"on"}'
easy put /heatingCircuits/hc1/manualTempOverride/temperature \'{\"value\":$*}\'
You can also change the setpoint when a clock program is used. But note, if the clock program changes the temperature (or you change it on the themostat/ easy app), te setpoint in Domoticz will not be changed.
I understood with the above script the nefit-set command should work with the clock program too.

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

Posted: Wednesday 06 January 2016 2:01
by rostyk
just for info: Nefit Easy = Buderus Logamatic TC100 = Junkers Control CT100 = Bosch Control CT‑100 = Worcester Wave (all part of the Bosch group)

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

Posted: Wednesday 06 January 2016 11:26
by pepijn
pepijn wrote:All,

As mentioned before using the scripts is not the way to go.
Right now I'am working on a (native) Node-RED node for Nefit Easy.
The attachment Nefit Node.png is no longer available
As you can see I'am able to communicate to the Easy directly (so without scripts). But the node is not finished yet.
TESTERS NEEDED

I published the first version of the Node to github.
You can install it using:

Code: Select all

sudo npm install pepijng/node-red-contrib-nefit-easy -g
When installed a new node will be installed in Node-RED
node.png
node.png (1.8 KiB) Viewed 4164 times
From now on you can configure your own flows, don't forget to configure it :)
node-config.png
node-config.png (9.87 KiB) Viewed 4164 times
node-easy-config.png
node-easy-config.png (8.85 KiB) Viewed 4164 times
Sample flow:

Code: Select all

[{"id":"ff25878b.28a9f8","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":"f3fdab6a.9716d","type":"inject","z":"d60d4263.22172","name":"","topic":"nefit-update","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"x":141,"y":148.00000190734863,"wires":[["344cad2f.e89e4a"]]},{"id":"c2dbd85e.feb6","type":"debug","z":"d60d4263.22172","name":"","active":true,"console":"true","complete":"true","x":1255.2539672851562,"y":274.74998664855957,"wires":[]},{"id":"f468c591.d5b0a8","type":"mqtt in","z":"d60d4263.22172","name":"domoticz/out/#","topic":"domoticz/out/#","broker":"ff25878b.28a9f8","x":202.99996948242188,"y":445,"wires":[["4f50f277.195ef4"]]},{"id":"4f50f277.195ef4","type":"function","z":"d60d4263.22172","name":"de-jsonify","func":"var payload = JSON.parse(msg.payload);\nreturn payload;","outputs":1,"noerr":0,"x":368.9999694824219,"y":445,"wires":[["91c9a815.09fae"]]},{"id":"7dec00a4.5473f","type":"debug","z":"d60d4263.22172","name":"","active":true,"console":"false","complete":"true","x":1080.25,"y":438.74998664855957,"wires":[]},{"id":"36479ab6.9ba30e","type":"function","z":"d60d4263.22172","name":"Get SetPoint Value","func":"msg.payload = msg.svalue1\nreturn msg;","outputs":1,"noerr":0,"x":748.1944351196289,"y":444.0833168029785,"wires":[["f6959acc.46eb18"]]},{"id":"91c9a815.09fae","type":"switch","z":"d60d4263.22172","name":"filter Setpoint IDX","property":"idx","rules":[{"t":"eq","v":"160"}],"checkall":"true","outputs":1,"x":547.4443969726562,"y":444.5555419921875,"wires":[["36479ab6.9ba30e"]]},{"id":"736e147f.478be4","type":"comment","z":"d60d4263.22172","name":"Read changes from Domoticz and send to Easy","info":"","x":303.9999694824219,"y":408,"wires":[]},{"id":"86d83761.b74138","type":"function","z":"d60d4263.22172","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":1035.4999465942383,"y":214.35714721679688,"wires":[["78e7ad56.9981fc","c2dbd85e.feb6"]]},{"id":"78e7ad56.9981fc","type":"mqtt out","z":"d60d4263.22172","name":"Domoticz MQTT","topic":"","qos":"","retain":"","broker":"ff25878b.28a9f8","x":1280.2499618530273,"y":216.10714149475098,"wires":[]},{"id":"86f7256b.4702","type":"inject","z":"d60d4263.22172","name":"","topic":"nefit-pressure","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"x":154.75,"y":316.7500171661377,"wires":[["e00efb82.b052e8"]]},{"id":"89bae4a3.1d509","type":"comment","z":"d60d4263.22172","name":"Publish data from Nefit Easy Client to Domoticz","info":"","x":296.9999694824219,"y":98,"wires":[]},{"id":"538a564.a08a428","type":"rbe","z":"d60d4263.22172","name":"","func":"rbe","gap":"","x":801.2142639160156,"y":113.99999809265137,"wires":[["86d83761.b74138"]]},{"id":"ffed6cb1.d18d58","type":"function","z":"d60d4263.22172","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":668.0714111328125,"y":130.14285469055176,"wires":[["538a564.a08a428"]]},{"id":"40f53ce3.b10fbc","type":"inject","z":"d60d4263.22172","name":"","topic":"nefit-statuscode","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"x":114.642822265625,"y":230.25000190734863,"wires":[["d9c31f75.e6cf1"]]},{"id":"58e78dae.bc17b4","type":"function","z":"d60d4263.22172","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":623.5,"y":220.50000190734863,"wires":[["fde852ee.6a0248"]]},{"id":"fde852ee.6a0248","type":"rbe","z":"d60d4263.22172","name":"","func":"rbe","gap":"","x":802.642822265625,"y":231.71428108215332,"wires":[["86d83761.b74138"]]},{"id":"344cad2f.e89e4a","type":"nefit-easy","z":"d60d4263.22172","easy":"","name":"","topic":"nefit-update","command":"status","x":279.0714111328125,"y":147.5714282989502,"wires":[["d543561c.93741","138477f1.3e55a8"]]},{"id":"d9c31f75.e6cf1","type":"nefit-easy","z":"d60d4263.22172","easy":"","name":"","topic":"nefit-statuscode","command":"display-code","x":298.0714111328125,"y":260.5714282989502,"wires":[["e460913f.e3e5f8"]]},{"id":"e00efb82.b052e8","type":"nefit-easy","z":"d60d4263.22172","easy":"","name":"","topic":"nefit-pressure","command":"pressure","x":358.0714111328125,"y":325.5714282989502,"wires":[["1e345af1.a80ca5"]]},{"id":"f6959acc.46eb18","type":"nefit-easy","z":"d60d4263.22172","easy":"","name":"","topic":"nefit-set","command":"set-temperature","x":938.0714111328125,"y":436.5714282989502,"wires":[["7dec00a4.5473f"]]},{"id":"e460913f.e3e5f8","type":"json","z":"d60d4263.22172","name":"","x":459.0714111328125,"y":217.5714282989502,"wires":[["58e78dae.bc17b4"]]},{"id":"d543561c.93741","type":"json","z":"d60d4263.22172","name":"","x":534.0714111328125,"y":125.5714282989502,"wires":[["ffed6cb1.d18d58"]]},{"id":"138477f1.3e55a8","type":"json","z":"d60d4263.22172","name":"","x":453.0714111328125,"y":175.5714282989502,"wires":[["86d83761.b74138"]]},{"id":"1e345af1.a80ca5","type":"json","z":"d60d4263.22172","name":"","x":580.0714111328125,"y":305.5714282989502,"wires":[["86d83761.b74138"]]}]
You don't need any of the scripts mentioned earlier in this post! This is a native Node-RED node

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

Posted: Wednesday 06 January 2016 13:21
by rostyk
Works good.
Robert today implementing some code changes regarding set temperature (to be able to work with clock mode as well) and introduce a server mode whcih also look reasonable because now for every command you use authentication every cycle which is not so good from server (bosch) side.
We should work like iOs/Android app: open connection -> authenticate > execute commands -> execute next command ... repeat.

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

Posted: Wednesday 06 January 2016 13:32
by rostyk
i know it still not finished but i missing get and put commands in node.
For example i want to read /heatingCircuits/hc1/actualSupplyTemperature
its not possible to do up to now from node-red interface