Jiran
(Jiran)
May 17, 2023, 8:56pm
61
This is an example of query from tecnical manual:
Single machine use, communication ID is set to 1, EMS communicates directly with
RBMS
Query operational status 00 00 00 00 00 06 01 03 11 00 00 2D(HEX)
Here is URL for this document: PDF Host - Edit
Could you please point me how should look HA modbus.yaml in this case?
nikito7
(nikito7)
May 18, 2023, 12:46am
62
0x1000 Total Voltage
0x1000 hex = 4096 decimal
- name: "Total Voltage" # 0x1000
slave: 1
address: 4096
input_type: holding
count: 1
data_type: uint16
precision: 1
scale: 0.1
unit_of_measurement: V
device_class: voltage
nikito7
(nikito7)
May 18, 2023, 12:49am
63
01 - slave
03 - function
11 00 - register
00 2D - count
Jiran
(Jiran)
May 18, 2023, 7:23am
64
Thank you very much @nikito7 will try it. Please is there some way how to have 2 modbus devices against single instance of HA? I have two devices, both communicating using Modbus TCP.
I found this: Ability to add multiple modbus hubs - #45 by wellsy
Now my modbus.yaml looks like this:
- name: "Nibe"
type: tcp
host: 192.168.1.102
port: 502
- name: "BMS"
type: tcp
host: 192.168.1.20
port: 502
sensors:
# Overview
- name: "Heatpump - Power Usage"
unique_id: "power_usage"
unit_of_measurement: "W"
data_type: int16
device_class: power
address: 2166
input_type: input
scale: 1
precision: 0
slave: 1
hub: Nibe
- name: "Heatpump - Priority"
unique_id: "operating_prioritisation"
data_type: int16 # int8
# 10: Off, 20: Hot Water, 30: Heat, 40: Pool, 60: Cooling
address: 1028
input_type: input # R/W
scale: 1
precision: 0
state_class: measurement
slave: 1
hub: Nibe
but there is an error preventing me to restart HASS: Invalid config for [modbus]: [hub] is an invalid option for [modbus]. Check: modbus->modbus->1->sensors->0->hub.
Any idea? I tried to set it as in this post: Ability to add multiple modbus hubs - #49 by cconnoruk
uSlackr
(Greg Martin)
May 18, 2023, 1:07pm
65
You can absolutely have two devices. They can be chained together and identified by different slave/unit IDs. Or you can have two modbus hubs with separate names (I’ve not done it with tcp though).
FWIW, I do not use quotes around the Name in my config.
Jiran
(Jiran)
May 18, 2023, 2:06pm
66
identified by different slave/unit IDs
Can you please show me an example?
Jiran
(Jiran)
May 18, 2023, 8:16pm
67
Now I have this error: Pymodbus: BMS: Exception Response(131, 3, IllegalAddress)
By using only this modbus.yaml:
- name: BMS
type: tcp
host: 192.168.1.20
port: 502 #your port number
sensors:
- name: "SOC" # 0x1000
slave: 1
address: 4102
input_type: holding
count: 1
data_type: uint16
precision: 1
scale: 0.1
This should show SOC of a battery so the result is in %…But Im not sure if this is the source of the error (not properly configured).
Jiran
(Jiran)
May 22, 2023, 6:55am
69
I communicate from PC to BMS: So I am not sure what is the proper answer to your question. What I can say is that communication between PC and BMS looks like this:
\par Receive Data: 192.168.1.20 Time: 2023-05-22 08:48:42 Address :2012 Pak:11 Length 22
\par 0000000000050103020000
\par 192.168.1.20 TCPIP SEND :00000000000601030100005B
\par Receive Data: 192.168.1.20 Time: 2023-05-22 08:48:42 Address :0100 Pak:191 Length 382
\par 0000000000B90103B609120011AAAA000F00000111FFE4002900640019000100010018000200020E32000200060E1C000100010000000000DF000F0000000F0000000F000000000000000D083B0000086000000017002701F3000001570000001B001300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B0000
\par 192.168.1.20 TCPIP SEND :000000000006016602000060
\par Receive Data: 192.168.1.20 Time: 2023-05-22 08:48:43 Address :0100 Pak:206 Length 412
nikito7
(nikito7)
May 22, 2023, 10:33am
70
000000000006 01 03 0100 005B
slave 1
holding
address 0x0100, maybe decimal 256
There is no 0x1000 I think
Jiran
(Jiran)
May 25, 2023, 2:29pm
71
@nikito7 here: TCPIP Protocol | PDF Host is a document. Please could you take a look at page 7 (find register 1006 - SOC) and show me how to prepare HA config for this? Seems I´m really lost. Thank you in advance.
nikito7
(nikito7)
May 25, 2023, 2:41pm
72
Any register work for you?
Give me a working example.
Jiran
(Jiran)
May 25, 2023, 3:09pm
73
Not working between HA and this BMS. Wotking between other software (BMSs monitoring) and BMS. Here is small part of a log of this communication:
{\rtf1\ansi\ansicpg1250\deff0\deflang1029{\fonttbl{\f0\fnil\fcharset134 ??;}}
\viewkind4\uc1\pard\f0\fs18 192.168.1.20 TCPIP SEND :000000000006010320120001
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:47 Address :2012 Pak:11 Length 22
\par 0000000000050103020000
\par 192.168.1.20 TCPIP SEND :00000000000601030100005B
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:47 Address :0100 Pak:191 Length 382
\par 0000000000B90103B60A480022AAAA000F000001110036006300640018000100010016000300071019000200060FD8000100020000000000DF000F0000000F0000000F000000000000000E092E000008EA0000001A002C023000000002000000000034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C300000
\par 192.168.1.20 TCPIP SEND :000000000006016602000060
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:47 Address :0100 Pak:206 Length 412
\par 0000000000C801660200006000C00FE50FD80FE210030FFA1010101110111011101310111012101110121012101200180018001800170018001800180017101310171016101710141019101610161011101510131014101210141014101200170017001700180017001800170018101110171013101610141017101410161012101610151015101310141014101200170017001700170017001700160017101210161013101710141017101510151015101610141016101410161015101400170018001700180018001800180018
\par 192.168.1.20 TCPIP SEND :000000000006010320120001
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:48 Address :2012 Pak:11 Length 22
\par 0000000000050103020000
\par 192.168.1.20 TCPIP SEND :00000000000601030100005B
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:48 Address :0100 Pak:191 Length 382
\par 0000000000B90103B60A480022AAAA000F00000111003E006300640018000100010016000300071017000300020FD7000100020000000000DF000F0000000F0000000F000000000000000E092E000008EA0000001A002C023000000002000000000034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C300000
\par 192.168.1.20 TCPIP SEND :000000000006016602000060
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:48 Address :0100 Pak:206 Length 412
\par 0000000000C801660200006000C00FE30FD70FE210030FF9100F100F1011100F101210111012101110121012101200180018001800170018001800180017101310161014101610141016101510161012101410121014101210141013101200170017001700180017001800170018101110171013101610141017101410161012101610151015101310141014101200170017001700170017001700160017101210161013101610131016101410161012101610141017101510161016101300170018001700180018001800180018
\par 192.168.1.20 TCPIP SEND :000000000006010320120001
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:49 Address :2012 Pak:11 Length 22
\par 0000000000050103020000
\par 192.168.1.20 TCPIP SEND :00000000000601030100005B
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:49 Address :0100 Pak:191 Length 382
\par 0000000000B90103B60A470022AAAA000F000001110042006300640018000100010016000300071017000200020FD7000100020000000000DF000F0000000F0000000F000000000000000E092E000008EA0000001A002C023000000002000000000034000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C300000
\par 192.168.1.20 TCPIP SEND :000000000006016602000060
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:49 Address :0100 Pak:206 Length 412
\par 0000000000C801660200006000C00FE30FD70FE310030FF9100F100F1011100F101110111012101110131012101100180018001800170018001800180017101310171014101610141017101510161011101410121014101110131013101300170017001700180017001800170018101110161012101610141017101410141010101410141016101310131014101300170017001700170017001700160017101110151013101610121016101410151013101610131017101410161014101200170018001700180018001800180018
\par 192.168.1.20 TCPIP SEND :000000000006010320120001
\par Receive Data: 192.168.1.20 Time: 2023-05-25 17:01:50 Address :2012 Pak:11 Length 22
\par 0000000000050103020000
etc.
nikito7
(nikito7)
May 25, 2023, 7:15pm
74
01 03 2012 0001
- name: "Test 0x2012"
slave: 1
address: 8210 # 0x2012
input_type: holding
count: 1
data_type: uint16
precision: 1
scale: 0.1
Result should be zero, but without any error in logs
nikito7
(nikito7)
May 25, 2023, 7:28pm
75
01 03 0100 005B holding (03)
01 66 0200 0060 not supported (66)
01 03 2012 0001 holding
Address 0x0100 or 0x2012 should work
You need to convert to decimal I think
Jiran
(Jiran)
May 26, 2023, 3:39am
77
OK, but how exactly should look HA config? I really don´t know where to change 10XX to 01XX. Could oyu please point me?
Jiran
(Jiran)
May 26, 2023, 3:54am
78
I tried yours:
- name: BMS
type: tcp
host: 192.168.1.20
port: 502 #your port number
sensors:
- name: "Test 0x2012"
slave: 1
address: 8210 # 0x2012
input_type: holding
count: 1
data_type: uint16
precision: 1
scale: 0.1
with this result in log:
Source: components/modbus/modbus.py:403
Integration: Modbus (documentation, issues)
First occurred: 05:50:05 (1 occurrences)
Last logged: 05:50:05
Pymodbus: BMS: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
nikito7
(nikito7)
May 26, 2023, 4:37am
79
##
- name: BMS
type: tcp
host: 192.168.1.20
port: 502 #your port number
delay: 1
timeout: 3
retries: 3
retry_on_empty: true
message_wait_milliseconds: 250
sensors:
- name: "Test 0x0106"
slave: 1
address: 262
input_type: holding
count: 1
data_type: uint16
If don’t work, you have communication issues.
IP blacklist or need configuration in bms.
Or need some type of authorization.
Jiran
(Jiran)
May 26, 2023, 9:14am
80
Thank you very much. Now I undestand more.
I tried it with your config and there is still the same error in the log: Pymodbus: BMS: Exception Response(131, 3, IllegalAddress)
Will try to enable debug for modbus. Will also try to connect using some windows modbus tool (or NodeRed).