DRU fireplace control using OH2, NodeRed & Modbus

That is a different ID to the one in your TCP Thing

That’s the error @petermdevries was having, which we did not get to the bottom of. It does mean the target device (Honeywell gateway?) is responding to us - TCP address is correct, hurrah! - but does not like what is being asked to do.
That may be about config or something else - gateway busy, device on other side of gateway missing, asleep, busy.

Modbus stuff doesn’t usually require any kind of “pairing” but there’s no way to know what goes on in the Honeywell black box. It’s not impossible it only accepts queries from friends.

Yes, I’m trying to connect direct from an app (to figure out slave Id etc)
This is correct I think (also according to the docs above) - still gateway issues though

Maybe this can/will help you. Below screenshots of my configuration. I implemented it a couple of weeks ago, so don’t know everything by heart anymore :grimacing:

BRI-DRU-01 is the (host)name of the gateway. First the Modbus TCP slave:

image

Then a/the status poller:

Then I have a couple of things to read/write values:

For example, to get/set the Main Burner:

At some points I created a transform function to read/write correct values. For this item DruActionMainBurner.js

// variable "input" contains command string passed by openHAB
(function(inputData) {
    var TURN_BURNER_OFF = 3;
	var TURN_BURNER_ON = 101;
    var out = 0;
    if (inputData == 'ON') {
         out = TURN_BURNER_ON;
    } else if (inputData == 'OFF') {
         out = TURN_BURNER_OFF;
    } else {
         // No Action
         out = 0;
    }
    return out;
})(input)

And for example the Room Temperature:

with an helper function to convert the value.

// Wrap everything in a function (no global variable pollution)
// variable "input" contains data passed by openhab
(function(inputData) {
    // on read: the polled number as string
    // on write: openHAB command as string
    var DIVIDE_BY = 10;
    return parseFloat(inputData) / DIVIDE_BY;
})(input)

It’s quite a lot to share everything, but perhaps this gives some help.

The only thing I still have (didn’t spent much time yet) are the errors like posted before.
Also noted that sometimes I need to restart the modbus binding for some reason.

1 Like

Wow - that’s an awesome post. Thanks. Im out and about tonight but will feed back as soon as I play. Thanks so much everyone for the help.

Only question… is the mobile app still working and did you have to pair the Openhab server with the bridge somehow, or did this just work straight up?

Between what you’ve said and @rossko57 has helped with… I must be able to sort this now

Thanks again

Do I see you writing individual bits in a register there?
There are other approaches to that - should you need to avoid setting/unsetting other bits in the same register

1 Like

Yes, mobile app is still working. I don’t believe I had to pair the Openhab server with the bridge. I have only paired the bridge with the Dru itself once, but you’ve probably done that already to get the mobile app working.

Guess- thanks so very much fire all the help.
In the end, it seems the problem was that my slave ID is actually 3 (which is not what the documentation says)
I am able to read the fire status now (my primary goal) - so can move onwards.

As a matter of interest, I truly love my DRU fireplace, despite always choosing charcoal / wood when cooking outdoors, but my main chaser here is the lack of fire crackle. I’ll be hiding a small Bluetooth speaker beneath the fireplace and playing the crackling sound manually now :stuck_out_tongue_winking_eye:

1 Like

This is awesome. Great work!
Is there any way to get this in a homebridge plugin? :slight_smile:
Or maybe using the Homebridge-modbus plugin?

What a great work. I’m using Domoticz at the moment (unfortunately) but I’ve used the code to control my fireplace with it as well.

Only one problem occurs when configuring the Wave pattern.

I use the flow as suggested for that:

[{"id":"fb6a7742.8e6508","type":"inject","z":"fb344059.73db6","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1500,"wires":[["6624e634.fec378"]]},{"id":"6624e634.fec378","type":"function","z":"fb344059.73db6","name":"Startup Values","func":"msg.payload = { value:[2569,3340,3854,3342,2572,1801,773,514,1027,2054], \n'fc': 16, \n'unitid': 2, \n'address': 40421, \n'quantity': 10 } \nreturn msg","outputs":1,"noerr":0,"x":420,"y":1500,"wires":[["e24f425c.735fb"]]},{"id":"e24f425c.735fb","type":"modbus-flex-write","z":"fb344059.73db6","name":"test flex write","showStatusActivities":true,"showErrors":true,"server":"e702863e.44b568","x":600,"y":1500,"wires":[[],[]]},{"id":"13b4349f.9fdcdb","type":"comment","z":"fb344059.73db6","name":"Eco Wave COMFORT","info":"","x":280,"y":1460,"wires":[]},{"id":"1f4db27c.1bcafe","type":"function","z":"fb344059.73db6","name":"Startup Values","func":"msg.payload = { value:[1797,2312,2569,2313,1800,1029,259,257,513,1283], \n'fc': 16, \n'unitid': 2, \n'address': 40421, \n'quantity': 10 } \nreturn msg","outputs":1,"noerr":0,"x":420,"y":1600,"wires":[["e24f425c.735fb"]]},{"id":"9d606100.4b5e3","type":"inject","z":"fb344059.73db6","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1600,"wires":[["1f4db27c.1bcafe"]]},{"id":"1cfcc137.ff23df","type":"comment","z":"fb344059.73db6","name":"Eco Wave ECO","info":"","x":260,"y":1560,"wires":[]},{"id":"e702863e.44b568","type":"modbus-client","z":"","name":"DRU","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"172.16.11.51","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":1,"commandDelay":1,"clientTimeout":1000,"reconnectTimeout":2000}]

But nothing happens and reding the debug I get the following message:

msg : error
"Error: Modbus exception 3: Illegal data value (value cannot be written to this register)"

On this page the error is described but I cannot find out what is wrong with the value that I send. Anyone experiencing the same problem?