Hello!
I´m thinking of integrating my home power mbus meter into HA and i´m trying to figure out the best way of doing this, i have come up with 2 possible ways and i would like some input
Number one:
Mbus slave -> Mbus master with intregrated modbus converter.
After a quick google search on “modbus home assistant” there seems to be a pretty thought out module for this, suprisingly since modbus is mostly used with industry and building management automation.
Can this work? Will the HA modbus module work with the HA utility meter module? Will the modbus service pop up in HA as a entity and work like any other entity?
Number two:
There are various raspberry pi mbus cards but the integration seems very dificult, haven´t found any working solution for HA on google, anyone here tried this?
The only usb solution i can find is some mbus master for troubleshooting with windows support.
There seems to exist mbus masters with zigbee built in but it lacks alot of information.
Anyone tried any of this or have another solution?
Hi, I’m using an usb-rs485 adapter with my raspberry pi and seems working fine (you can find the cheaper one on AliExpress or similar store) My raspberry pi running the hass.io image and detect directly the usb adapter. You can have some issue with particular modbus device. For example the eastron power meter quite often doesn’t reply to the request
My electricity meter turned out to be modbus upon further inspection , i bought the same adapter that you have and i can poll the adresses with modpoll successfully, but i can’t get the HA modbus module right.
./modpoll -b 9600 -p none -m rtu -a 66 -t 3:int -r 53 -d 8 -s 1 -c 1 /dev/ttyUSB0
no parity
input reg
32bit int
8databits
1 stopbit
that one gives me a correct reading
But i can’t translate that to HA modbus module
This is what i got and it gives me false reading
modbus:
name: hub1
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
sensor:
platform: modbus
scan_interval: 60
registers:
name: Total
hub: hub1
slave: 66
register: 353
register_type: input
unit_of_measurement: kwh
count: 1
scale: 1
precision: 1
data_type: int
in my opinion you have few error in your code.
I’ll suggest to have a look of this site, there are explanation about modbus in general SimplyModbus
then in order to read the address 300053 (kWh (+) TOT
try this configuration:
modbus:
name: hub1
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
sensor:
platform: modbus
scan_interval: 60
registers:
name: Total
hub: hub1
slave: 66
register: 53 # input register group (30000) is defined below, here you can write only the last digits
register_type: input #should work also reading holding register
unit_of_measurement: kwh
count: 2 # we must read 2 register
scale: 1
precision: 1
data_type: float # If float selected, value will be converted to IEEE 754 floating point format
then below you can see my code as example
#Modbus configuration
modbus:
name: Com0
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
timeout: 1
name: Com1
type: serial
method: rtu
port: /dev/ttyUSB1
baudrate: 19200
stopbits: 1
bytesize: 8
parity: E
timeout: 1
Sensors
sensor:
Weather prediction
platform: yr
sensor eastron:
platform: modbus
scan_interval: 3
registers:
name: Voltage
hub: Com0
unit_of_measurement: V
register: 0
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
name: Current
hub: Com0
unit_of_measurement: A
register: 6
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
Maybe something about python version if think 3.5 must be updated (3.7 I think), but I’m not expert about this matter, I’m using hassio on raspberry and all updates are done in automatic
In the release below they mention that python 3.5 is not supported anymore
No the value is offset.
I think i figured out what the problem is though.
if i change count to 2 in modpoll i get the same value as HA, but if i set count to 1 in HA i get value 0, if i set count to 1 in modpoll, i get the correct value.