A small step for Hubitat, a big step for me (modbus integration)

You're making great progress! Eager to hear how you move along towards changing addresses (relays)!

Scott

It's late now (even later for Kevin the developper), but success is there !

I managed to set a dashboard tile (switch) that send the right data to MQTT/Node-red/Modbus and acitvate/deactivate a relay.

The system is [almost] bi-directional. When you activate/deactivate the relay directly through node-red, HE knows its state. Next step: if the relay is (de)activated locally on the modbus device itself (button, triggers, timers or some programming), I need to add a poll function to regularly update its status into HE.

But the hard work was made by @kevin with his MQTT alpha5 app that works Zzzzuper !

Can go sleep now :wink:

1 Like

Do you have to poll modbus for state :frowning: is no state change event sent on the bus for local change or are only commands sent ?

If the state in NodeRED can be maintained real-time by that node you’re using then you can just push that to MQTT on change and then HE will be in synch real-time too.

For now, I poll modbus addresses every 10 seconds (testing here).

My modbus devices are normally autonomous: I program them to run tasks, depending on rules and triggers (my plc has relays but also analog and digital inputs/outputs). PLC's are very reliable (industrial use: $$) and I trust them more than any hub. And I have a full network of ds18b20 wired temperature sensors: easier to put anywhere (including soil, water or deeply hidden into machines). And they have built-in smtp management (alarms, reports, etc).

The MQTT-Modbus link is made to harvest non-critical data (like temperatures, electric metering, liquids pressure and flow) and display them into HE. In certain cases (by example a specific task should be made manually), the link will avoid that I reach my plc for doing it.
To summarize my needs: Lazyness and willing to obtain a better interface (through HE)
Here are screen captures of summary made with my PLC (IE only - ActiveX)...

And today I received a new modbus battery monitor that will be hooked into HE... to display the status of my battery bank.

Found this device for Modbus 485 and ModbusTCP to MQTT. https://www.automationdirect.com/adc/overview/catalog/communications/industrial_iot_solutions/mqtt_gateways
Have yet to order one to see if this helps (approx US$200) for simplifying the setup of Modbus to MQTT and into HE. I don't know if its bidirectional

should be nice if you don't have a pc/raspberry to host nodered.
Another hardware I tested recently without flaws is activate nodered on a TrueNas system.

I rebuilt an old pc (45W power - dismantled everything), installed TrueNas with 4 HDD (to use as a storage NAS, backup and... nodered).

On that NodeRed, I activated several contribs: Hubitat, rs485-serial and modbus TCP/IP) and all is working as expected.

But your little device seems nice too ! If you buy it, send me more info about it.

from the site:

Both Modbus RTU <-> MQTT and Modbus TCP <-> MQTT are supported

So, we can expect that device is bidirectionnal.

Update: https://cdn.automationdirect.com/static/manuals/mqttgateway/sgwmq1611userm.pdf

not obvious to me that writing values into modbus registers is allowed

It allows bidirectional communication between Modbus field equipment and an MQTT broker. It provides a Modbus RTU master interface on RS-485 and Modbus TCP over Ethernet. Variables can be read from Modbus slave devices on change or at fixed time intervals and are sent to the MQTT broker with optional SSL/TLS client certificate authentication

read from modbus. the communication is bidirectionnal but you can't send data to modify modbus addresses. That's what I understand

On page
2-7,2-8 of the manual it has this section .

Configure Modbus Variables
Add each variable to be read from or written to the Modbus device by clicking the β€œ+” icon.
So looks like you can.

I have used the Stride brand switches and they are good. Just have to justify to the W spending more on HA. :yum:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.