Important information
Note that the integration described below can only work if the USB/RS485 stick is the only equipment on the RS485 bus connected to the EM112. Indeed (and with the help of Eric G.) I understood that there could only bea single master equipment on the bus. The master is the one who questions and the slave the one who answers. EM112 is therefore a slave.
My first idea was to sniff out the lines of dialogue between EM112 and my Wallbox, the Wallbox being the master, I cannot do that. For the beauty of the exercise, I tested with two masters, it works we find values but from time to time, when the two masters ask a question together, we find ourselves with an error.
If someone can point me towards a way of ‘snipping’ bus 485 to intercept the information that the EM112 sends to a Wallbox, for example, I am a taker because at this stage I cannot have a Wallbox and a RS485/USB Key in parallel (two masters).
Equipment used and drivers
The most expensive piece of equipment in my entire painting (€1.33 on Ali 😂), it works, obviously there are fake keys, I may have been lucky but this seller is serious.
Of course, as soon as I received it, I opened it to find a reference. YYH-256
Searching the forums reveals that it is (probably) a fork of CH341 The drivers of the latter are even used.
It should be noted that my driver searches were useless since the key is natively recognised on the RaspberryPi4/HAOS I use.
I post here this diagram that gives the circuits used, note that quartz has disappeared, it is not an oversight at welding, it is an evolution of the key (a component won, it is a component won).
I connect the USB key to the RS485 port
The key has two connectors D+ and D-, just connect them to the pins B+(4) and A-(5) of the EM112
I connect the key to the USB port of the Raspi4
I immediately test the order lsusb on the command line and I see that when the new key is plugged in, I have one more line, it is a pretty good sign.
I pass the problems of ports /dev/ttyUSB0 and /dev/ttyUSB1 which change with each start-up, I have solved and documented the solution on:
I note that I will use the port /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 to connect to this key.
I configure the Modbus integration which is natively in HA
In my configuration file, I add the modbus line: !include modbus.yaml
And in modbus.yaml, I declare the key
- name: modbus _hub type: serial #port: /dev/ttyUSB1 port: /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 baudrate: 9600 bytesize: 8 method: rtu parity: N stopbits: 1 retries: 5 close_comm_on_error: false delay: 5 timeout: 2 _wait _milliseconds message: 1000
I declare each sensor
From there, I immerse myself in the Gavazzi Documentation and I will look for the lines that interest me:
To have the address of each sensor, I convert the addresses into hexa to decimal and then I declare the 4 sensors in modbus.yaml:
sensors: - name: EM112_W unit_of_measurement: W state_class: measurement device_class: energy slave: 1 address: 4 data_type: int32 input_type: input precision: 0 scale: 0.1 scan_interval: 10 lazy _error _count: 999 swap: word - name: EM112_A unit_of_measurement: A state_class: measurement device_class: current Slavic: 1 address: 2 data_type: int32 input_type: input precision: 0 scale: 0.001 scan_interval: 10 lazy _error _count: 999 swap: word - name: EM112_VA unit_of_measurement: VA state_class: measurement device_class: energy slave: 1 address: 6 data_type: int32 input_type: input precision: 0 scale: 0.1 scan_interval: 10 lazy _error _count: 999 swap: word - name: EM112_kwh unit_of_measurement: kwh state _class: total_increasing device_class: energy slave: 1 address: 16 data_type: int32 input_type: input precision: 0 scale: 0.1 scan_interval: 10 lazy _error _count: 999 swap: word
I check the result
Perfect! It only remains to play to make a pretty … card
Reminder
Do not put a Wallbox in parallel production
If someone can point me towards a way of ‘snipping’ bus 485 to intercept the information that the EM112 sends to a Wallbox, for example, I am a taker because at this stage I cannot have a Wallbox and a RS485/USB Key in parallel (two masters).












