This might take a while, depending on your level of knowledge, but this is a successful way to setup once and configure as many times as needed.
I have a Victron (for the most part) solar system setup, that I wanted to automate to have a simple “plug in and and simply configure later” by adding Sonoff devices and other eWeLink compatible devices.
This will allow you to setup initial data transmission from your Victron system and later configure as many devices as you would like and perform automations from eWeLink directly.
I will not focus on how to configure devices, as they all have standard config, same you will find on all Sonoff/eWeLink/Victron documentation or internet tutorials. Only mandatory step is to have STATIC IP ADDRESS for all your devices (GX, iHost and NSPanel Pro)
Requirements:
- Victron GX device with Node-RED (can be Cerbo on RaspberryPI) - might also work the same way with other devices, logic should be the same
- iHost with Node-Red
- (optional) NSPanel Pro (to act a matter hub for later automation with Virtual Devices)
Step 1 - Basic iHost Configuration
Upgrade to latest version, have static IP on device or setup dhcp binding on your router;
In Docker install Node RED and eWELink Smart Home (ignore homebridge in below screenshot, not part of this);
Configure your eWeLink with your account so that your devices are visible in eWeLink Cube;
In node-red, make sure to have these nodes installed (you can have others, these are needed for this setup) - node red, aedes, ewelink cube and victron:
NOTE: you can probably use any/other MQTT brokers, but this is what I use
Configure Aedes MQTT broker ON IHOST

Step 2 - Configure Victron Node Red and establish communication
Open Node-RED on GX device and if not available, install Victron node and Aedes MQTT (might work without Aedes to have mqtt-out function)
Select which data you would like to export to iHost -
I chose total power produced and battery SoC (note i am using a Fronius inverter instead of MPPTs, but it should work the same) and created a flow to expose them to mqtt
You can expose basically anything you want here, it’s quite easy and the process is repeatable - just add more devices and connect them to mqtt. Only thing i struggled here is to have a unified way (one mqtt out), but it didn’t work out great for me so I just went with this. Also keep in mind to configure TOPIC as you will need to receive this on the other end - here named “pw”
Step 3 - Configure iHost to take advantage of data
Initial setup - have event-state and get-devices from eWeLink Cube node

This will bring all your devices from eWelink to node-red to be later accessed and referenced to.
Next, setup “virtual devices” from node-red to ewelink cube (note - they will only be visible in ihost/ewelink cube, not in ewelink app! this will be done later with nspanel pro)
**Here is the challenging part! (**I have not found a better way to do this, if someone else has one, please let me know and I will update this)
Ewelink was not designed for this so does not know what solar production is and how to use it as trigger. You CAN use it directly from node-red with control-device function, but it will NOT allow you to manually change state from ewelink app later, so you are stuck with what ever you configure in node-red.
I am using temperature (as it will allow any scale/number) to represent power production (1w = 1 degree) and humidity for state of charge (0-100%), this in turn allows me to further create automations (scenes) directly from ewelink app!
Also, I have 0 coding skills, so I am jerry-rigging as much as I can without understanding much of the code. Although i read the instructions, they were not clear to me, for sure there are better way of doing this (probably JS scripting directly) but this is aimed to be truly NO-CODE setup apart form this initial configuration.
Even after reading documentation on the ewelink cube API, it’s still not clear what exactly is the relation between node-red integration of payload messages between function, put-device and register device.
Register device - basically creates a virtual device in ewelink cube, based on what you setup here, it will expect certain payload message (this is the biggest gray area for me), so I use as Temperature and humidity sensor (as this will later allow you create scene trigger from) and for Capabilities i use temperature for power and humidity for state of charge (i was not able to combine them, so I use 2 separate devices)
Device should appear in ewelink cube, but without data, you will need to add that timestamp trigger and deploy and also search on how to get token.
Next, we need to send data -
Here is the whole flow:

First, we are using MQTT in to receive the data from Victron, then I use a delay function to send messages 1/minute so I don’t overwhelm the devices/network (this is optional and you can add later).
Then a function is used to transform the message from MQTT from number into string of data that also says it is “temperature” so later functions know what the message represents :
Code to copy for stringify function:
================================
const jsonObject = {
temperature: msg.payload
};
msg.payload = JSON.stringify(jsonObject);
return msg;
================================
Next step to transform the string into a JSON, which is the accepted format in which the data should be presented to a put-device function -
This functions does a few other thins also - it checks if the incoming message is a string, it round the numbers - not so important for temperature/power as they are all integers, but if you do with state of charge it will give a lot of decimal places)
And code to copy:
=========================================
let value;
// Parse input
if (typeof msg.payload === “string”) {
try {
let data = JSON.parse(msg.payload);
value = data.temperature ?? data;
} catch {
value = Number(msg.payload);
}
} else if (typeof msg.payload === “object”) {
value = msg.payload.temperature;
} else {
value = Number(msg.payload);
}
// Ensure valid number
value = Math.round(Number(value));
// Correct iHost format
msg.payload = {
temperature: {
temperature: value
}
};
return msg;
====================================
Some of the code comes from GPT, some from this forum.. this is what I found working. For sure there is a MUCH simpler way to do it…
End result:
For SoC - sate of charge to humidity, you should change the following:
- when exposing data from GX node-red, use another mqtt out and set topic to “soc” for example, do the same on iHost node-red for MQTT it (both should have same topic name, does not matter what name is as long as they are identical)
-
in stringify and parsing function change in the code humidity instead of temperature
-
in register device, select device setup with Humidity and in Put-device state select Humidity in capabilities
-
Basically same as initial flow, however when you see temperature, use humidity.
Last step is to add your NSPanel to iHost via matter bridge. For this you must have you iHost, NS Panel and phone connected to same network. Have iHost connected to ewelink account (you should have already done this in the first steps), have NS Panel pro connected to your ewelink account, then just follow this tutorial - https://www.youtube.com/watch?v=CwgnMTcWVaE
YOU ARE DONE!
Now you can create Scenes directly from eWeLink app based on Power production and/or state of charge.
Here is a simple example where I tell my boiler to turn on when Solar power is enough and batteries are charged over 50%
From here on, no more coding required. Just simple logic built in Sonoff and eWeLink.



















