{"id":5097,"date":"2023-09-30T09:50:07","date_gmt":"2023-09-30T07:50:07","guid":{"rendered":"https:\/\/www.sigalou-domotique.fr\/?p=5097"},"modified":"2026-01-02T16:57:13","modified_gmt":"2026-01-02T14:57:13","slug":"jintegre-le-power-boost-em112-de-chez-carlo-gavazzi-dans-home-assistant-via-le-port-rd485-modbus","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/de\/jintegre-le-power-boost-em112-de-chez-carlo-gavazzi-dans-home-assistant-via-le-port-rd485-modbus","title":{"rendered":"Ich integriere den Power Boost EM112 von Carlo Gavazzi \u00fcber den RS485-Port (Modbus) in den Home Assistant"},"content":{"rendered":"<h3>Wichtige Informationen<\/h3>\r\n<blockquote>\r\n<p>Bitte beachten Sie, dass die unten beschriebene Integration nur funktionieren kann, wenn der USB\/RS485-Stick das einzige Ger\u00e4t des RS485-Busses ist, das mit dem EM112 verbunden ist. Tats\u00e4chlich (und dank der Hilfe von Eric G.) habe ich verstanden, dass es nur<strong>eine einzige Master-Ausr\u00fcstung auf dem Bus<\/strong>. Der Herr ist derjenige, der fragt, und der Sklave derjenige, der antwortet. EM112 ist also Sklave.<\/p>\r\n<p>Meine erste Idee war es, die Dialogstrukturen zwischen EM112 und meiner Wallbox zu sch\u00e4rfen, da die Wallbox Herr ist, was ich nicht tun kann. F\u00fcr die Sch\u00f6nheit der \u00dcbung habe ich mit zwei Meistern getestet, es funktioniert, wir finden Werte, aber von Zeit zu Zeit, wenn die beiden Meister eine Frage zusammen stellen, finden wir uns mit einem Fehler wieder.<\/p>\r\n<p><strong>Wenn jemand mich zu einer Art \u201eSnifer\u201c des Busses 485 f\u00fchren kann, um die Informationen abzufangen, die das EM112 beispielsweise an eine Wallbox sendet, bin ich Versicherungsnehmer, da ich zu diesem Zeitpunkt keine Wallbox und keinen RS485\/USB-Schl\u00fcssel parallel (zwei Master) haben kann.<\/strong><\/p>\r\n<\/blockquote>\r\n<p><!--more--><\/p>\r\n<h3>&nbsp;Verwendete Hardware und Treiber<\/h3>\r\n<p>Die teuerste Ausr\u00fcstung meines gesamten Bildes (1,33 \u20ac auf <a href=\"https:\/\/s.click.aliexpress.com\/e\/_Dmm7Ncx\" target=\"_blank\" rel=\"noopener\">Ali<\/a> \ud83d\ude02), es funktioniert, offensichtlich gibt es gef\u00e4lschte Schl\u00fcssel, ich habe vielleicht Gl\u00fcck gehabt, aber dieser Verk\u00e4ufer ist seri\u00f6s.<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/s.click.aliexpress.com\/e\/_Dmm7Ncx\" target=\"_blank\" rel=\"noopener\">USB-Stick\/RS485<\/a><\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5133\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485.png\" alt=\"\" width=\"272\" height=\"236\"><\/a><\/p>\r\n<p>Offensichtlich habe ich sie nach Erhalt ge\u00f6ffnet, um eine Referenz zu finden, es ist eine <strong>YYH-256<\/strong><\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5134\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-3.png\" alt=\"\" width=\"468\" height=\"140\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-3.png 468w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-3-300x90.png 300w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/a> <a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5135\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-2.png\" alt=\"\" width=\"421\" height=\"300\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-2.png 421w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-2-300x214.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/a><\/p>\r\n<p>Bei der Suche in den Foren stellt sich heraus, dass dies (wahrscheinlich) eine Fork von <strong>CH341<\/strong> Die Treiber des letzteren werden sogar verwendet.<\/p>\r\n<p>Beachten Sie, dass meine Suche nach Treibern nutzlos war, da der Schl\u00fcssel auf dem von mir verwendeten RaspberryPi4\/HAOS nativ erkannt wird.<\/p>\r\n<p>Ich schreibe hier dieses Schema, das die verwendeten Schaltkreise gibt, zu beachten, dass der Quarz verschwunden ist, es ist kein Vergessen beim Schwei\u00dfen, es ist eine Weiterentwicklung des Schl\u00fcssels (eine gewonnene Komponente ist eine gewonnene Komponente).<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/images.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5136\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/images.jpg\" alt=\"\" width=\"343\" height=\"147\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/images.jpg 343w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/images-300x129.jpg 300w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/a><\/p>\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h3>Ich verbinde den USB-Stick mit dem RS485-Port<\/h3>\r\n<p>Der Schl\u00fcssel hat zwei Anschl\u00fcsse D+ und D-, schlie\u00dfen Sie sie einfach an die Pins B+(4) und A-(5) des EM112 an<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5150\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-8.png\" alt=\"\" width=\"333\" height=\"238\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-8.png 333w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-8-300x214.png 300w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/a><\/p>\r\n<h3>Ich verbinde den Schl\u00fcssel mit dem USB-Anschluss des Raspi4<\/h3>\r\n<p>Ich teste sofort die Bestellung\u00a0 <strong>lsusb<\/strong> auf der Befehlszeile und ich stelle fest, dass ich, wenn der neue Schl\u00fcssel eingesteckt ist, eine weitere Zeile habe, was ein ziemlich gutes Zeichen ist.<\/p>\r\n<p>Ich \u00fcberspringe die Probleme mit den Ports \/dev\/ttyUSB0 und \/dev\/ttyUSB1, die sich bei jedem Start \u00e4ndern, und habe die L\u00f6sung unter folgenden Bedingungen gel\u00f6st und dokumentiert:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/de\/fixer-les-ports-usb-d-un-raspberry\/\" target=\"_blank\" rel=\"noopener\">Anbringen der USB-Anschl\u00fcsse an einem Raspberry<\/a><\/li>\r\n<\/ul>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5125\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png\" alt=\"\" width=\"1073\" height=\"71\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d.png 1073w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-600x40.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-300x20.png 300w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-1024x68.png 1024w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2019\/09\/b7b14ba75628093cb044d04b31c57196d5303e5d-768x51.png 768w\" sizes=\"auto, (max-width: 1073px) 100vw, 1073px\" \/><\/a><\/p>\r\n<p>Ich stelle fest, dass ich den Hafen benutzen werde. <span class=\"enlighter-text\">\/dev\/serial\/by-id\/usb-1a86_USB2.<\/span><span class=\"enlighter-n1\">0<\/span><span class=\"enlighter-text\">-Ser_-if00-port0, um mich mit diesem Schl\u00fcssel zu verbinden.<\/span><\/p>\r\n<h3>Ich konfiguriere die Modbus-Integration, die nativ in HA ist<\/h3>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/modbus.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5137\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/modbus.png\" alt=\"\" width=\"476\" height=\"156\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/modbus.png 476w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/modbus-300x98.png 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><\/a><\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5138\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-4.png\" alt=\"\" width=\"315\" height=\"53\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-4.png 315w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-4-300x50.png 300w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/a><\/p>\r\n<p>In meiner Konfigurationsdatei f\u00fcge ich die Modbus-Zeile hinzu: !include modbus.yaml<\/p>\r\n<p>Und in modbus.yaml erkl\u00e4re ich den Schl\u00fcssel<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5139\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-5.png\" alt=\"\" width=\"533\" height=\"246\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-5.png 533w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-5-300x138.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/a><\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">- name: modbus_hub Typ: serial #Hafen: \/dev\/ttyUSB1 port: \/dev\/serial\/by-id\/usb-1a86_USB2.0-Ser_-if00-port0 baudrate: 9600 bytesize: 8 Methode: rtu parity: N Stopbits: 1 Retries: 5 close_comm_on_error: false delay: 5 Timeout: 2 _wait-Nachricht_milliseconds: 1000<\/pre>\r\n<h3>Ich deklariere jeden Sensor\u00a0<\/h3>\r\n<p>Von da an tauche ich ein in die <a href=\"https:\/\/gavazzi.se\/app\/uploads\/2020\/11\/em111_em112_m1_cp.pdf\" target=\"_blank\" rel=\"noopener\">Gavazzi-Dokumentation<\/a> und ich werde nach den Zeilen suchen, die mich interessieren:<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5142\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-6.png\" alt=\"\" width=\"677\" height=\"145\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-6.png 677w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-6-600x129.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-6-300x64.png 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/a><\/p>\r\n<p>Um die Adresse jedes Sensors zu erhalten, wandele ich die Adressen in hexa in dezimal um und deklariere dann die 4 Sensoren in modbus.yaml:<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">Sensoren: - name: EM112_W unit_of_measurement: W state_class: measurement device_class: energy slave: 1 Adresse: 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 slave: 1 Adresse: 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 Adresse: 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 Adresse: 16 data_type: int32 input_type: Input Precision: 0 Scale: 0.1 scan_interval: 10 lazy_error_count: 999 Swap: Word<\/pre>\r\n<h3>Ich \u00fcberpr\u00fcfe das Ergebnis<\/h3>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5145\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-7.png\" alt=\"\" width=\"725\" height=\"304\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-7.png 725w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-7-600x252.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/rs485-7-300x126.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/a><\/p>\r\n<p>Perfekt! Jetzt m\u00fcssen Sie nur noch spielen, um eine sch\u00f6ne \u2026-Karte zu machen.<\/p>\r\n<h3>Erinnerung<\/h3>\r\n<p>Nicht parallel zu einer Wallbox produzieren<\/p>\r\n<p><strong>Wenn jemand mich zu einer Art \u201eSnifer\u201c des Busses 485 f\u00fchren kann, um die Informationen abzufangen, die das EM112 beispielsweise an eine Wallbox sendet, bin ich Versicherungsnehmer, da ich zu diesem Zeitpunkt keine Wallbox und keinen RS485\/USB-Schl\u00fcssel parallel (zwei Master) haben kann.<\/strong><\/p>\r\n<h3>Bibliographie, Referenzen<\/h3>\r\n<ul>\r\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/modbus\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.home-assistant.io\/integrations\/modbus\/<\/a><\/li>\r\n<li><a href=\"https:\/\/gavazzi.se\/app\/uploads\/2020\/11\/em111_em112_m1_cp.pdf\" target=\"_blank\" rel=\"noopener\">https:\/\/gavazzi.se\/app\/uploads\/2020\/11\/em111_em112_m1_cp.pdf<\/a><\/li>\r\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Wichtige Information Bitte beachten Sie, dass die unten beschriebene Integration nur funktionieren kann, wenn der USB\/RS485-Stick die einzige RS485-Busausr\u00fcstung ist, die mit dem EM112 verbunden ist. Tats\u00e4chlich (und dank der Hilfe von Eric G.) habe ich verstanden, dass es nur eine Hauptausr\u00fcstung auf dem Bus geben kann. Der Herr aber ist der, der fragt.<\/p>","protected":false},"author":1,"featured_media":5099,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,53,166],"tags":[81,67],"class_list":["post-5097","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-home-assistant","category-retex","tag-developpement","tag-wallbox"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/5097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/comments?post=5097"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/posts\/5097\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media\/5099"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/media?parent=5097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/categories?post=5097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/de\/wp-json\/wp\/v2\/tags?post=5097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}