Modbus issues

Hi,
I’m struggling to integrate some of my modbus connected Heat Pump functions.


For example, I’m able to control the device On/Off function (25).
But the multi-option one doesn’t work (26) (same problem with some other binary switches).
I have used the service> modbus.write_register.

This one is working:

{
  "hub": "hub1", 
  "address": 25,
  "unit": 1,
  "value": 1
}

This one is not:

 {
  "hub": "hub1", 
  "address": 26,
  "unit": 1,
  "value": 2
}

What am I missing?

issue still up!

any ideas? I’m totally stuck.
I’m trying to automate heating based on electricity price, but I’m unable to get some of the modbus switches working.


something seems to be broken on a wider scale.
Now I noticed that one of my functions has state that can’t exist at all:



nor can the mistake be that register is shifted by one as neither registers (144 or 146) has any state that equals 2.

sensor configuration:

    - name: Booster Heater 1 ON/OFF (READ ONLY) 
      hub: hub1
      slave: 1
      register: 145

OK, the last “feature” might of been because I was trying to use node red for troubleshooting and maybe I managed to write over some sensor values in HA directly.

These appear to be status indication (binary sensors) registers…You cannot write to them it seems to me?

Can you post a link to the full manual to this device please?

Regards Steve Wells

Hi Stephen.

here is link to manual: https://manualzz.com/doc/23235255/procon-melcobems-mini–a1m-

I’m using sensors just to double check what HA can read from the device.
For writing registers I started out with modbus switches and later on for troubleshooting with modbus.write_register service.

I’m having FTC5 unit, which rules out the option, that my device just don’t support the features that I require.

That link takes me to a third party download area…can you send the link to the manufacturers download please.

I found this but cannot find the link to the manual at that location.

direct download link from Mitsubishi website:
https://library.mitsubishielectric.co.uk/pdf/download_full/2539

btw: I’m having the Air-to-Water unit

Cheers…got that.

As I suspected you can only write data to:

Coil Digital Output
Read and write accessible register which holds a value of 0 or 1.

and

Holding Register Analogue Output
Read and write accessible register used for status information
which holds a 16-bit value (0-65535)

I agree.
But for some reason I’m unable to write value 2 to holding register no 26 (40027).

It has to be written as a 16-bit value…I am lost to advise how to do that…others here may know?

How are you writing it?

`write_register Write register.
Requires hub, unit, address and value, fields.
value can be either single value or an array

Attribute Description
name Hub name (defaults to ‘default’ when omitted)
unit Slave address (set to 255 you talk to Modbus via TCP)
address Address of the Register (e.g., 138)
value A single value or an array of 16-bit values. Single value will call modbus function code 6. Array will call modbus function code 16. Array might need reverse ordering. E.g., to set 0x0004 you might need to set [4,0]

see here

To write values I use an input_number to supply the value to an automation like:

#sensor.irrigation_start_time

- id: IrrigationStartTime
  alias: Irrigation Start Time
  trigger:
    platform: state
    entity_id: input_number.slider1
  action:
    service: modbus.write_register
    data_template:
      hub: hub3
      unit: 3
      address: 3074
      value: "{{ states.input_number.slider1.state|int }}"

I have tried all those value combinations:
2
“2”
[2,0]
[0,2]

Try the setup I posted above and let me know how that goes?

PS: you need input_number, the sensor and the automation ALL setup to make this work.

Yesterdays “feature” is back again:
one of my sensors shows value that can’t exist:


switch:

    - name: Operating Mode (DHW)[27/40028] (Normal/Eco)
      hub: hub1
      slave: 1
      register: 27
      command_on: 1
      command_off: 0
      #verify_state: true

sensor:

    - name: Operating Mode (DHW)[27/40028] (Normal/Eco)
      hub: hub1
      slave: 1
      register: 27

Thats where you are going wrong…this is a sensor and you cannot write as you would a binary switch I believe…has to be written as a sensor using a similar method as I described above I believe? But others may correct me on that?

As I said above:

Holding Register Analogue Output
Read and write accessible register used for status information
which holds a 16-bit value (0-65535)

PS: You need to rationalise how you name entities (sensors and switches)
All those characters you are using could be causing chaos as well I believe.

Try something like: Op Mode Normal Eco

Which will produce a sensor called: sensor.op_mode_normal_eco

but this is under Holding Register:


And should be writable…

I use the same analogue for System On/Off [25/40026] and it works perfectly.

Ah well I can’t really explain that but thats the way I advise you to try it.

Binary (ie: 0 or 1) for switches and binary sensors.

Analog Sensors (ie: analog value) do as I advised above using an input_number to provide the value (an integer) to be written by the service to the sensor (an analog value) NOT BINARY.

You cannot write a binary value to something that is looking for an analog value.

configuration.yaml

input_number:
  slider1:
    name: Slider
    initial: 0
    min: 0
    max: 7
    step: 1

automations.yaml

- id: HP Mode
  alias: Set HP Mode
  trigger:
    platform: state
    entity_id: input_number.slider1
  action:
    service: modbus.write_register
    data_template:
      hub: hub1
      unit: 1
      address: 26
      value: "{{ states.input_number.slider1.state|int }}"

I have given it some time to change (as I’m not near the pump), but nothing has happened (there is no sensor feedback for value change).