#************************************************************* Konfig ************************************************************* $catname="Huawei PV"; $ip_adresse_vom_wechselrichter="192.168.0.192"; $anzahl_der_wechselrichter=2; #************************************************************* Konfig Wechselrichter 1 ************************************************************* $wechselrichter_1_name="Dach"; $wechselrichter_1_string_1_name="Hof"; $wechselrichter_1_string_2_name="Garten"; #************************************************************* Konfig Wechselrichter 2 ************************************************************* $wechselrichter_2_name="Fassade"; $wechselrichter_2_string_1_name="Fassade"; $wechselrichter_2_string_2_name="Flachdach"; $wr_ac_spannungen_anzeigen=true; $wr_dc_spannungen_anzeigen=true; $wr_ac_strom_anzeigen=true; $wr_dc_strom_anzeigen=true; $wr_ac_leistung_anzeigen=true; $wr_dc_leistung_anzeigen=true; $wr_string_leistung_anzeigen=true; $wr_zaehlerstand_anzeigen=true; $Batterie_anzeigen=true; $Batterie_entladekapazitaet_anzeigen=true; $Batterie_ladekapazitaet_anzeigen=true; $batterie_leistung=true; $martmeter_anzeige=true; $Smartmeter_Spannung_anzeige=true; $martmeter_strom_anzeige=true; $martmeter_power_anzeige=true; $martmeter_power2_anzeige=true; $app_werte_anzeigen=true; $webansicht=true; if ($wr_string_leistung_anzeigen===true) { $wr_dc_spannungen_anzeigen=true; $wr_dc_strom_anzeigen=true; } $cat=0 /*[Stromzähler]*/; $catid1=GetorCreatcategory($catname,$cat); $catid=GetorCreatcategory("modbus",$catid1); IPS_Sethidden($catid, true); #************************************************************* Wechselrichter 1 ************************************************************* #************************************************************* Modus Splitter anlegen ************************************************************* if (@IPS_GetInstanceIDByName($wechselrichter_1_name,0) === false ) { $pv_1_modbus_splitter_id=IPS_CreateInstance("{A5F663AB-C400-4FE5-B207-4D67CC030564}"); IPS_SetName($pv_1_modbus_splitter_id, $wechselrichter_1_name); // Instanz benennen IPS_SetConfiguration($pv_1_modbus_splitter_id, '{"GatewayMode":0,"DeviceID":1,"SwapWords":false,"DelayTimeTCP":10,"DelayTimeRTU":20,"DataBlocks":"[]"}'); IPS_ApplyChanges($pv_1_modbus_splitter_id); $serialportidtemp=IPS_GetInstance($pv_1_modbus_splitter_id); $serialportid=$serialportidtemp['ConnectionID']; #************************************************************* Serial Port konfig ************************************************************* #$serialportid=IPS_CreateInstance("{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}"); IPS_SetName($serialportid, $wechselrichter_1_name); // Instanz benennen IPS_SetConfiguration($serialportid, '{"Open":true,"Host":"'.$ip_adresse_vom_wechselrichter.'","Port":502,"UseSSL":false,"VerifyPeer":true,"VerifyHost":true}'); IPS_ApplyChanges($serialportid); if ($anzahl_der_wechselrichter ===2) { #************************************************************* Wechselrichter 2 ************************************************************* #************************************************************* Modus Splitter anlegen ************************************************************* $pv_2_modbus_splitter_id=IPS_CreateInstance("{A5F663AB-C400-4FE5-B207-4D67CC030564}"); IPS_SetName($pv_2_modbus_splitter_id, $wechselrichter_2_name); // Instanz benennen IPS_SetConfiguration($pv_2_modbus_splitter_id, '{"GatewayMode":0,"DeviceID":2,"SwapWords":false,"DelayTimeTCP":10,"DelayTimeRTU":20,"DataBlocks":"[]"}'); IPS_ApplyChanges($pv_2_modbus_splitter_id); IPS_DisconnectInstance($pv_2_modbus_splitter_id); IPS_ConnectInstance($pv_2_modbus_splitter_id,$serialportid); } else $pv_2_modbus_splitter_id=false; #************************************************************* Smart Dongle ************************************************************* #************************************************************* Modus Splitter anlegen ************************************************************* $pv_1_smartmeter_modbus_splitter_id=IPS_CreateInstance("{A5F663AB-C400-4FE5-B207-4D67CC030564}"); IPS_SetName($pv_1_smartmeter_modbus_splitter_id, "Smart Dongle"); // Instanz benennen IPS_SetConfiguration($pv_1_smartmeter_modbus_splitter_id, '{"GatewayMode":0,"DeviceID":100,"SwapWords":false,"DelayTimeTCP":10,"DelayTimeRTU":20,"DataBlocks":"[]"}'); IPS_ApplyChanges($pv_1_smartmeter_modbus_splitter_id); IPS_DisconnectInstance($pv_1_smartmeter_modbus_splitter_id); IPS_ConnectInstance($pv_1_smartmeter_modbus_splitter_id,$serialportid); } else { $pv_1_modbus_splitter_id=IPS_GetInstanceIDByName($wechselrichter_1_name,0); $pv_2_modbus_splitter_id=IPS_GetInstanceIDByName($wechselrichter_2_name,0); $pv_1_smartmeter_modbus_splitter_id=IPS_GetInstanceIDByName("Smart Dongle",0); } # ********************************* Variable Profil erstellen *********************** $vpname="Ampere"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 1); // Variabelprofil erstellen #IPS_SetVariableProfileIcon($vpname,"Intensity"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," A"); IPS_SetVariableProfileValues($vpname, 0, 0,0 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. IPS_SetVariableProfileDigits($vpname, 2); } // Variabelprofil anlegen # ********************************* Variable Profil erstellen *********************** $vpname="kWh"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 2); // Variabelprofil erstellen IPS_SetVariableProfileIcon($vpname,"EnergySolar"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," KWh"); IPS_SetVariableProfileValues($vpname, 0, 0,0 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. IPS_SetVariableProfileDigits($vpname, 3); } // Variabelprofil anlegen # ********************************* Variable Profil erstellen *********************** $vpname="kW-solar"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 2); // Variabelprofil erstellen IPS_SetVariableProfileIcon($vpname,"EnergySolar"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," kW"); IPS_SetVariableProfileValues($vpname, 0, 0,0 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. IPS_SetVariableProfileDigits($vpname, 3); } // Variabelprofil anlegen # ********************************* Variable Profil erstellen *********************** $vpname="Watt"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 2); // Variabelprofil erstellen IPS_SetVariableProfileIcon($vpname,"Electricity"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," W"); IPS_SetVariableProfileValues($vpname, 0, 0,0 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. #IPS_SetVariableProfileDigits($vpname, 3); } // Variabelprofil anlegen # ********************************* Variable Profil erstellen *********************** $vpname="Watt2"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 1); // Variabelprofil erstellen IPS_SetVariableProfileIcon($vpname,"Electricity"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," W"); IPS_SetVariableProfileValues($vpname, 0, 0,0 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. #IPS_SetVariableProfileDigits($vpname, 3); } // Variabelprofil anlegen # ********************************* Variable Profil erstellen *********************** $vpname="prozent"; // Variable Profil erstellen if (!IPS_VariableProfileExists($vpname)) // Wenn das Provil noch nicht Exestiert dann lege es an: { IPS_CreateVariableProfile($vpname, 2); // Variabelprofil erstellen IPS_SetVariableProfileIcon($vpname,"Battery"); // Variabelprofil Icon zuweisen IPS_SetVariableProfileText($vpname,""," %"); IPS_SetVariableProfileValues($vpname, 0, 100,1 ); //Der Befehl setzt den MinimalWert, MaximalWert und die Schrittweite eines Variablenprofils mit Namen ProfilName. IPS_SetVariableProfileDigits($vpname, 0); } // Variabelprofil anlegen # ************************************************************* Veriablen anlegen ************************************************************* # ************************************************************* Wechselrichter ************************************************************* # ************************************************************* AC Spannungen ************************************************************* if ($wr_ac_spannungen_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Spannungen"; $wr_spannungen_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_spannungen_cat_id,0); $spannungl1id=create_modbusdevice("L1", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32069,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_1_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L1"); $spannungl2id=create_modbusdevice("L2", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32070,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_1_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L2"); $spannungl3id=create_modbusdevice("L3", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32071,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_1_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L3"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $spannungen_instanceid=GetOrCreateInstanz("Spannungen" , "dummy",$wr_cat_id ); IPS_SetPosition($spannungen_instanceid,0); $link1=GetorCreateLink("L1",$spannungen_instanceid,IPS_GetVariableIDByName("L1", $spannungl1id), 0); $link2=GetorCreateLink("L2",$spannungen_instanceid,IPS_GetVariableIDByName("L2", $spannungl2id), 1); $link3=GetorCreateLink("L3",$spannungen_instanceid,IPS_GetVariableIDByName("L3", $spannungl3id), 2); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Spannungen"; $wr_spannungen_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_spannungen_cat_id,0); $spannungl1id=create_modbusdevice("L1", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32069,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_2_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L1"); $spannungl2id=create_modbusdevice("L2", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32070,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_2_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L2"); $spannungl3id=create_modbusdevice("L3", '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32071,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_2_modbus_splitter_id, "~Volt.230", $wr_spannungen_cat_id,"MQTT_WR_VOLT_L3"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $spannungen_instanceid=GetOrCreateInstanz("Spannungen" , "dummy",$wr_cat_id ); IPS_SetPosition($spannungen_instanceid,0); $link21=GetorCreateLink("L1",$spannungen_instanceid,IPS_GetVariableIDByName("L1", $spannungl1id), 0); $link22=GetorCreateLink("L2",$spannungen_instanceid,IPS_GetVariableIDByName("L2", $spannungl2id), 1); $link23=GetorCreateLink("L3",$spannungen_instanceid,IPS_GetVariableIDByName("L3", $spannungl3id), 2); } } # ************************************************************* AC Strom ************************************************************* if ($wr_ac_strom_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Strom"; $wr_strom_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_strom_cat_id,1); $stroml1id=create_modbusdevice("L1", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32072,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_1_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L1"); $stroml2id=create_modbusdevice("L2", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32074,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_1_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L2"); $stroml3id=create_modbusdevice("L3", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32076,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_1_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L3"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $strom_instanceid=GetOrCreateInstanz("Strom" , "dummy",$wr_cat_id ); IPS_SetPosition($strom_instanceid,1); GetorCreateLink("L1",$strom_instanceid,IPS_GetVariableIDByName("L1", $stroml1id), 0); GetorCreateLink("L2",$strom_instanceid,IPS_GetVariableIDByName("L2", $stroml2id), 1); GetorCreateLink("L3",$strom_instanceid,IPS_GetVariableIDByName("L3", $stroml3id), 2); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Strom"; $wr_strom_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_strom_cat_id,1); $stroml1id=create_modbusdevice("L1", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32072,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_2_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L1"); $stroml2id=create_modbusdevice("L2", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32074,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_2_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L2"); $stroml3id=create_modbusdevice("L3", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32076,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_2_modbus_splitter_id, "~Ampere.16",$wr_strom_cat_id,"MQTT_WR_AMPERE_L3"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $strom_instanceid=GetOrCreateInstanz("Strom" , "dummy",$wr_cat_id ); IPS_SetPosition($strom_instanceid,1); GetorCreateLink("L1",$strom_instanceid,IPS_GetVariableIDByName("L1", $stroml1id), 0); GetorCreateLink("L2",$strom_instanceid,IPS_GetVariableIDByName("L2", $stroml2id), 1); GetorCreateLink("L3",$strom_instanceid,IPS_GetVariableIDByName("L3", $stroml3id), 2); } } # ************************************************************* DC Spannungen ************************************************************* if ($wr_dc_spannungen_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="PV Spannungen"; $wr_pv_spannungen_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_pv_spannungen_cat_id,2); $pv_volt1=create_modbusdevice($wechselrichter_1_string_1_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32016,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_1_modbus_splitter_id, "~Volt", $wr_pv_spannungen_cat_id,"MQTT_WR_VOLT_STRING_1"); $pv_volt2=create_modbusdevice($wechselrichter_1_string_2_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32018,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_1_modbus_splitter_id, "~Volt", $wr_pv_spannungen_cat_id,"MQTT_WR_VOLT_STRING_2"); IPS_SetPosition($pv_volt1,0); IPS_SetPosition($pv_volt2,1); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $pv_spannungen_instanceid=GetOrCreateInstanz("PV Sapnnungen" , "dummy",$wr_cat_id ); IPS_SetPosition($pv_spannungen_instanceid,2); GetorCreateLink($wechselrichter_1_string_1_name,$pv_spannungen_instanceid,IPS_GetVariableIDByName($wechselrichter_1_string_1_name, $pv_volt1), 0); GetorCreateLink($wechselrichter_1_string_2_name,$pv_spannungen_instanceid,IPS_GetVariableIDByName($wechselrichter_1_string_2_name, $pv_volt2), 1); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="PV Spannungen"; $wr_pv_spannungen_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_pv_spannungen_cat_id,2); $pv_volt1_2=create_modbusdevice($wechselrichter_2_string_1_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32016,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_2_modbus_splitter_id, "~Volt", $wr_pv_spannungen_cat_id,"MQTT_WR_VOLT_STRING_1"); $pv_volt2_2=create_modbusdevice($wechselrichter_2_string_2_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32018,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.1}',$pv_2_modbus_splitter_id, "~Volt", $wr_pv_spannungen_cat_id,"MQTT_WR_VOLT_STRING_2"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $pv_spannungen_instanceid=GetOrCreateInstanz("PV Sapnnungen" , "dummy",$wr_cat_id ); IPS_SetPosition($pv_spannungen_instanceid,2); GetorCreateLink($wechselrichter_2_string_1_name,$pv_spannungen_instanceid,IPS_GetVariableIDByName($wechselrichter_2_string_1_name, $pv_volt1_2), 0); GetorCreateLink($wechselrichter_2_string_2_name,$pv_spannungen_instanceid,IPS_GetVariableIDByName($wechselrichter_2_string_2_name, $pv_volt2_2), 1); IPS_SetPosition($pv_volt1_2,0); IPS_SetPosition($pv_volt2_2,1); } } # ************************************************************* DC Strom ************************************************************* if ($wr_dc_strom_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="PV Strom"; $wr_pv_strom_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_pv_strom_cat_id,3); $pv_strom1=create_modbusdevice($wechselrichter_1_string_1_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32017,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.01}',$pv_1_modbus_splitter_id, "~Ampere",$wr_pv_strom_cat_id,"MQTT_WR_AMPERE_STRING_1"); $pv_strom2=create_modbusdevice($wechselrichter_1_string_2_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32019,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.01}',$pv_1_modbus_splitter_id, "~Ampere",$wr_pv_strom_cat_id,"MQTT_WR_AMPERE_STRING_2"); IPS_SetPosition($pv_strom1,0); IPS_SetPosition($pv_strom2,1); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $dc_strom_instanceid=GetOrCreateInstanz("PV Strom" , "dummy",$wr_cat_id ); IPS_SetPosition($dc_strom_instanceid,3); GetorCreateLink($wechselrichter_1_string_1_name,$dc_strom_instanceid,IPS_GetVariableIDByName($wechselrichter_1_string_1_name, $pv_strom1), 0); GetorCreateLink($wechselrichter_1_string_2_name,$dc_strom_instanceid,IPS_GetVariableIDByName($wechselrichter_1_string_2_name, $pv_strom2), 1); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="PV Strom"; $wr_pv_strom_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_pv_strom_cat_id,3); $pv_strom1_2=create_modbusdevice($wechselrichter_2_string_1_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32017,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.01}',$pv_2_modbus_splitter_id, "~Ampere",$wr_pv_strom_cat_id,"MQTT_WR_AMPERE_STRING_1"); $pv_strom2_2=create_modbusdevice($wechselrichter_2_string_2_name, '{"DataType":2,"ReadFunctionCode":3,"ReadAddress":32019,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.01}',$pv_2_modbus_splitter_id, "~Ampere",$wr_pv_strom_cat_id,"MQTT_WR_AMPERE_STRING_2"); IPS_SetPosition($pv_strom1_2,0); IPS_SetPosition($pv_strom2_2,1); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $dc_strom_instanceid=GetOrCreateInstanz("PV Strom" , "dummy",$wr_cat_id ); IPS_SetPosition($dc_strom_instanceid,3); GetorCreateLink($wechselrichter_2_string_1_name,$dc_strom_instanceid,IPS_GetVariableIDByName($wechselrichter_2_string_1_name, $pv_strom1_2), 0); GetorCreateLink($wechselrichter_2_string_2_name,$dc_strom_instanceid,IPS_GetVariableIDByName($wechselrichter_2_string_2_name, $pv_strom2_2), 1); } } # ************************************************************* Leistung ************************************************************* # ************************************************************* AC Leistung ************************************************************* if ($wr_ac_leistung_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Leistung"; $wr_leistnung_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_leistnung_cat_id,4); $ac_gesamtleistung=create_modbusdevice("Gesamtleistung", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32080,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_1_modbus_splitter_id, "kW-solar",$wr_leistnung_cat_id,"MQTT_WR_WATT"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $ac_gesamtleistung_instance_id=GetOrCreateInstanz("Leistung" , "dummy",$wr_cat_id ); IPS_SetPosition($ac_gesamtleistung_instance_id,2); GetorCreateLink("Gesamtleistung",$ac_gesamtleistung_instance_id,IPS_GetVariableIDByName("Gesamtleistung", $ac_gesamtleistung), 0); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Leistung"; $wr_leistnung_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_leistnung_cat_id,4); $ac_gesamtleistung=create_modbusdevice("Gesamtleistung", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32080,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_2_modbus_splitter_id, "kW-solar",$wr_leistnung_cat_id,"MQTT_WR_WATT"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $ac_gesamtleistung_instance_id=GetOrCreateInstanz("Leistung" , "dummy",$wr_cat_id ); IPS_SetPosition($ac_gesamtleistung_instance_id,2); GetorCreateLink("Gesamtleistung",$ac_gesamtleistung_instance_id,IPS_GetVariableIDByName("Gesamtleistung", $ac_gesamtleistung), 0); } } # ************************************************************* DC Leistung ************************************************************* if ($wr_dc_leistung_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Leistung"; $wr_leistnung_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_leistnung_cat_id,4); $dc_gesamtleistung=create_modbusdevice("PV Gesamtleistung", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32064,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_1_modbus_splitter_id, "kW-solar",$wr_leistnung_cat_id,"MQTT_WR_WATT_PV"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $dc_gesamtleistung_instance_id=GetOrCreateInstanz("Leistung" , "dummy",$wr_cat_id ); IPS_SetPosition($dc_gesamtleistung_instance_id,4); GetorCreateLink("String Gesamtleistung ",$dc_gesamtleistung_instance_id,IPS_GetVariableIDByName("PV Gesamtleistung", $dc_gesamtleistung), 0); if ($pv_2_modbus_splitter_id !=false) { $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid); $catname="Leistung"; $wr_leistnung_cat_id=GetorCreatcategory($catname,$wr_cat_id); IPS_SetPosition($wr_leistnung_cat_id,4); $dc_gesamtleistung=create_modbusdevice("PV Gesamtleistung", '{"DataType":6,"ReadFunctionCode":3,"ReadAddress":32064,"WriteFunctionCode":0,"WriteAddress":0,"Length":0,"SwapBytes":false,"Poller":5000,"EmulateStatus":false,"Factor":0.001}',$pv_2_modbus_splitter_id, "kW-solar",$wr_leistnung_cat_id,"MQTT_WR_WATT_PV"); #************************************************************* Verlinkungen ************************************************************* $catname=$wechselrichter_2_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $dc_gesamtleistung_instance_id=GetOrCreateInstanz("Leistung" , "dummy",$wr_cat_id ); IPS_SetPosition($dc_gesamtleistung_instance_id,4); GetorCreateLink("String Gesamtleistung ",$dc_gesamtleistung_instance_id,IPS_GetVariableIDByName("PV Gesamtleistung", $dc_gesamtleistung), 0); } } # ************************************************************* String Leistung ************************************************************* if ($wr_string_leistung_anzeigen===true) { $catname=$wechselrichter_1_name; $wr_cat_id=GetorCreatcategory($catname,$catid1); $dc_gesamtleistung_instance_id=GetOrCreateInstanz("Leistung" , "dummy",$wr_cat_id ); IPS_SetPosition($dc_gesamtleistung_instance_id,4); $string_1_volt_id=IPS_GetVariableIDByName($wechselrichter_1_string_1_name, $pv_volt1); $string_2_volt_id=IPS_GetVariableIDByName($wechselrichter_1_string_2_name, $pv_volt2); $string_1_strom_id=IPS_GetVariableIDByName($wechselrichter_1_string_1_name, $pv_strom1); $string_2_strom_id=IPS_GetVariableIDByName($wechselrichter_1_string_2_name, $pv_strom2); $string_1_pv_leistung=GetOrCreateVariable( "$wechselrichter_1_string_1_name Leistung", "2","MQTT_STRING_ONE_POWER", "kW-solar","", false, $dc_gesamtleistung_instance_id,2 ); $string_2_pv_leistung=GetOrCreateVariable( "$wechselrichter_1_string_2_name Leistung", "2","MQTT_STRING_TWO_POWER", "kW-solar","", false, $dc_gesamtleistung_instance_id,3 ); $script='
"; #$wetter=""; #$wetter="