I have diesel generator with LOVATO RGK 800 controller.
It use custom function 0x07 to read exception from it.
So, is it possible to add custom function support to the modbus integration?
I have diesel generator with LOVATO RGK 800 controller.
It use custom function 0x07 to read exception from it.
So, is it possible to add custom function support to the modbus integration?
At the moment this is not possible, but not a bad idea for a feature request.
I suggest you create an issue, mark it as feature request, and include the text in your message.
It is impossible to create issue with feature request, so, what I need to do?
@janiversen
I will try to add such functionality by myself and I will create PR. Where to create it? To main HA core repo, or to your clone?
Well seems I was not exact. I meant add an issue with title e.g. missing functionality for custom entity and then in the text add “feature request”.
You are welcome to try for yourself, simply use dev branch on core repo, all PR´s needs to be based on that.
But be aware of 2 things:
a) the modbus integration is about to change a lot due to the open errors
b) your change is something that goes through the whole integration (adding an entity, updating class modbushub and check for the functionality in pymodbus), so it is not an easy task.
But we welcome new PR´s.
I have created issue, https://github.com/home-assistant/core/issues/34202, but it was closed.
So, only one place to discuss feature requests is here
I too would like to the change the function code used for help with integration with other Modbus devices.
@Hacker-CB did you get anywhere with this?
Thanks @janiversen for your replay on GitHub thought it would be better to move to forum if its ok?
As per @Hacker-CB request I would like to be able to change the function code part of the requests to better intergrade with the Solis inverter.
Below is an extract from the manufactures modbus manual
I am able to read the registers in range 30001-39999 fine as the default function code for reading is 4 and matches with the manufactures setup. e.g. 0x1 0x4 0x81 0xbe 0x0 0x1 0x79 0xd2
However I cant read the holding registers ranged 40001-49999 as they require a function code of 3, as far as I understand reading the manual.
I am also having issue writing to 40001-49999 but I think that’s a device issue.
Been battling this a wile and would love some insight/help!
Thanks,
Richard.
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!