question

kea avatar image
kea asked

How to control humidity using Ruuvitag, inverter and dehumidifier?

I just start playing with Cerbo GX and installed large image to be able to use Node-Red and Signal K.

I have the following devices installed in my boat:

  • Victron Cerbo GX
  • Victron BMV-700 battery monitor
  • Victron Phoenix Inverter
  • Victron SmartSolar
  • RuuviTag with humidity and temperature sensor
  • Dehumidifer (AC) connected to the inverter

What do I want to do:

  1. Read temperature, humidity and batterypercent (SOC)
  2. Make logic evaluating the values
  3. Control the inverter to reduce humidity


Question:

  • I assume this needs to be done in node-red?
  • Could anyone make a quick describtion how I can do this in node-red? If I get the basic instructions I guess I could figure out the rest myself. I am new to node-red and Cerbo.
  • Any thoughs about what conditions I should use to keep humidity low? I want to prevent moisture from remaining in the boat over time.
  • I need to keep standby power as low as possible. How much power do the inverter pull in standby mode? Perhaps I can reduse the standby power by using hard wired remote start instead of controlling inverter over ve-direct? What do you think?

cerbo gxBMV Battery MonitorMPPT SmartSolarPhoenix Inverterruuvi sensors
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
matt1309 avatar image
matt1309 answered ·

Hi @KEA


1. Yes

2. First get all variables into node red. This process will depend on how new a venus version you're running. The new version you can read the data straight from global. This is explained here:

Node-RED - update for Victron users - Victron Energy


If however you're using old version you'll need to have inidividual flows for each piece of data ie temp, battery data etc then use change node to set the topic of each one is msg.topic = temp

msg.topic = batterVoltage


Then pass that all into the function where you write the logic. Something like:


Older venus os:


//setting up variables 

var soc = global.get('soc');
var hum= global.get('hum')


//If data input has topic soc then write that to variable and update global variable.
if (msg.topic === "soc") {
  soc = msg.payload; // Extract payload from input 1
  global.set('soc',soc);


//setting soc variable depending on inputs from flows
if (msg.topic === "hum") {
  hum = msg.payload; // Extract payload from input 1
  global.set('hum',hum);
  


Newer version the variables are already written to global context so you dont need this bit of code. You can just get vars from global.get


Then below this you write your logic ie:


if( soc > 50 && hum > 80 ){ //random values
//code to turn on dehumidifier for example:
return 1; 


}else if ( hum < 75){
//code to turn off dehumidifier for example:
return 0
}


I would pass the output of the function into whatever node is controlling dehumidifier (either a relay or maybe a http node that controls a shelly smart switch if the dehumidifier isnt close by)



3. Not my area of expertise im afraid so cant help on this question.

4. Again not something I'm too familiar with sorry.


Happy to help more on node red bits if needed.



2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

kea avatar image
kea answered ·

Thank you very much for your input!

As a newbie I had spend some hours installing the large image (latest beta), activated node red and just sart playing with the node red.
My device do not have internet connection so I can only play with this when I am at the boat.

This far I have tested adding read and write to Victron. In example reading Battery SoC, cabin temperature and humidity. I have also played with the output function controlling the Victron relay. Next step will be how to add the logic to collect the variables, calculate dew point and make a logic for the relay to start my dehumidifier when needed.

Do you mind showing me how the logic will show on the node red user interface? What type of "block" do I use when I want to do the calculation and eveluation when to start and stop my humidifier?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

matt1309 avatar image matt1309 commented ·

Hi @KEA


I would use a function node "block" as you say. The issue is getting multiple bits of data in at once (each block outputs a piece of data in the variable msg with the useful far of msg being in the payload attribute so you'd access that like the msg.payload).


However if you have multiple blocks going into the function node, then the function doesnt know how to tell the difference between the nodes. The easiest way to fix this is to set a msg.topic attribute. then the code can know which input node has sent it data. You can set msg.topic using a change node. so it would go data -> change node -> function


Like this:

Where the inside of change node looks like this:

Then in function node you set the variables like this:

var temp = global.get('temp');
var humidity= global.get('humidity');

 
//setting soc variable depending on inputs from flows
if (msg.topic === "temp ") {
  temp = msg.payload; // Extract payload from input 1
  global.set('temp', temp );
}
 
if (msg.topic === "humidity") {
  humidity= msg.payload; // Extract payload from input 2
  global.set('humidity', humidity);
}
 





If you're using a new version of venus of you can skip th steps above victron now stores data into the global context now. So you can access it directly in function node using something like this:

var temp = gobal.get("victronenergy.temperature._25.temperature")


You can see more details on that here: (under the global context heading)

Node-RED - update for Victron users - Victron Energy


Once you've got the variables setup for all the input data then it's just javascript to write whatever calcs/logic you want.


Then to output temperature from function block for example you'd do:


msg.payload = temp;
return msg;


You wont have access to victron data but for debugging the javascript elements you could install node red on a computer at home. Get it all working with some dummy data and then import when you're on site. If you're itching to mess with it that is


0 Likes 0 ·