diff --git a/haos-addon/config.yaml b/haos-addon/config.yaml index 83bd29f..adbd845 100644 --- a/haos-addon/config.yaml +++ b/haos-addon/config.yaml @@ -1,5 +1,5 @@ name: ShineBridge -version: "1.10.0" +version: "1.10.1" slug: shinebridge description: Energiemanagement für Growatt/Goodwe-Wechselrichter — PV-Überschussladen, Wallbox-EMS, Tarifvergleich, Zigbee2MQTT-Überschussgeräte url: https://gitea.bitfire.work/retr0/shinebridge diff --git a/haos-addon/src/main.py b/haos-addon/src/main.py index 998642c..84e2796 100644 --- a/haos-addon/src/main.py +++ b/haos-addon/src/main.py @@ -837,10 +837,17 @@ def api_import_config(): if not isinstance(inverters, list): return jsonify({"error": "inverters ungültig"}), 400 for inv in inverters: - if not inv.get("modbus_ip"): + model_id = inv.get("inverter_model") + if model_id not in INVERTERS: + return jsonify({"error": f"Unbekanntes Modell: {model_id}"}), 400 + protocol = INVERTERS[model_id].protocol + # modbus_ip wird als generisches Host-Feld fuer alle IP-basierten Protokolle + # wiederverwendet (modbus, goodwe_udp, kathrein) — nur ha_entity braucht keins. + if protocol == "ha_entity": + if not inv.get("ha_entity_prefix"): + return jsonify({"error": f"ha_entity_prefix fehlt in Gerät {inv.get('name', '?')}"}), 400 + elif not inv.get("modbus_ip"): return jsonify({"error": f"modbus_ip fehlt in Gerät {inv.get('name', '?')}"}), 400 - if inv.get("inverter_model") not in INVERTERS: - return jsonify({"error": f"Unbekanntes Modell: {inv.get('inverter_model')}"}), 400 with State.lock: if mqtt := data.get("mqtt"):