Modbus challenge

I’m trying to tie a modbus PLC into HA for monitoring inside a brewery. We’re using a Solo SL-4848. I need to be able to reset the SV (set point) if needed. According the the docs, the SV register decimal address is 44098.

But the modbus service appear to only accept 0-255) for the address. I admit I’m a complete modbus n00b.
image
Here’s tje base config. My testing is with the Dev tools at this point.

  - name: hub3
    type: serial
    baudrate: 9600
    bytesize: 7
    method: ascii
    parity: E
    port: /dev/ttyUSB3
    stopbits: 1

address is 4098

1 Like

That’s an error in modbus’ services.yaml. You should probably raise an issue on github.

You should still be able to enter higher number though.

Or 4097?

1 Like

00 hex, 0 decimal = modbus decimal 1

1 Like

Thanks for the leads. I’ll test them tonight. Not sure what your last post means.

I can confirm that dropping the leading 4 was all that was needed to write to this register. I’m also seeing that I must send a decimal value (21.0 vs 21) to get the right setting. Specifying 21 gets me 2.1 in the register.
Thanks again @nikito7

1 Like

I have a follow-on question. How do I use the modbus configuration to receive alarms from the controller? The docs say

"ALA1 and ALA2 are both SPST normally open relay 
outputs."

That leads me to believe I’ll need to connect something to these terminals that can generate something HA can read in the event of an alarm. Any idea what to use? Maybe an ESPhome device that will detect contact closure?

That terminals should turn on/off a cooler/heater

Status should be a modbus sensor register

Edit:

Bit registers at manual

Binary_sensors in HA

https://www.home-assistant.io/integrations/modbus/#configuring-platform-binary-sensor

1 Like

Thanks, again. I’m not sure there is an address for the alarm, but I’ll dig into the docs.

Hi, friends - this project is coming along. Or more to the point, my understanding of modbus and how to interface with HA is coming along!

My current issue is that the value in the registers I’m reading are temps in ℃ with .1 precision. However, if I have to them with a data_type of int16. If I read with a type of float, they report back as 32.0F (the system is converting the C to F. ) Update: Reading as a float16 with no unit_of_meas give a value of 0.0

When I read as int16, 22.5 is returned as 225.
I guess I can approach this with a template.

Any thoughts on what might be happening?

Here is my current config

- name: hub4
    type: serial
    baudrate: 9600
    bytesize: 7
    method: ascii
    parity: E
    port: /dev/ttyUSB0
    stopbits: 1
    sensors:
    # Ideas: Monitor PV for history & alerts
      - name: "PresentValue"
        unit_of_measurement: °C
        slave: 1
        address: 4097
        scan_interval: 10
        data_type: int16
        precision: 1
        device_class: temperature
        input_type: holding

FWIW, here is the description information on this register:

The display of the devices shows valid values for the PresentValue with the probe I have attached so there shouldn’t be an error code in the register.
As always - thanks for reading.

And one more thing I verified - as @nikito7 say proposed - besides dropping the leading “4” I do indeed need to subtract one from the remaining “4097” to get the correct register.

  scale: 0.1
1 Like

Worked like charm. I added precision: 1 to get the decimal and now I have good temp readings
image

I think I’m down to one problem. Reading the alarm value. The value is a bit-mapped value reported as a int.
image

I need to read bit 4. I suspect this is a problem for advanced templating. But I’ve not yet figured it out. I’m looking at the pack filters.

Use registers below in table.

Bit is very complex…

Sorry, which table are you referring to?

Your manual

1 Like

Well. that’s embarrassing.

I did, in fact, try this in my marathon session yesterday. I’m not getting good results from the bit register. Well, they aren’t telling me what I expect them to tell me.
Still workng it

I’m back at this. I have a binary sensor defined for the bit register for Alarm 1 LED

modbus:
#<snip>
    binary_sensors:
    # Monitor alarm status
      - name: "modbus_Alm"
        slave: 1
        scan_interval: 10
        address: 2052  # 2063 -1
        device_class: problem
        input_type: discrete_input

It always reports OK.
This appears to be working. Is the problem device class appropriate for this?

I put together a gist to document # Modbus Temp controller with Home Assistant (github.com) all of this.

Shout out to @nikito7 for the big assist

1 Like