Getting started with Nodered and IFTTT to control heatpump using Sensibo

My home automation has been based on Telldus and heatpumpup control using Sensibo devices. Particularly Sensibo is handy as it integrates with all major heatpumps. Luckily both can be controlled by IFTTT.

Now starting gradually to move to use emonBase for controlling the country house and I find node-red particularly interesting because of its ability to integrate with various platforms. To get node red running with IFTTT i needed to do the following using ssh to emonbase, assuming node-red was already installed:

cd ~/.node-red
npm install node-red-contrib-ifttt
npm install node-red-contrib-simpletime
node-red-restart
refresh the internet browser to see ifttt out under output tag

and to create a experimental workflow which in my case looks like the following:

The IFTTT is a call to a webhook which can be created by:

  1. log in to you ifttt.com account and start by create a applets
    Create applets: if webhooks then sensibo
    Webhooks: receive a web request, e.g. node_red_sensibo_24C
    Sensibo: Turn AC on…set heating with temperrature 24C
  2. Get your webhook settings key from: Get Started - IFTTT
  3. on node red IFTTT out put your webhook key in but leave the eventName empty (its not working)

In my case I used “Create IFTTT webhook events” node red function in the flow to create various IFTTT webhook events based on time and temperature. E.g. to turn of the heatpump for the night etc set temperature using the room temperature. The simple non optimized code for this node-red function looks the following:

var lastmsg = “”;
var msg2 = {payload: “”}
if ((Number(msg.myhour) > 6) && (Number(msg.myhour) < 23)){
if (msg.payload < 21) msg.payload = {eventName: “node_red_sensibo_30C”}
else if (msg.payload >=21 && msg.payload <22) msg.payload = {eventName: “node_red_sensibo_24C”}
else if (msg.payload >=22 && msg.payload <24) msg.payload = {eventName: “node_red_sensibo_22C”}
else if (msg.payload >=24 && msg.payload <25) msg.payload = {eventName: “node_red_sensibo_c25C”}
else if (msg.payload >=25) msg.payload = {eventName: “node_red_sensibo_c24C”}
else msg.payload = {eventName: “node_red_sensibo_22C”}

msg2.payload = {eventName: “node_red_livingroom_off”}
return [msg,msg2]
}
else
{
msg.payload = {eventName: “node_red_sensibo_off”}
msg2.payload = {eventName: “node_red_livingroom_on”}
return [msg,msg2]
}

Just a point - general advice is to not use the emonSD image for anything but emoncms. The root partition is quite small, the data partition is designed to optimise the life of the SD card, log2ram is utilised and generally other tools can be impacted by their use on the same base image.

Thanks, I guess this was the reason the node-red was removed from the image. (I stopped using emonbase some years ago because of getting the corrupted image a couple of times so this was a good reminder.)

@borpin - any advice where to read about at the optimization done to SD image just to learn and assess the potential sd card corruption risk with node-red ?

I think @TrystanLea wrote a post / blog on the experiments done on the RW load. The key problem is the small root partition - it will fill up rapidly.