For those that follow its possible to change the function code used by selecting the register type when calling a registry e.g.
When calling a registry its possible to specify the register_type as below.
- name: Solis Time Chargeing Charge Current #U16
hub: Hub1
unit_of_measurement: A
register: 43141
register_type: holding
count: 1
slave: 1
precision: 1
data_type: float
scale: 0.1
The above will generate a Modbus command like ‘0x1 0x3 0xa8 0x85 0x0 0x1 0xb5 0x83’ with the function code of decimal 3 or hex ‘0x3’. The default is also 3 if you exclude register_type from your script.
If you change the register_type from ‘holding’ to ‘Input’, as in the example below.
- name: solismeteractivepowera #U16
hub: Hub1
unit_of_measurement: W
register: 33257
register_type: input
count: 1
slave: 1
precision: 1
data_type: float
scale: 0.001
it will generate a modbus command like ‘0x1 0x4 0x81 0xe9 0x0 0x1 0xc8 0x2’ with the function code of decimal 4 or hex ‘0x4’.
Hope that helps someone else as it got me for a wile! 