Connecting devices from Sprut.hub to Wirenboard

Good time. The writing of this article was prompted by the situation that the seemingly elementary task of getting data from the installed Sprut.hub module to the parent WirenBoard caused certain difficulties. The search finds scattered information. The question came up more than once in chats. While it’s still fresh in my memory how it’s done, so that I don’t have to remember it later, I described step by step what, where and how.

Initial data:

  1. Controller WirenBoard 7. Software version at the time of writing wb-2401.

  2. Installed expansion module Sprut.stick ZigBee

  3. Thermostat c or with Zigbee interface.

  4. The controller is configured, Sprut is configured, the thermostat is connected and controlled to Sprut.

Task: organize heating control in a country house using an external thermostat.


First of all, you need to go to Sprut.hub in the “Bridges” section http://ip_of_your_controller/bridges create a new Bridge. For this:

  • Click the plus sign in the upper right corner and select “Create a bridge”

  • in the window that opens, select Bridge Type – “MQTT”,

  • indicate the desired name, for example “MQTTSPRUT”.

After adding, this bridge appears on the left side of the list.

  • open the settings of the newly created bridge (three dots),

  • edit (if necessary) the address and port (I left it as is),

  • on the “Expert” tab, edit the Prefix (if necessary).

That's it, the bridge is ready, devices are added to it automatically (if not disabled in the paragraph above).


We check that the required device publishes information. I use MQTT Explorer, a very convenient, free application. For this:

  • launch MQTT Explorer,

  • create a new connection to your server (specify the IP address, port, login/password (if installed).

If everything is done correctly, we will see the server and a drop-down list

We expand the drop-down list and look in it for the device we need and the necessary parameters. This is what it looks like for me.

When you select the desired parameter, the program on the right side shows a link to the topic of this parameter, which will be useful to us in the WirenBoard rules.


Let's go to the controller itself and create a new rule.

I always try, whenever possible, to assign devices and links to topics to variables, so that if a device is replaced, it is enough to correct it once in a variable, and not touch the code itself.

We declare two variables:

  • TargetTemperatura – the target temperature of our virtual thermostat, with which we will already work when controlling heating,

  • MQTT_TargetTemperatura is a link to a topic with the desired parameter of a physical thermostat, which is connected to Sprut.hub. Take the link from MQTT Explorer.

var TargetTemperatura = «01_virtual_termostat/TemperaturaPolRoom»;
var MQTT_TargetTemperatura = «Sprut.hub/accessories/35/13/18»;

– set the description of the virtual thermostat:

var Termostat = {
 TemperaturaTarget: {
 title: «Целевая температура»,
 type: «range»,
 order: 0,
 value: 22,
 max: 35,
 min: 10
  • create a survey that receives data from a physical thermostat, reads its topic and writes the resulting values ​​to the virtual thermostat:

trackMqtt(MQTT_TargetTemperatura, function(message){
 dev[«01_VirtualTermostat/TemperaturaTarget»] = parseInt(message.value);
defineVirtualDevice('01_VirtualTermostat', {
 title: 'Управление отоплением',
 cells: Termostat,

Let's keep the rule. Go to the Devices page in WirenBoard. If everything is done correctly, then a new “Heating Control” device should appear there with the “Target Temperature” parameter. When the target temperature changes on the physical thermostat, it changes in the virtual one.

If data transfer is required (when the target temperature of the virtual thermostat changes), you need to add a procedure:

defineRule(»Целевая температура», {
 whenChanged: «01_virtual_termostat/TemperaturaTarget»,
 then: function (newValue) {
 dev[MQTT_TargetTemperatura] = dev[«11_VirtualTermostat/TemperaturaTarget»];

But it doesn't work with my thermostat. I haven't figured out what's going on yet. Either the thermostat itself (unlikely), or did something wrong.

That's all. Thank you.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *