<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Forum KNX francophone / English KNX forum - Logiciels libres (linknx, knxweb, pKNyX,...)]]></title>
		<link>https://www.knx-fr.com/</link>
		<description><![CDATA[Forum KNX francophone / English KNX forum - https://www.knx-fr.com]]></description>
		<pubDate>Mon, 26 Oct 2026 09:27:46 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Zehnder ComfoConnect PRO et Home Assistant]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=16476</link>
			<pubDate>Tue, 20 Oct 2026 08:08:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=2290">NicNac</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=16476</guid>
			<description><![CDATA[Home Assistant propose via HACS<br />
<br />
 Zehnder ComfoConnect PRO mais via un modbus.<br />
<br />
Chez moi, le module est connecté KNX.<br />
<br />
Comment éventuellement passer aussi par un modbus ?]]></description>
			<content:encoded><![CDATA[Home Assistant propose via HACS<br />
<br />
 Zehnder ComfoConnect PRO mais via un modbus.<br />
<br />
Chez moi, le module est connecté KNX.<br />
<br />
Comment éventuellement passer aussi par un modbus ?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[Projet] Une stack KNX TP1 open source pour Zephyr RTOS + carte KnxBoard]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=16452</link>
			<pubDate>Sun, 20 Sep 2026 10:19:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=2501">condo4</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=16452</guid>
			<description><![CDATA[Bonjour à tous,<br />
<br />
Je voulais partager un projet sur lequel je travaille depuis plusieurs années : une implémentation du protocole KNX (TP1, mode S, System B — masque 07B0h) en pure C, principalement pour STM332, mais pas que...<br />
Après plusieurs années et différent essais j'ai choisi de le porter sur Zephyr RTOS.<br />
J'ai aussi fait une carte électronique open hardware qui va avec.<br />
<br />
Pourquoi ce projet ?<br />
<br />
Il n'existait pas, à ma connaissance, de stack KNX correctement intégrée à un OS temps réel open source comme Zephyr.<br />
Je n'avais trouver que la stack C++ Thelsing, surtout orienté Arduino, et, difficilement portable sur n'importe quel environnement.<br />
<br />
L'objectif est de fournir une base solide, testée, et surtout générique — pas liée à un produit ou un capteur en particulier — qui puisse à terme être proposée en amont (mainline) dans Zephyr.<br />
<br />
Ce que ça couvre<br />
<br />
- La stack protocolaire complète : couches Liaison de données, Réseau, Transport (machine à états Style 3 complète) et Application (21 services APDU), les objets d'interface System B, les Datapoint Types courants, et la persistance mémoire compatible avec le modèle de téléchargement ETS.<br />
- Le driver pour le transceiver onsemi NCN5130 (liaison UART 9 bits).<br />
- Un driver de "loopback" logiciel, pratique pour faire tourner et tester la stack sans bus KNX physique.<br />
- Une suite de tests unitaires (8 suites, exécutables sans matériel).<br />
<br />
<br />
La carte : KnxBoard<br />
<br />
En parallèle, j'ai conçu KnxBoard, une carte STM32G4 + NCN5130 pensée comme une "carte de base" générique (un peu à la manière d'un Arduino) : elle ne fait que parler KNX TP1, et on vient y greffer une "carte plus simple" (daughterboard) selon le produit voulu — j'ai deux exemples fonctionnels : une sonde 1-Wire (DS18B20) et une sonde PT100.<br />
<br />
Schémas, PCB et documentation matérielle sont sur GitHub : (Projet Kicad)<br />
<br />
J'ai fait des PCBA sur JLCPCB, ce qui revient autour de 30€ la carte par 5 exemplaires, (PCB + Composant + Assamblage)<br />
Je referais un nouveau prototype prochainement, j'ai une V6 dans les tuyaux avec quelque léger changement, mais la V5 fonctionne parfaitement.<br />
<br />
<a href="https://github.com/condo4/knxboard" target="_blank" rel="noopener" class="mycode_url">https://github.com/condo4/knxboard</a><br />
<br />
Je posterais prochainement les daughterboard et des photos<br />
<br />
Où en est-on ?<br />
<br />
Un téléchargement partiel ETS fonctionne de bout en bout sur la carte réelle, et toute la stack est couverte par des tests. Mais — et c'est important de le dire clairement : ce n'est pas une stack certifiée KNX, elle n'implémente pas KNX Data Secure, et je ne donne aucune garantie de conformité totale au protocole au-delà de ce qui a été testé sur banc. C'est un point de départ robuste, pas un produit fini.<br />
<br />
Et maintenant ?<br />
<br />
Le code est en cours de préparation pour une proposition d'intégration à Zephyr. N'hésitez pas à jeter un œil, tester, remonter des retours ou contribuer — toute aide est la bienvenue, que ce soit sur la stack, le hardware, ou les tests de conformité avec de vrais produits KNX du marché.<br />
<br />
En attendant les corrections et la finalisation de la PR, le code est déjà dispo sur<br />
<a href="https://github.com/condo4/zephyr/tree/devel/knx-protocol" target="_blank" rel="noopener" class="mycode_url">https://github.com/condo4/zephyr/tree/de...x-protocol</a><br />
<br />
Merci de votre lecture, et n'hésitez pas si vous avez des questions !]]></description>
			<content:encoded><![CDATA[Bonjour à tous,<br />
<br />
Je voulais partager un projet sur lequel je travaille depuis plusieurs années : une implémentation du protocole KNX (TP1, mode S, System B — masque 07B0h) en pure C, principalement pour STM332, mais pas que...<br />
Après plusieurs années et différent essais j'ai choisi de le porter sur Zephyr RTOS.<br />
J'ai aussi fait une carte électronique open hardware qui va avec.<br />
<br />
Pourquoi ce projet ?<br />
<br />
Il n'existait pas, à ma connaissance, de stack KNX correctement intégrée à un OS temps réel open source comme Zephyr.<br />
Je n'avais trouver que la stack C++ Thelsing, surtout orienté Arduino, et, difficilement portable sur n'importe quel environnement.<br />
<br />
L'objectif est de fournir une base solide, testée, et surtout générique — pas liée à un produit ou un capteur en particulier — qui puisse à terme être proposée en amont (mainline) dans Zephyr.<br />
<br />
Ce que ça couvre<br />
<br />
- La stack protocolaire complète : couches Liaison de données, Réseau, Transport (machine à états Style 3 complète) et Application (21 services APDU), les objets d'interface System B, les Datapoint Types courants, et la persistance mémoire compatible avec le modèle de téléchargement ETS.<br />
- Le driver pour le transceiver onsemi NCN5130 (liaison UART 9 bits).<br />
- Un driver de "loopback" logiciel, pratique pour faire tourner et tester la stack sans bus KNX physique.<br />
- Une suite de tests unitaires (8 suites, exécutables sans matériel).<br />
<br />
<br />
La carte : KnxBoard<br />
<br />
En parallèle, j'ai conçu KnxBoard, une carte STM32G4 + NCN5130 pensée comme une "carte de base" générique (un peu à la manière d'un Arduino) : elle ne fait que parler KNX TP1, et on vient y greffer une "carte plus simple" (daughterboard) selon le produit voulu — j'ai deux exemples fonctionnels : une sonde 1-Wire (DS18B20) et une sonde PT100.<br />
<br />
Schémas, PCB et documentation matérielle sont sur GitHub : (Projet Kicad)<br />
<br />
J'ai fait des PCBA sur JLCPCB, ce qui revient autour de 30€ la carte par 5 exemplaires, (PCB + Composant + Assamblage)<br />
Je referais un nouveau prototype prochainement, j'ai une V6 dans les tuyaux avec quelque léger changement, mais la V5 fonctionne parfaitement.<br />
<br />
<a href="https://github.com/condo4/knxboard" target="_blank" rel="noopener" class="mycode_url">https://github.com/condo4/knxboard</a><br />
<br />
Je posterais prochainement les daughterboard et des photos<br />
<br />
Où en est-on ?<br />
<br />
Un téléchargement partiel ETS fonctionne de bout en bout sur la carte réelle, et toute la stack est couverte par des tests. Mais — et c'est important de le dire clairement : ce n'est pas une stack certifiée KNX, elle n'implémente pas KNX Data Secure, et je ne donne aucune garantie de conformité totale au protocole au-delà de ce qui a été testé sur banc. C'est un point de départ robuste, pas un produit fini.<br />
<br />
Et maintenant ?<br />
<br />
Le code est en cours de préparation pour une proposition d'intégration à Zephyr. N'hésitez pas à jeter un œil, tester, remonter des retours ou contribuer — toute aide est la bienvenue, que ce soit sur la stack, le hardware, ou les tests de conformité avec de vrais produits KNX du marché.<br />
<br />
En attendant les corrections et la finalisation de la PR, le code est déjà dispo sur<br />
<a href="https://github.com/condo4/zephyr/tree/devel/knx-protocol" target="_blank" rel="noopener" class="mycode_url">https://github.com/condo4/zephyr/tree/de...x-protocol</a><br />
<br />
Merci de votre lecture, et n'hésitez pas si vous avez des questions !]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[KNX Stack - C++ Code ESP32 pour l'IDE Arduino]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=16449</link>
			<pubDate>Tue, 15 Sep 2026 17:42:23 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=16449</guid>
			<description><![CDATA[Bonjour à tous,<br />
<br />
Je souhaite mettre à votre disposition ce code qui permet de communiquer avec KNX sur un ESP32 sans aucune bibliothèque supplémentaire. Il peut aussi bien envoyer que recevoir les télégrammes les plus courants.<br />
<br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>#include &lt;WiFi.h&gt;<br />
#include &lt;WiFiUdp.h&gt;<br />
#include &lt;WebServer.h&gt;<br />
#include &lt;time.h&gt;<br />
<br />
<br />
const char* projectName  = "KNX Stack";<br />
<br />
const char* ssid         = "WLAN SSID";<br />
const char* password     = "WLAN Passwort";<br />
<br />
const char* ntpServer    = "pool.ntp.org";<br />
const char* tzInfo       = "CET-1CEST,M3.5.0,M10.5.0/3";<br />
<br />
const char* knxGatewayIp = "IP KNX Gateway";<br />
const uint16_t knxPort   = 3671;<br />
const uint16_t localPort = 3671;<br />
<br />
WiFiUDP udp;<br />
WebServer server(80);<br />
<br />
uint8_t knxChannelId     = 0;<br />
uint8_t txSeqNum         = 0;<br />
bool isKnxConnected      = false;<br />
<br />
unsigned long lastHeartbeat = 0;<br />
const unsigned long HEARTBEAT_INTERVAL = 60000;<br />
const unsigned long ACK_TIMEOUT        = 1000;<br />
<br />
#define KNX_LOG_SIZE 10<br />
struct KnxLogEntry {<br />
  char timeStr[24];<br />
  uint16_t ga;<br />
  uint8_t data[16];<br />
  uint8_t len;<br />
};<br />
<br />
KnxLogEntry knxLog[KNX_LOG_SIZE];<br />
int knxLogNext = 0;<br />
int knxLogFilled = 0;<br />
<br />
void hexDump(const char* label, const uint8_t* buf, int len) {<br />
  Serial.printf("%s [%d Bytes]: ", label, len);<br />
  for (int i = 0; i &lt; len; i++) {<br />
    Serial.printf("%02X ", buf[i]);<br />
  }<br />
  Serial.println();<br />
}<br />
<br />
const char* knxStatusToString(uint8_t status) {<br />
  switch (status) {<br />
    case 0x00: return "E_NO_ERROR";<br />
    case 0x01: return "E_HOST_PROTOCOL_TYPE";<br />
    case 0x02: return "E_VERSION_NOT_SUPPORTED";<br />
    case 0x04: return "E_SEQUENCE_NUMBER (Sequenznummer falsch/ausser Sync)";<br />
    case 0x21: return "E_CONNECTION_ID (unbekannte Channel ID)";<br />
    case 0x22: return "E_CONNECTION_TYPE";<br />
    case 0x23: return "E_CONNECTION_OPTION";<br />
    case 0x24: return "E_NO_MORE_CONNECTIONS (Gateway voll)";<br />
    case 0x26: return "E_DATA_CONNECTION";<br />
    case 0x27: return "E_KNX_CONNECTION";<br />
    case 0x29: return "E_TUNNELING_LAYER (nicht unterstuetzt)";<br />
    default:   return "Unbekannter Statuscode";<br />
  }<br />
}<br />
<br />
String getFormattedDateTime() {<br />
  struct tm timeinfo;<br />
  if (!getLocalTime(&amp;timeinfo, 100)) {<br />
    return "Zeit nicht synchronisiert";<br />
  }<br />
  char buf[32];<br />
  strftime(buf, sizeof(buf), "%d.%m.%Y %H:%M:%S", &amp;timeinfo);<br />
  return String(buf);<br />
}<br />
<br />
uint16_t parseGroupAddress(const String&amp; gaStr) {<br />
  int firstSlash  = gaStr.indexOf('/');<br />
  int secondSlash = gaStr.indexOf('/', firstSlash + 1);<br />
  if (firstSlash == -1 || secondSlash == -1) return 0;<br />
<br />
  uint8_t main   = gaStr.substring(0, firstSlash).toInt();<br />
  uint8_t middle = gaStr.substring(firstSlash + 1, secondSlash).toInt();<br />
  uint8_t sub    = gaStr.substring(secondSlash + 1).toInt();<br />
<br />
  return ((main &amp; 0x1F) &lt;&lt; 11) | ((middle &amp; 0x07) &lt;&lt; 8) | (sub &amp; 0xFF);<br />
}<br />
<br />
String gaToString(uint16_t ga) {<br />
  uint8_t main   = (ga &gt;&gt; 11) &amp; 0x1F;<br />
  uint8_t middle = (ga &gt;&gt; 8) &amp; 0x07;<br />
  uint8_t sub    = ga &amp; 0xFF;<br />
  return String(main) + "/" + String(middle) + "/" + String(sub);<br />
}<br />
<br />
uint16_t floatToDpt9(float val) {<br />
  int sign = (val &lt; 0) ? 1 : 0;<br />
  float v = (sign == 1) ? -val : val;<br />
  int exp = 0;<br />
  int mantissa = (int)(v * 100.0f);<br />
  while (mantissa &gt; 2047) {<br />
    mantissa &gt;&gt;= 1;<br />
    exp++;<br />
  }<br />
  if (sign == 1) {<br />
    mantissa = -mantissa;<br />
    mantissa &amp;= 0x07FF;<br />
  }<br />
  return (sign &lt;&lt; 15) | ((exp &amp; 0x0F) &lt;&lt; 11) | (mantissa &amp; 0x07FF);<br />
}<br />
<br />
float dpt9ToFloat(uint8_t hi, uint8_t lo) {<br />
  uint16_t raw = ((uint16_t)hi &lt;&lt; 8) | lo;<br />
  int sign = (raw &gt;&gt; 15) &amp; 0x01;<br />
  int exp  = (raw &gt;&gt; 11) &amp; 0x0F;<br />
  int mantissa11 = raw &amp; 0x07FF;<br />
  int M = mantissa11 - (sign ? 2048 : 0);<br />
  return 0.01f * M * (float)(1 &lt;&lt; exp);<br />
}<br />
<br />
void floatToDpt14Bytes(float val, uint8_t* out4) {<br />
  uint8_t* p = (uint8_t*)&amp;val;<br />
  out4[0] = p[3];<br />
  out4[1] = p[2];<br />
  out4[2] = p[1];<br />
  out4[3] = p[0];<br />
}<br />
<br />
float dpt14ToFloat(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3) {<br />
  uint8_t bytes[4] = { b3, b2, b1, b0 };<br />
  float f;<br />
  memcpy(&amp;f, bytes, 4);<br />
  return f;<br />
}<br />
<br />
String apciTypeStr(uint8_t apciByte) {<br />
  switch (apciByte &amp; 0xC0) {<br />
    case 0x00: return "Read";<br />
    case 0x40: return "Response";<br />
    case 0x80: return "Write";<br />
    default:   return "?";<br />
  }<br />
}<br />
<br />
String interpretKnxData(uint8_t* data, uint8_t len) {<br />
  String prefix = "[" + apciTypeStr(data[0]) + "] ";<br />
<br />
  if (len == 1) {<br />
    bool bitVal = data[0] &amp; 0x01;<br />
    return prefix + "DPT1: " + (bitVal ? "EIN (1)" : "AUS (0)");<br />
  }<br />
  else if (len == 2) {<br />
    return prefix + "DPT5: " + String(data[1]) + " (0..255)";<br />
  }<br />
  else if (len == 3) {<br />
    float f = dpt9ToFloat(data[1], data[2]);<br />
    return prefix + "DPT9: " + String(f, 2);<br />
  }<br />
  else if (len == 4) {<br />
    uint8_t h = data[1] &amp; 0x1F, mnt = data[2] &amp; 0x3F, s = data[3] &amp; 0x3F;<br />
    uint8_t day = data[1] &amp; 0x1F, month = data[2] &amp; 0x0F, year = data[3] &amp; 0x7F;<br />
    char buf[80];<br />
    snprintf(buf, sizeof(buf), "DPT10 Zeit : %02d:%02d:%02d  /  DPT11 Datum : %02d.%02d.20%02d",<br />
             h, mnt, s, day, month, year);<br />
    return prefix + String(buf);<br />
  }<br />
  else if (len == 5) {<br />
    float f = dpt14ToFloat(data[1], data[2], data[3], data[4]);<br />
    return prefix + "DPT14: " + String(f, 3);<br />
  }<br />
  else if (len == 15) {<br />
    char txt[15];<br />
    for (int i = 0; i &lt; 14; i++) {<br />
      uint8_t c = data[1 + i];<br />
      txt[i] = (c &gt;= 32 &amp;&amp; c &lt; 127) ? (char)c : (c == 0 ? 0 : '.');<br />
    }<br />
    txt[14] = 0;<br />
    return prefix + "DPT16: &#92;"" + String(txt) + "&#92;"";<br />
  }<br />
  return prefix + "Unbekannt (" + String(len) + " Byte)";<br />
}<br />
<br />
void addKnxLogEntry(uint16_t ga, uint8_t* rxBuf, uint8_t npduLen) {<br />
  KnxLogEntry &amp;e = knxLog[knxLogNext];<br />
  String t = getFormattedDateTime();<br />
  strncpy(e.timeStr, t.c_str(), sizeof(e.timeStr) - 1);<br />
  e.timeStr[sizeof(e.timeStr) - 1] = 0;<br />
  e.ga = ga;<br />
  uint8_t copyLen = npduLen;<br />
  if (copyLen &gt; sizeof(e.data)) copyLen = sizeof(e.data);<br />
  memcpy(e.data, &amp;rxBuf[20], copyLen);<br />
  e.len = copyLen;<br />
<br />
  knxLogNext = (knxLogNext + 1) % KNX_LOG_SIZE;<br />
  if (knxLogFilled &lt; KNX_LOG_SIZE) knxLogFilled++;<br />
}<br />
<br />
uint16_t processIncomingPacket(uint8_t* rxBuf, int len) {<br />
  if (len &lt; 6) return 0;<br />
  uint16_t serviceType = (rxBuf[2] &lt;&lt; 8) | rxBuf[3];<br />
  hexDump("[KNX RX]", rxBuf, len);<br />
<br />
  switch (serviceType) {<br />
    case 0x0421:<br />
      if (len &gt;= 10) {<br />
        Serial.printf("   -&gt; TUNNELING_ACK | Channel : %d | Seq : %d | Status : 0x%02X (%s)&#92;n",<br />
                      rxBuf[7], rxBuf[8], rxBuf[9], knxStatusToString(rxBuf[9]));<br />
      }<br />
      break;<br />
<br />
    case 0x0420:<br />
      if (len &gt;= 21) {<br />
        uint8_t rxChannel = rxBuf[7];<br />
        uint8_t rxSeqNum  = rxBuf[8];<br />
        uint16_t ga = ((uint16_t)rxBuf[16] &lt;&lt; 8) | rxBuf[17];<br />
        uint8_t npduLen = rxBuf[18];<br />
        Serial.printf("   -&gt; TUNNELING_REQUEST (Bus Telegramm) | Channel : %d | Seq : %d | GA : %s&#92;n",<br />
                      rxChannel, rxSeqNum, gaToString(ga).c_str());<br />
        Serial.println("      " + interpretKnxData(&amp;rxBuf[20], npduLen));<br />
<br />
        if (rxChannel == knxChannelId) {<br />
          addKnxLogEntry(ga, rxBuf, npduLen);<br />
<br />
          uint8_t ackBuf[10] = {<br />
            0x06, 0x10, 0x04, 0x21, 0x00, 0x0A, 0x04, knxChannelId, rxSeqNum, 0x00<br />
          };<br />
          udp.beginPacket(knxGatewayIp, knxPort);<br />
          udp.write(ackBuf, sizeof(ackBuf));<br />
          udp.endPacket();<br />
          hexDump("[KNX TX] ACK an Bus Telegramm", ackBuf, sizeof(ackBuf));<br />
        }<br />
      }<br />
      break;<br />
<br />
    case 0x0208:<br />
      if (len &gt;= 8) {<br />
        Serial.printf("   -&gt; CONNECTIONSTATE_RESPONSE | Status : 0x%02X (%s)&#92;n", rxBuf[7], knxStatusToString(rxBuf[7]));<br />
        if (rxBuf[7] != 0x00) {<br />
          Serial.println("   !!! Heartbeat fehlgeschlagen -&gt; Tunnel als getrennt markiert !!!");<br />
          isKnxConnected = false;<br />
        }<br />
      }<br />
      break;<br />
<br />
    case 0x0209:<br />
      if (len &gt;= 8) {<br />
        uint8_t rxChannel = rxBuf[6];<br />
        Serial.printf("   -&gt; DISCONNECT_REQUEST vom Gateway | Channel: %d&#92;n", rxChannel);<br />
        if (rxChannel == knxChannelId) {<br />
          uint8_t discResp[8] = { 0x06, 0x10, 0x02, 0x0A, 0x00, 0x08, knxChannelId, 0x00 };<br />
          udp.beginPacket(knxGatewayIp, knxPort);<br />
          udp.write(discResp, sizeof(discResp));<br />
          udp.endPacket();<br />
          hexDump("[KNX TX] DISCONNECT_RESPONSE", discResp, sizeof(discResp));<br />
          isKnxConnected = false;<br />
        }<br />
      }<br />
      break;<br />
<br />
    default:<br />
      Serial.printf("   -&gt; Unbehandelter ServiceType: 0x%04X&#92;n", serviceType);<br />
      break;<br />
  }<br />
  return serviceType;<br />
}<br />
<br />
bool connectKnx() {<br />
  Serial.println("[KNX] Sende CONNECT_REQUEST an Gateway...");<br />
<br />
  IPAddress myIp = WiFi.localIP();<br />
  Serial.printf("   Lokale IP/Port die wir dem Gateway melden : %s:%d&#92;n", myIp.toString().c_str(), localPort);<br />
  Serial.printf("   Ziel Gateway: %s:%d&#92;n", knxGatewayIp, knxPort);<br />
<br />
  uint8_t connReq[] = {<br />
    0x06, 0x10, 0x02, 0x05, 0x00, 0x1A,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF),<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF),<br />
    0x04, 0x04, 0x02, 0x00<br />
  };<br />
  hexDump("[KNX TX] CONNECT_REQUEST", connReq, sizeof(connReq));<br />
<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(connReq, sizeof(connReq));<br />
  udp.endPacket();<br />
<br />
  unsigned long start = millis();<br />
  while (millis() - start &lt; 2000) {<br />
    int size = udp.parsePacket();<br />
    if (size &gt;= 8) {<br />
      uint8_t resp[32];<br />
      int rlen = udp.read(resp, sizeof(resp));<br />
      hexDump("[KNX RX] CONNECT_RESPONSE", resp, rlen);<br />
<br />
      if (resp[2] == 0x02 &amp;&amp; resp[3] == 0x06) {<br />
        if (resp[7] == 0x00) {<br />
          knxChannelId = resp[6];<br />
          txSeqNum = 0;<br />
          isKnxConnected = true;<br />
          lastHeartbeat = millis();<br />
          Serial.printf("ERFOLGREICH! Channel ID : %d&#92;n", knxChannelId);<br />
<br />
          if (rlen &gt;= 16 &amp;&amp; resp[8] == 0x08) {<br />
            IPAddress dataIp(resp[10], resp[11], resp[12], resp[13]);<br />
            uint16_t dataPort = (resp[14] &lt;&lt; 8) | resp[15];<br />
            Serial.printf("   [Info] Gateway Data-Endpoint laut CONNECT_RESPONSE: %s:%d&#92;n",<br />
                          dataIp.toString().c_str(), dataPort);<br />
          }<br />
          return true;<br />
        } else {<br />
          Serial.printf("FEHLER! Status Code: 0x%02X (%s)&#92;n", resp[7], knxStatusToString(resp[7]));<br />
          return false;<br />
        }<br />
      }<br />
    }<br />
    delay(10);<br />
  }<br />
  Serial.println("TIMEOUT! Keine CONNECT_RESPONSE vom Gateway erhalten.");<br />
  isKnxConnected = false;<br />
  return false;<br />
}<br />
<br />
void sendConnectionStateRequest() {<br />
  IPAddress myIp = WiFi.localIP();<br />
  uint8_t req[16] = {<br />
    0x06, 0x10, 0x02, 0x07, 0x00, 0x10,<br />
    knxChannelId, 0x00,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF)<br />
  };<br />
  hexDump("[KNX TX] CONNECTIONSTATE_REQUEST (Heartbeat)", req, sizeof(req));<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(req, sizeof(req));<br />
  udp.endPacket();<br />
}<br />
<br />
void disconnectKnx() {<br />
  if (!isKnxConnected) return;<br />
  IPAddress myIp = WiFi.localIP();<br />
  uint8_t req[16] = {<br />
    0x06, 0x10, 0x02, 0x09, 0x00, 0x10,<br />
    knxChannelId, 0x00,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF)<br />
  };<br />
  hexDump("[KNX TX] DISCONNECT_REQUEST", req, sizeof(req));<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(req, sizeof(req));<br />
  udp.endPacket();<br />
  isKnxConnected = false;<br />
}<br />
<br />
void handleKnxRx() {<br />
  int packetSize = udp.parsePacket();<br />
  if (packetSize &lt;= 0) return;<br />
  uint8_t rxBuf[64];<br />
  int len = udp.read(rxBuf, sizeof(rxBuf));<br />
  processIncomingPacket(rxBuf, len);<br />
}<br />
<br />
bool sendKnxValue(String groupAddress, String dptType, String rawValue) {<br />
  if (!isKnxConnected) {<br />
    if (!connectKnx()) return false;<br />
  }<br />
<br />
  uint16_t ga = parseGroupAddress(groupAddress);<br />
  uint8_t buf[64];<br />
  uint8_t payloadLen = 0;<br />
<br />
  buf[0] = 0x06; buf[1] = 0x10;<br />
  buf[2] = 0x04; buf[3] = 0x20;<br />
  buf[4] = 0x00; buf[5] = 0x00;<br />
<br />
  buf[6] = 0x04;<br />
  buf[7] = knxChannelId;<br />
  buf[8] = txSeqNum;<br />
  buf[9] = 0x00;<br />
<br />
  buf[10] = 0x11;<br />
  buf[11] = 0x00;<br />
  buf[12] = 0xBC;<br />
  buf[13] = 0xE0;<br />
  buf[14] = 0x00; buf[15] = 0x00;<br />
  buf[16] = (uint8_t)(ga &gt;&gt; 8);<br />
  buf[17] = (uint8_t)(ga &amp; 0xFF);<br />
<br />
  if (dptType == "DPT1") {<br />
    buf[18] = 0x01;<br />
    buf[19] = 0x00;<br />
    buf[20] = (rawValue.toInt() &gt; 0) ? 0x81 : 0x80;<br />
    payloadLen = 21;<br />
  }<br />
  else if (dptType == "DPT5") {<br />
    buf[18] = 0x02;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)rawValue.toInt();<br />
    payloadLen = 22;<br />
  }<br />
  else if (dptType == "DPT9") {<br />
    uint16_t dpt9Val = floatToDpt9(rawValue.toFloat());<br />
    buf[18] = 0x03;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(dpt9Val &gt;&gt; 8);<br />
    buf[22] = (uint8_t)(dpt9Val &amp; 0xFF);<br />
    payloadLen = 23;<br />
  }<br />
  else if (dptType == "DPT10") {<br />
    int h = 0, m = 0, s = 0;<br />
    int c1 = rawValue.indexOf(':');<br />
    if (c1 == -1) {<br />
      h = rawValue.toInt();<br />
    } else {<br />
      h = rawValue.substring(0, c1).toInt();<br />
      int c2 = rawValue.indexOf(':', c1 + 1);<br />
      if (c2 == -1) {<br />
        m = rawValue.substring(c1 + 1).toInt();<br />
      } else {<br />
        m = rawValue.substring(c1 + 1, c2).toInt();<br />
        s = rawValue.substring(c2 + 1).toInt();<br />
      }<br />
    }<br />
    buf[18] = 0x04;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(h &amp; 0x1F);<br />
    buf[22] = (uint8_t)(m &amp; 0x3F);<br />
    buf[23] = (uint8_t)(s &amp; 0x3F);<br />
    payloadLen = 24;<br />
  }<br />
  else if (dptType == "DPT11") {<br />
    int day = 1, month = 1, year = 26;<br />
    int p1 = rawValue.indexOf('.');<br />
    if (p1 != -1) {<br />
      day = rawValue.substring(0, p1).toInt();<br />
      int p2 = rawValue.indexOf('.', p1 + 1);<br />
      if (p2 != -1) {<br />
        month = rawValue.substring(p1 + 1, p2).toInt();<br />
        int y = rawValue.substring(p2 + 1).toInt();<br />
        year = (y &gt;= 2000) ? (y - 2000) : y;<br />
      }<br />
    } else {<br />
      day = rawValue.toInt();<br />
    }<br />
    buf[18] = 0x04;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(day &amp; 0x1F);<br />
    buf[22] = (uint8_t)(month &amp; 0x0F);<br />
    buf[23] = (uint8_t)(year &amp; 0x7F);<br />
    payloadLen = 24;<br />
  }<br />
  else if (dptType == "DPT14") {<br />
    uint8_t db[4];<br />
    floatToDpt14Bytes(rawValue.toFloat(), db);<br />
    buf[18] = 0x05;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = db[0];<br />
    buf[22] = db[1];<br />
    buf[23] = db[2];<br />
    buf[24] = db[3];<br />
    payloadLen = 25;<br />
  }<br />
  else if (dptType == "DPT16") {<br />
    uint8_t strLen = rawValue.length();<br />
    if (strLen &gt; 14) strLen = 14;<br />
<br />
    buf[18] = 15;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    for (int i = 0; i &lt; 14; i++) {<br />
      buf[21 + i] = (i &lt; strLen) ? rawValue[i] : 0x00;<br />
    }<br />
    payloadLen = 21 + 14;<br />
  }<br />
  else {<br />
    Serial.println("[KNX TX] FEHLER - Unbekannter DPT Typ!");<br />
    return false;<br />
  }<br />
<br />
  buf[5] = payloadLen;<br />
<br />
  Serial.printf("[KNX TX] GA: %s (0x%04X) | DPT: %s | Val: %s | Seq: %d&#92;n",<br />
                groupAddress.c_str(), ga, dptType.c_str(), rawValue.c_str(), txSeqNum);<br />
  hexDump("[KNX TX] TUNNELING_REQUEST", buf, payloadLen);<br />
<br />
  uint8_t sentSeq = txSeqNum;<br />
<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(buf, payloadLen);<br />
  udp.endPacket();<br />
<br />
  txSeqNum++;<br />
<br />
  unsigned long waitStart = millis();<br />
  bool ackOk = false;<br />
  while (millis() - waitStart &lt; ACK_TIMEOUT) {<br />
    int packetSize = udp.parsePacket();<br />
    if (packetSize &gt; 0) {<br />
      uint8_t rxBuf[64];<br />
      int len = udp.read(rxBuf, sizeof(rxBuf));<br />
      uint16_t st = processIncomingPacket(rxBuf, len);<br />
      if (st == 0x0421 &amp;&amp; len &gt;= 9 &amp;&amp; rxBuf[8] == sentSeq) {<br />
        ackOk = (len &gt;= 10 &amp;&amp; rxBuf[9] == 0x00);<br />
        break;<br />
      }<br />
    }<br />
    delay(5);<br />
  }<br />
<br />
  if (!ackOk) {<br />
    Serial.println("!!! KEIN passendes TUNNELING_ACK erhalten (Timeout nach 1000ms) !!!");<br />
  }<br />
<br />
  return ackOk;<br />
}<br />
<br />
String escapeJson(String s) {<br />
  String out;<br />
  for (size_t i = 0; i &lt; s.length(); i++) {<br />
    char c = s[i];<br />
    if (c == '"' || c == '&#92;&#92;') out += '&#92;&#92;';<br />
    out += c;<br />
  }<br />
  return out;<br />
}<br />
<br />
void handleRoot() {<br />
  String html = "&lt;html&gt;&lt;head&gt;&lt;meta charset='UTF-8'&gt;";<br />
  html += "&lt;title&gt;" + String(projectName) + "&lt;/title&gt;";<br />
  html += "&lt;style&gt;body{font-family:Arial,sans-serif;margin:20px;background:#f4f4f9;color:#333}";<br />
  html += ".card{background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 5px rgba(0,0,0,0.1);max-width:650px;margin:auto}";<br />
  html += "h1{text-align:center;margin-bottom:2px;}";<br />
  html += "#dtNow{text-align:center;color:#666;margin-top:0;margin-bottom:16px;font-size:14px;}";<br />
  html += "input,select,button{width:100%;padding:10px;margin:10px 0;box-sizing:border-box;border:1px solid #ccc;border-radius:4px;font-size:16px}";<br />
  html += "button{background:#007bff;color:#fff;font-weight:bold;border:none;cursor:pointer}button:hover{background:#0056b3}";<br />
  html += "#statusMsg{margin-top:10px;font-weight:bold;color:#28a745;text-align:center;}";<br />
  html += "table{width:100%;border-collapse:collapse;font-size:13px;margin-top:10px;}";<br />
  html += "th,td{border-bottom:1px solid #eee;padding:6px 4px;text-align:left;}";<br />
  html += "th{background:#f0f0f5;}";<br />
  html += "&lt;/style&gt;&lt;/head&gt;&lt;body&gt;";<br />
<br />
  html += "&lt;div class='card'&gt;";<br />
  html += "&lt;h1&gt;" + String(projectName) + "&lt;/h1&gt;";<br />
  html += "&lt;p id='dtNow'&gt;...&lt;/p&gt;";<br />
  html += "&lt;p&gt;KNX Status: &lt;span id='knxStatus'&gt;" + String(isKnxConnected ? "&lt;b style='color:green;'&gt;Verbunden (Channel " + String(knxChannelId) + ")" : "Getrennt") + "";<br />
<br />
  html += "&lt;label&gt;Gruppenadresse (z.B. 1/0/0):&lt;/label&gt;";<br />
  html += "&lt;input type='text' id='ga' value='1/0/0'&gt;";<br />
<br />
  html += "&lt;label&gt;Datenpunkttyp (DPT):&lt;/label&gt;";<br />
  html += "&lt;select id='dpt'&gt;";<br />
  html += "&lt;option value='DPT1'&gt;DPT 1 (1 Bit Schalten 0/1)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT5'&gt;DPT 5 (1 Byte Wert 0..255)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT9'&gt;DPT 9 (2 Byte Float Temp/Wert)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT10'&gt;DPT 10 (Zeit, z.B. 14:30:00)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT11'&gt;DPT 11 (Datum, z.B. 24.12.26)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT14'&gt;DPT 14 (4 Byte Float IEEE754)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT16'&gt;DPT 16 (14 Byte Text)&lt;/option&gt;";<br />
  html += "&lt;/select&gt;";<br />
<br />
  html += "&lt;label&gt;Wert / Payload:&lt;/label&gt;";<br />
  html += "&lt;input type='text' id='val' value='1' placeholder='z.B. 1, 128, 21.5, 14:30:00, 24.12.26 oder Text'&gt;";<br />
<br />
  html += "&lt;button type='button' onclick='sendTelegram()'&gt;KNX Telegramm Senden&lt;/button&gt;";<br />
  html += "&lt;button type='button' onclick='reconnectKnx()' style='background:#6c757d;'&gt;KNX Reconnect&lt;/button&gt;";<br />
  html += "&lt;div id='statusMsg'&gt;&lt;/div&gt;";<br />
<br />
  html += "&lt;h3&gt;Letzte empfangene Telegramme&lt;/h3&gt;";<br />
  html += "&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Zeit&lt;/th&gt;&lt;th&gt;GA&lt;/th&gt;&lt;th&gt;Bytes&lt;/th&gt;&lt;th&gt;Hex&lt;/th&gt;&lt;th&gt;Wert&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;";<br />
  html += "&lt;tbody id='logBody'&gt;Lade...&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;";<br />
<br />
  html += "&lt;/div&gt;";<br />
<br />
  html += "&lt;script&gt;";<br />
  html += "function sendTelegram(){";<br />
  html += "  var ga = document.getElementById('ga').value;";<br />
  html += "  var dpt = document.getElementById('dpt').value;";<br />
  html += "  var val = document.getElementById('val').value;";<br />
  html += "  document.getElementById('statusMsg').innerText = 'Sende...';";<br />
  html += "  fetch('/send?ga=' + encodeURIComponent(ga) + '&amp;dpt=' + encodeURIComponent(dpt) + '&amp;val=' + encodeURIComponent(val))";<br />
  html += "  .then(response =&gt; response.text())";<br />
  html += "  .then(data =&gt; { document.getElementById('statusMsg').innerText = data; })";<br />
  html += "  .catch(err =&gt; { document.getElementById('statusMsg').innerText = 'Fehler beim Senden!'; });";<br />
  html += "}";<br />
  html += "function reconnectKnx(){";<br />
  html += "  fetch('/reconnect').then(r=&gt;r.text()).then(d=&gt;{ updateStatus(); });";<br />
  html += "}";<br />
  html += "function updateStatus(){";<br />
  html += "  fetch('/status').then(r=&gt;r.json()).then(d=&gt;{";<br />
  html += "    document.getElementById('dtNow').innerText = d.datetime;";<br />
  html += "    document.getElementById('knxStatus').innerHTML = d.connected ? (&#92;"&lt;b style='color:green;'&gt;Verbunden (Channel &#92;" + d.channel + &#92;")&lt;/b&gt;&#92;") : &#92;"&lt;b style='color:red;'&gt;Getrennt&lt;/b&gt;&#92;";";<br />
  html += "    var rows = '';";<br />
  html += "    d.log.forEach(function(e){ rows += '&lt;tr&gt;&lt;td&gt;'+e.time+'&lt;/td&gt;&lt;td&gt;'+e.ga+'&lt;/td&gt;&lt;td&gt;'+e.len+'&lt;/td&gt;&lt;td&gt;'+e.hex+'&lt;/td&gt;&lt;td&gt;'+e.value+'&lt;/td&gt;&lt;/tr&gt;'; });";<br />
  html += "    document.getElementById('logBody').innerHTML = rows || '&lt;tr&gt;&lt;td colspan=5&gt;Noch keine Telegramme empfangen&lt;/td&gt;&lt;/tr&gt;';";<br />
  html += "  }).catch(function(){});";<br />
  html += "}";<br />
  html += "setInterval(updateStatus, 1000);";<br />
  html += "updateStatus();";<br />
  html += "&lt;/script&gt;";<br />
<br />
  html += "&lt;/body&gt;&lt;/html&gt;";<br />
  server.send(200, "text/html", html);<br />
}<br />
<br />
void handleSend() {<br />
  if (server.hasArg("ga") &amp;&amp; server.hasArg("dpt") &amp;&amp; server.hasArg("val")) {<br />
    String ga = server.arg("ga");<br />
    String dpt = server.arg("dpt");<br />
    String val = server.arg("val");<br />
<br />
    bool ok = sendKnxValue(ga, dpt, val);<br />
    server.send(200, "text/plain", ok ? "Telegramm gesendet und per ACK bestaetigt!" : "Gesendet, aber KEIN ACK erhalten, siehe Serial Monitor!");<br />
  } else {<br />
    server.send(400, "text/plain", "Fehlende Parameter!");<br />
  }<br />
}<br />
<br />
void handleReconnect() {<br />
  connectKnx();<br />
  server.send(200, "text/plain", "Reconnected!");<br />
}<br />
<br />
void handleStatus() {<br />
  String json = "{";<br />
  json += "&#92;"project&#92;":&#92;"" + escapeJson(String(projectName)) + "&#92;",";<br />
  json += "&#92;"datetime&#92;":&#92;"" + escapeJson(getFormattedDateTime()) + "&#92;",";<br />
  json += "&#92;"connected&#92;":" + String(isKnxConnected ? "true" : "false") + ",";<br />
  json += "&#92;"channel&#92;":" + String(knxChannelId) + ",";<br />
  json += "&#92;"log&#92;":[";<br />
<br />
  for (int i = 0; i &lt; knxLogFilled; i++) {<br />
    int idx = (knxLogNext - 1 - i + KNX_LOG_SIZE) % KNX_LOG_SIZE;<br />
    KnxLogEntry &amp;e = knxLog[idx];<br />
<br />
    String hex = "";<br />
    for (int b = 0; b &lt; e.len; b++) {<br />
      char hb[4];<br />
      snprintf(hb, sizeof(hb), "%02X ", e.data[b]);<br />
      hex += hb;<br />
    }<br />
    hex.trim();<br />
<br />
    if (i &gt; 0) json += ",";<br />
    json += "{";<br />
    json += "&#92;"time&#92;":&#92;"" + escapeJson(String(e.timeStr)) + "&#92;",";<br />
    json += "&#92;"ga&#92;":&#92;"" + escapeJson(gaToString(e.ga)) + "&#92;",";<br />
    json += "&#92;"len&#92;":" + String(e.len) + ",";<br />
    json += "&#92;"hex&#92;":&#92;"" + escapeJson(hex) + "&#92;",";<br />
    json += "&#92;"value&#92;":&#92;"" + escapeJson(interpretKnxData(e.data, e.len)) + "&#92;"";<br />
    json += "}";<br />
  }<br />
  json += "]}";<br />
  server.send(200, "application/json", json);<br />
}<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  delay(1000);<br />
<br />
  Serial.printf("&#92;n===&gt; %s &lt;===&#92;n", projectName);<br />
<br />
  WiFi.begin(ssid, password);<br />
  while (WiFi.status() != WL_CONNECTED) {<br />
    delay(500);<br />
    Serial.print(".");<br />
  }<br />
<br />
  Serial.println("&#92;nWLAN Verbunden!");<br />
  Serial.print("IP Adresse - "); Serial.println(WiFi.localIP());<br />
  Serial.print("RSSI: "); Serial.println(WiFi.RSSI());<br />
<br />
  configTzTime(tzInfo, ntpServer);<br />
  Serial.println("Warte auf Zeitsynchronisation (NTP)...");<br />
  struct tm timeinfo;<br />
  if (getLocalTime(&amp;timeinfo, 5000)) {<br />
    Serial.println("Zeit synchronisiert - " + getFormattedDateTime());<br />
  } else {<br />
    Serial.println("Zeit konnte nicht synchronisiert werden (wird spaeter automatisch nachgeholt).");<br />
  }<br />
<br />
  udp.begin(localPort);<br />
<br />
  connectKnx();<br />
<br />
  server.on("/", handleRoot);<br />
  server.on("/send", handleSend);<br />
  server.on("/reconnect", handleReconnect);<br />
  server.on("/status", handleStatus);<br />
  server.begin();<br />
}<br />
<br />
void loop() {<br />
  server.handleClient();<br />
  handleKnxRx();<br />
<br />
  if (isKnxConnected &amp;&amp; (millis() - lastHeartbeat &gt; HEARTBEAT_INTERVAL)) {<br />
    sendConnectionStateRequest();<br />
    lastHeartbeat = millis();<br />
  }<br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[Bonjour à tous,<br />
<br />
Je souhaite mettre à votre disposition ce code qui permet de communiquer avec KNX sur un ESP32 sans aucune bibliothèque supplémentaire. Il peut aussi bien envoyer que recevoir les télégrammes les plus courants.<br />
<br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>#include &lt;WiFi.h&gt;<br />
#include &lt;WiFiUdp.h&gt;<br />
#include &lt;WebServer.h&gt;<br />
#include &lt;time.h&gt;<br />
<br />
<br />
const char* projectName  = "KNX Stack";<br />
<br />
const char* ssid         = "WLAN SSID";<br />
const char* password     = "WLAN Passwort";<br />
<br />
const char* ntpServer    = "pool.ntp.org";<br />
const char* tzInfo       = "CET-1CEST,M3.5.0,M10.5.0/3";<br />
<br />
const char* knxGatewayIp = "IP KNX Gateway";<br />
const uint16_t knxPort   = 3671;<br />
const uint16_t localPort = 3671;<br />
<br />
WiFiUDP udp;<br />
WebServer server(80);<br />
<br />
uint8_t knxChannelId     = 0;<br />
uint8_t txSeqNum         = 0;<br />
bool isKnxConnected      = false;<br />
<br />
unsigned long lastHeartbeat = 0;<br />
const unsigned long HEARTBEAT_INTERVAL = 60000;<br />
const unsigned long ACK_TIMEOUT        = 1000;<br />
<br />
#define KNX_LOG_SIZE 10<br />
struct KnxLogEntry {<br />
  char timeStr[24];<br />
  uint16_t ga;<br />
  uint8_t data[16];<br />
  uint8_t len;<br />
};<br />
<br />
KnxLogEntry knxLog[KNX_LOG_SIZE];<br />
int knxLogNext = 0;<br />
int knxLogFilled = 0;<br />
<br />
void hexDump(const char* label, const uint8_t* buf, int len) {<br />
  Serial.printf("%s [%d Bytes]: ", label, len);<br />
  for (int i = 0; i &lt; len; i++) {<br />
    Serial.printf("%02X ", buf[i]);<br />
  }<br />
  Serial.println();<br />
}<br />
<br />
const char* knxStatusToString(uint8_t status) {<br />
  switch (status) {<br />
    case 0x00: return "E_NO_ERROR";<br />
    case 0x01: return "E_HOST_PROTOCOL_TYPE";<br />
    case 0x02: return "E_VERSION_NOT_SUPPORTED";<br />
    case 0x04: return "E_SEQUENCE_NUMBER (Sequenznummer falsch/ausser Sync)";<br />
    case 0x21: return "E_CONNECTION_ID (unbekannte Channel ID)";<br />
    case 0x22: return "E_CONNECTION_TYPE";<br />
    case 0x23: return "E_CONNECTION_OPTION";<br />
    case 0x24: return "E_NO_MORE_CONNECTIONS (Gateway voll)";<br />
    case 0x26: return "E_DATA_CONNECTION";<br />
    case 0x27: return "E_KNX_CONNECTION";<br />
    case 0x29: return "E_TUNNELING_LAYER (nicht unterstuetzt)";<br />
    default:   return "Unbekannter Statuscode";<br />
  }<br />
}<br />
<br />
String getFormattedDateTime() {<br />
  struct tm timeinfo;<br />
  if (!getLocalTime(&amp;timeinfo, 100)) {<br />
    return "Zeit nicht synchronisiert";<br />
  }<br />
  char buf[32];<br />
  strftime(buf, sizeof(buf), "%d.%m.%Y %H:%M:%S", &amp;timeinfo);<br />
  return String(buf);<br />
}<br />
<br />
uint16_t parseGroupAddress(const String&amp; gaStr) {<br />
  int firstSlash  = gaStr.indexOf('/');<br />
  int secondSlash = gaStr.indexOf('/', firstSlash + 1);<br />
  if (firstSlash == -1 || secondSlash == -1) return 0;<br />
<br />
  uint8_t main   = gaStr.substring(0, firstSlash).toInt();<br />
  uint8_t middle = gaStr.substring(firstSlash + 1, secondSlash).toInt();<br />
  uint8_t sub    = gaStr.substring(secondSlash + 1).toInt();<br />
<br />
  return ((main &amp; 0x1F) &lt;&lt; 11) | ((middle &amp; 0x07) &lt;&lt; 8) | (sub &amp; 0xFF);<br />
}<br />
<br />
String gaToString(uint16_t ga) {<br />
  uint8_t main   = (ga &gt;&gt; 11) &amp; 0x1F;<br />
  uint8_t middle = (ga &gt;&gt; 8) &amp; 0x07;<br />
  uint8_t sub    = ga &amp; 0xFF;<br />
  return String(main) + "/" + String(middle) + "/" + String(sub);<br />
}<br />
<br />
uint16_t floatToDpt9(float val) {<br />
  int sign = (val &lt; 0) ? 1 : 0;<br />
  float v = (sign == 1) ? -val : val;<br />
  int exp = 0;<br />
  int mantissa = (int)(v * 100.0f);<br />
  while (mantissa &gt; 2047) {<br />
    mantissa &gt;&gt;= 1;<br />
    exp++;<br />
  }<br />
  if (sign == 1) {<br />
    mantissa = -mantissa;<br />
    mantissa &amp;= 0x07FF;<br />
  }<br />
  return (sign &lt;&lt; 15) | ((exp &amp; 0x0F) &lt;&lt; 11) | (mantissa &amp; 0x07FF);<br />
}<br />
<br />
float dpt9ToFloat(uint8_t hi, uint8_t lo) {<br />
  uint16_t raw = ((uint16_t)hi &lt;&lt; 8) | lo;<br />
  int sign = (raw &gt;&gt; 15) &amp; 0x01;<br />
  int exp  = (raw &gt;&gt; 11) &amp; 0x0F;<br />
  int mantissa11 = raw &amp; 0x07FF;<br />
  int M = mantissa11 - (sign ? 2048 : 0);<br />
  return 0.01f * M * (float)(1 &lt;&lt; exp);<br />
}<br />
<br />
void floatToDpt14Bytes(float val, uint8_t* out4) {<br />
  uint8_t* p = (uint8_t*)&amp;val;<br />
  out4[0] = p[3];<br />
  out4[1] = p[2];<br />
  out4[2] = p[1];<br />
  out4[3] = p[0];<br />
}<br />
<br />
float dpt14ToFloat(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3) {<br />
  uint8_t bytes[4] = { b3, b2, b1, b0 };<br />
  float f;<br />
  memcpy(&amp;f, bytes, 4);<br />
  return f;<br />
}<br />
<br />
String apciTypeStr(uint8_t apciByte) {<br />
  switch (apciByte &amp; 0xC0) {<br />
    case 0x00: return "Read";<br />
    case 0x40: return "Response";<br />
    case 0x80: return "Write";<br />
    default:   return "?";<br />
  }<br />
}<br />
<br />
String interpretKnxData(uint8_t* data, uint8_t len) {<br />
  String prefix = "[" + apciTypeStr(data[0]) + "] ";<br />
<br />
  if (len == 1) {<br />
    bool bitVal = data[0] &amp; 0x01;<br />
    return prefix + "DPT1: " + (bitVal ? "EIN (1)" : "AUS (0)");<br />
  }<br />
  else if (len == 2) {<br />
    return prefix + "DPT5: " + String(data[1]) + " (0..255)";<br />
  }<br />
  else if (len == 3) {<br />
    float f = dpt9ToFloat(data[1], data[2]);<br />
    return prefix + "DPT9: " + String(f, 2);<br />
  }<br />
  else if (len == 4) {<br />
    uint8_t h = data[1] &amp; 0x1F, mnt = data[2] &amp; 0x3F, s = data[3] &amp; 0x3F;<br />
    uint8_t day = data[1] &amp; 0x1F, month = data[2] &amp; 0x0F, year = data[3] &amp; 0x7F;<br />
    char buf[80];<br />
    snprintf(buf, sizeof(buf), "DPT10 Zeit : %02d:%02d:%02d  /  DPT11 Datum : %02d.%02d.20%02d",<br />
             h, mnt, s, day, month, year);<br />
    return prefix + String(buf);<br />
  }<br />
  else if (len == 5) {<br />
    float f = dpt14ToFloat(data[1], data[2], data[3], data[4]);<br />
    return prefix + "DPT14: " + String(f, 3);<br />
  }<br />
  else if (len == 15) {<br />
    char txt[15];<br />
    for (int i = 0; i &lt; 14; i++) {<br />
      uint8_t c = data[1 + i];<br />
      txt[i] = (c &gt;= 32 &amp;&amp; c &lt; 127) ? (char)c : (c == 0 ? 0 : '.');<br />
    }<br />
    txt[14] = 0;<br />
    return prefix + "DPT16: &#92;"" + String(txt) + "&#92;"";<br />
  }<br />
  return prefix + "Unbekannt (" + String(len) + " Byte)";<br />
}<br />
<br />
void addKnxLogEntry(uint16_t ga, uint8_t* rxBuf, uint8_t npduLen) {<br />
  KnxLogEntry &amp;e = knxLog[knxLogNext];<br />
  String t = getFormattedDateTime();<br />
  strncpy(e.timeStr, t.c_str(), sizeof(e.timeStr) - 1);<br />
  e.timeStr[sizeof(e.timeStr) - 1] = 0;<br />
  e.ga = ga;<br />
  uint8_t copyLen = npduLen;<br />
  if (copyLen &gt; sizeof(e.data)) copyLen = sizeof(e.data);<br />
  memcpy(e.data, &amp;rxBuf[20], copyLen);<br />
  e.len = copyLen;<br />
<br />
  knxLogNext = (knxLogNext + 1) % KNX_LOG_SIZE;<br />
  if (knxLogFilled &lt; KNX_LOG_SIZE) knxLogFilled++;<br />
}<br />
<br />
uint16_t processIncomingPacket(uint8_t* rxBuf, int len) {<br />
  if (len &lt; 6) return 0;<br />
  uint16_t serviceType = (rxBuf[2] &lt;&lt; 8) | rxBuf[3];<br />
  hexDump("[KNX RX]", rxBuf, len);<br />
<br />
  switch (serviceType) {<br />
    case 0x0421:<br />
      if (len &gt;= 10) {<br />
        Serial.printf("   -&gt; TUNNELING_ACK | Channel : %d | Seq : %d | Status : 0x%02X (%s)&#92;n",<br />
                      rxBuf[7], rxBuf[8], rxBuf[9], knxStatusToString(rxBuf[9]));<br />
      }<br />
      break;<br />
<br />
    case 0x0420:<br />
      if (len &gt;= 21) {<br />
        uint8_t rxChannel = rxBuf[7];<br />
        uint8_t rxSeqNum  = rxBuf[8];<br />
        uint16_t ga = ((uint16_t)rxBuf[16] &lt;&lt; 8) | rxBuf[17];<br />
        uint8_t npduLen = rxBuf[18];<br />
        Serial.printf("   -&gt; TUNNELING_REQUEST (Bus Telegramm) | Channel : %d | Seq : %d | GA : %s&#92;n",<br />
                      rxChannel, rxSeqNum, gaToString(ga).c_str());<br />
        Serial.println("      " + interpretKnxData(&amp;rxBuf[20], npduLen));<br />
<br />
        if (rxChannel == knxChannelId) {<br />
          addKnxLogEntry(ga, rxBuf, npduLen);<br />
<br />
          uint8_t ackBuf[10] = {<br />
            0x06, 0x10, 0x04, 0x21, 0x00, 0x0A, 0x04, knxChannelId, rxSeqNum, 0x00<br />
          };<br />
          udp.beginPacket(knxGatewayIp, knxPort);<br />
          udp.write(ackBuf, sizeof(ackBuf));<br />
          udp.endPacket();<br />
          hexDump("[KNX TX] ACK an Bus Telegramm", ackBuf, sizeof(ackBuf));<br />
        }<br />
      }<br />
      break;<br />
<br />
    case 0x0208:<br />
      if (len &gt;= 8) {<br />
        Serial.printf("   -&gt; CONNECTIONSTATE_RESPONSE | Status : 0x%02X (%s)&#92;n", rxBuf[7], knxStatusToString(rxBuf[7]));<br />
        if (rxBuf[7] != 0x00) {<br />
          Serial.println("   !!! Heartbeat fehlgeschlagen -&gt; Tunnel als getrennt markiert !!!");<br />
          isKnxConnected = false;<br />
        }<br />
      }<br />
      break;<br />
<br />
    case 0x0209:<br />
      if (len &gt;= 8) {<br />
        uint8_t rxChannel = rxBuf[6];<br />
        Serial.printf("   -&gt; DISCONNECT_REQUEST vom Gateway | Channel: %d&#92;n", rxChannel);<br />
        if (rxChannel == knxChannelId) {<br />
          uint8_t discResp[8] = { 0x06, 0x10, 0x02, 0x0A, 0x00, 0x08, knxChannelId, 0x00 };<br />
          udp.beginPacket(knxGatewayIp, knxPort);<br />
          udp.write(discResp, sizeof(discResp));<br />
          udp.endPacket();<br />
          hexDump("[KNX TX] DISCONNECT_RESPONSE", discResp, sizeof(discResp));<br />
          isKnxConnected = false;<br />
        }<br />
      }<br />
      break;<br />
<br />
    default:<br />
      Serial.printf("   -&gt; Unbehandelter ServiceType: 0x%04X&#92;n", serviceType);<br />
      break;<br />
  }<br />
  return serviceType;<br />
}<br />
<br />
bool connectKnx() {<br />
  Serial.println("[KNX] Sende CONNECT_REQUEST an Gateway...");<br />
<br />
  IPAddress myIp = WiFi.localIP();<br />
  Serial.printf("   Lokale IP/Port die wir dem Gateway melden : %s:%d&#92;n", myIp.toString().c_str(), localPort);<br />
  Serial.printf("   Ziel Gateway: %s:%d&#92;n", knxGatewayIp, knxPort);<br />
<br />
  uint8_t connReq[] = {<br />
    0x06, 0x10, 0x02, 0x05, 0x00, 0x1A,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF),<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF),<br />
    0x04, 0x04, 0x02, 0x00<br />
  };<br />
  hexDump("[KNX TX] CONNECT_REQUEST", connReq, sizeof(connReq));<br />
<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(connReq, sizeof(connReq));<br />
  udp.endPacket();<br />
<br />
  unsigned long start = millis();<br />
  while (millis() - start &lt; 2000) {<br />
    int size = udp.parsePacket();<br />
    if (size &gt;= 8) {<br />
      uint8_t resp[32];<br />
      int rlen = udp.read(resp, sizeof(resp));<br />
      hexDump("[KNX RX] CONNECT_RESPONSE", resp, rlen);<br />
<br />
      if (resp[2] == 0x02 &amp;&amp; resp[3] == 0x06) {<br />
        if (resp[7] == 0x00) {<br />
          knxChannelId = resp[6];<br />
          txSeqNum = 0;<br />
          isKnxConnected = true;<br />
          lastHeartbeat = millis();<br />
          Serial.printf("ERFOLGREICH! Channel ID : %d&#92;n", knxChannelId);<br />
<br />
          if (rlen &gt;= 16 &amp;&amp; resp[8] == 0x08) {<br />
            IPAddress dataIp(resp[10], resp[11], resp[12], resp[13]);<br />
            uint16_t dataPort = (resp[14] &lt;&lt; 8) | resp[15];<br />
            Serial.printf("   [Info] Gateway Data-Endpoint laut CONNECT_RESPONSE: %s:%d&#92;n",<br />
                          dataIp.toString().c_str(), dataPort);<br />
          }<br />
          return true;<br />
        } else {<br />
          Serial.printf("FEHLER! Status Code: 0x%02X (%s)&#92;n", resp[7], knxStatusToString(resp[7]));<br />
          return false;<br />
        }<br />
      }<br />
    }<br />
    delay(10);<br />
  }<br />
  Serial.println("TIMEOUT! Keine CONNECT_RESPONSE vom Gateway erhalten.");<br />
  isKnxConnected = false;<br />
  return false;<br />
}<br />
<br />
void sendConnectionStateRequest() {<br />
  IPAddress myIp = WiFi.localIP();<br />
  uint8_t req[16] = {<br />
    0x06, 0x10, 0x02, 0x07, 0x00, 0x10,<br />
    knxChannelId, 0x00,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF)<br />
  };<br />
  hexDump("[KNX TX] CONNECTIONSTATE_REQUEST (Heartbeat)", req, sizeof(req));<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(req, sizeof(req));<br />
  udp.endPacket();<br />
}<br />
<br />
void disconnectKnx() {<br />
  if (!isKnxConnected) return;<br />
  IPAddress myIp = WiFi.localIP();<br />
  uint8_t req[16] = {<br />
    0x06, 0x10, 0x02, 0x09, 0x00, 0x10,<br />
    knxChannelId, 0x00,<br />
    0x08, 0x01, myIp[0], myIp[1], myIp[2], myIp[3], (uint8_t)(localPort &gt;&gt; 8), (uint8_t)(localPort &amp; 0xFF)<br />
  };<br />
  hexDump("[KNX TX] DISCONNECT_REQUEST", req, sizeof(req));<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(req, sizeof(req));<br />
  udp.endPacket();<br />
  isKnxConnected = false;<br />
}<br />
<br />
void handleKnxRx() {<br />
  int packetSize = udp.parsePacket();<br />
  if (packetSize &lt;= 0) return;<br />
  uint8_t rxBuf[64];<br />
  int len = udp.read(rxBuf, sizeof(rxBuf));<br />
  processIncomingPacket(rxBuf, len);<br />
}<br />
<br />
bool sendKnxValue(String groupAddress, String dptType, String rawValue) {<br />
  if (!isKnxConnected) {<br />
    if (!connectKnx()) return false;<br />
  }<br />
<br />
  uint16_t ga = parseGroupAddress(groupAddress);<br />
  uint8_t buf[64];<br />
  uint8_t payloadLen = 0;<br />
<br />
  buf[0] = 0x06; buf[1] = 0x10;<br />
  buf[2] = 0x04; buf[3] = 0x20;<br />
  buf[4] = 0x00; buf[5] = 0x00;<br />
<br />
  buf[6] = 0x04;<br />
  buf[7] = knxChannelId;<br />
  buf[8] = txSeqNum;<br />
  buf[9] = 0x00;<br />
<br />
  buf[10] = 0x11;<br />
  buf[11] = 0x00;<br />
  buf[12] = 0xBC;<br />
  buf[13] = 0xE0;<br />
  buf[14] = 0x00; buf[15] = 0x00;<br />
  buf[16] = (uint8_t)(ga &gt;&gt; 8);<br />
  buf[17] = (uint8_t)(ga &amp; 0xFF);<br />
<br />
  if (dptType == "DPT1") {<br />
    buf[18] = 0x01;<br />
    buf[19] = 0x00;<br />
    buf[20] = (rawValue.toInt() &gt; 0) ? 0x81 : 0x80;<br />
    payloadLen = 21;<br />
  }<br />
  else if (dptType == "DPT5") {<br />
    buf[18] = 0x02;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)rawValue.toInt();<br />
    payloadLen = 22;<br />
  }<br />
  else if (dptType == "DPT9") {<br />
    uint16_t dpt9Val = floatToDpt9(rawValue.toFloat());<br />
    buf[18] = 0x03;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(dpt9Val &gt;&gt; 8);<br />
    buf[22] = (uint8_t)(dpt9Val &amp; 0xFF);<br />
    payloadLen = 23;<br />
  }<br />
  else if (dptType == "DPT10") {<br />
    int h = 0, m = 0, s = 0;<br />
    int c1 = rawValue.indexOf(':');<br />
    if (c1 == -1) {<br />
      h = rawValue.toInt();<br />
    } else {<br />
      h = rawValue.substring(0, c1).toInt();<br />
      int c2 = rawValue.indexOf(':', c1 + 1);<br />
      if (c2 == -1) {<br />
        m = rawValue.substring(c1 + 1).toInt();<br />
      } else {<br />
        m = rawValue.substring(c1 + 1, c2).toInt();<br />
        s = rawValue.substring(c2 + 1).toInt();<br />
      }<br />
    }<br />
    buf[18] = 0x04;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(h &amp; 0x1F);<br />
    buf[22] = (uint8_t)(m &amp; 0x3F);<br />
    buf[23] = (uint8_t)(s &amp; 0x3F);<br />
    payloadLen = 24;<br />
  }<br />
  else if (dptType == "DPT11") {<br />
    int day = 1, month = 1, year = 26;<br />
    int p1 = rawValue.indexOf('.');<br />
    if (p1 != -1) {<br />
      day = rawValue.substring(0, p1).toInt();<br />
      int p2 = rawValue.indexOf('.', p1 + 1);<br />
      if (p2 != -1) {<br />
        month = rawValue.substring(p1 + 1, p2).toInt();<br />
        int y = rawValue.substring(p2 + 1).toInt();<br />
        year = (y &gt;= 2000) ? (y - 2000) : y;<br />
      }<br />
    } else {<br />
      day = rawValue.toInt();<br />
    }<br />
    buf[18] = 0x04;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = (uint8_t)(day &amp; 0x1F);<br />
    buf[22] = (uint8_t)(month &amp; 0x0F);<br />
    buf[23] = (uint8_t)(year &amp; 0x7F);<br />
    payloadLen = 24;<br />
  }<br />
  else if (dptType == "DPT14") {<br />
    uint8_t db[4];<br />
    floatToDpt14Bytes(rawValue.toFloat(), db);<br />
    buf[18] = 0x05;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    buf[21] = db[0];<br />
    buf[22] = db[1];<br />
    buf[23] = db[2];<br />
    buf[24] = db[3];<br />
    payloadLen = 25;<br />
  }<br />
  else if (dptType == "DPT16") {<br />
    uint8_t strLen = rawValue.length();<br />
    if (strLen &gt; 14) strLen = 14;<br />
<br />
    buf[18] = 15;<br />
    buf[19] = 0x00;<br />
    buf[20] = 0x80;<br />
    for (int i = 0; i &lt; 14; i++) {<br />
      buf[21 + i] = (i &lt; strLen) ? rawValue[i] : 0x00;<br />
    }<br />
    payloadLen = 21 + 14;<br />
  }<br />
  else {<br />
    Serial.println("[KNX TX] FEHLER - Unbekannter DPT Typ!");<br />
    return false;<br />
  }<br />
<br />
  buf[5] = payloadLen;<br />
<br />
  Serial.printf("[KNX TX] GA: %s (0x%04X) | DPT: %s | Val: %s | Seq: %d&#92;n",<br />
                groupAddress.c_str(), ga, dptType.c_str(), rawValue.c_str(), txSeqNum);<br />
  hexDump("[KNX TX] TUNNELING_REQUEST", buf, payloadLen);<br />
<br />
  uint8_t sentSeq = txSeqNum;<br />
<br />
  udp.beginPacket(knxGatewayIp, knxPort);<br />
  udp.write(buf, payloadLen);<br />
  udp.endPacket();<br />
<br />
  txSeqNum++;<br />
<br />
  unsigned long waitStart = millis();<br />
  bool ackOk = false;<br />
  while (millis() - waitStart &lt; ACK_TIMEOUT) {<br />
    int packetSize = udp.parsePacket();<br />
    if (packetSize &gt; 0) {<br />
      uint8_t rxBuf[64];<br />
      int len = udp.read(rxBuf, sizeof(rxBuf));<br />
      uint16_t st = processIncomingPacket(rxBuf, len);<br />
      if (st == 0x0421 &amp;&amp; len &gt;= 9 &amp;&amp; rxBuf[8] == sentSeq) {<br />
        ackOk = (len &gt;= 10 &amp;&amp; rxBuf[9] == 0x00);<br />
        break;<br />
      }<br />
    }<br />
    delay(5);<br />
  }<br />
<br />
  if (!ackOk) {<br />
    Serial.println("!!! KEIN passendes TUNNELING_ACK erhalten (Timeout nach 1000ms) !!!");<br />
  }<br />
<br />
  return ackOk;<br />
}<br />
<br />
String escapeJson(String s) {<br />
  String out;<br />
  for (size_t i = 0; i &lt; s.length(); i++) {<br />
    char c = s[i];<br />
    if (c == '"' || c == '&#92;&#92;') out += '&#92;&#92;';<br />
    out += c;<br />
  }<br />
  return out;<br />
}<br />
<br />
void handleRoot() {<br />
  String html = "&lt;html&gt;&lt;head&gt;&lt;meta charset='UTF-8'&gt;";<br />
  html += "&lt;title&gt;" + String(projectName) + "&lt;/title&gt;";<br />
  html += "&lt;style&gt;body{font-family:Arial,sans-serif;margin:20px;background:#f4f4f9;color:#333}";<br />
  html += ".card{background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 5px rgba(0,0,0,0.1);max-width:650px;margin:auto}";<br />
  html += "h1{text-align:center;margin-bottom:2px;}";<br />
  html += "#dtNow{text-align:center;color:#666;margin-top:0;margin-bottom:16px;font-size:14px;}";<br />
  html += "input,select,button{width:100%;padding:10px;margin:10px 0;box-sizing:border-box;border:1px solid #ccc;border-radius:4px;font-size:16px}";<br />
  html += "button{background:#007bff;color:#fff;font-weight:bold;border:none;cursor:pointer}button:hover{background:#0056b3}";<br />
  html += "#statusMsg{margin-top:10px;font-weight:bold;color:#28a745;text-align:center;}";<br />
  html += "table{width:100%;border-collapse:collapse;font-size:13px;margin-top:10px;}";<br />
  html += "th,td{border-bottom:1px solid #eee;padding:6px 4px;text-align:left;}";<br />
  html += "th{background:#f0f0f5;}";<br />
  html += "&lt;/style&gt;&lt;/head&gt;&lt;body&gt;";<br />
<br />
  html += "&lt;div class='card'&gt;";<br />
  html += "&lt;h1&gt;" + String(projectName) + "&lt;/h1&gt;";<br />
  html += "&lt;p id='dtNow'&gt;...&lt;/p&gt;";<br />
  html += "&lt;p&gt;KNX Status: &lt;span id='knxStatus'&gt;" + String(isKnxConnected ? "&lt;b style='color:green;'&gt;Verbunden (Channel " + String(knxChannelId) + ")" : "Getrennt") + "";<br />
<br />
  html += "&lt;label&gt;Gruppenadresse (z.B. 1/0/0):&lt;/label&gt;";<br />
  html += "&lt;input type='text' id='ga' value='1/0/0'&gt;";<br />
<br />
  html += "&lt;label&gt;Datenpunkttyp (DPT):&lt;/label&gt;";<br />
  html += "&lt;select id='dpt'&gt;";<br />
  html += "&lt;option value='DPT1'&gt;DPT 1 (1 Bit Schalten 0/1)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT5'&gt;DPT 5 (1 Byte Wert 0..255)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT9'&gt;DPT 9 (2 Byte Float Temp/Wert)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT10'&gt;DPT 10 (Zeit, z.B. 14:30:00)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT11'&gt;DPT 11 (Datum, z.B. 24.12.26)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT14'&gt;DPT 14 (4 Byte Float IEEE754)&lt;/option&gt;";<br />
  html += "&lt;option value='DPT16'&gt;DPT 16 (14 Byte Text)&lt;/option&gt;";<br />
  html += "&lt;/select&gt;";<br />
<br />
  html += "&lt;label&gt;Wert / Payload:&lt;/label&gt;";<br />
  html += "&lt;input type='text' id='val' value='1' placeholder='z.B. 1, 128, 21.5, 14:30:00, 24.12.26 oder Text'&gt;";<br />
<br />
  html += "&lt;button type='button' onclick='sendTelegram()'&gt;KNX Telegramm Senden&lt;/button&gt;";<br />
  html += "&lt;button type='button' onclick='reconnectKnx()' style='background:#6c757d;'&gt;KNX Reconnect&lt;/button&gt;";<br />
  html += "&lt;div id='statusMsg'&gt;&lt;/div&gt;";<br />
<br />
  html += "&lt;h3&gt;Letzte empfangene Telegramme&lt;/h3&gt;";<br />
  html += "&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Zeit&lt;/th&gt;&lt;th&gt;GA&lt;/th&gt;&lt;th&gt;Bytes&lt;/th&gt;&lt;th&gt;Hex&lt;/th&gt;&lt;th&gt;Wert&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;";<br />
  html += "&lt;tbody id='logBody'&gt;Lade...&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;";<br />
<br />
  html += "&lt;/div&gt;";<br />
<br />
  html += "&lt;script&gt;";<br />
  html += "function sendTelegram(){";<br />
  html += "  var ga = document.getElementById('ga').value;";<br />
  html += "  var dpt = document.getElementById('dpt').value;";<br />
  html += "  var val = document.getElementById('val').value;";<br />
  html += "  document.getElementById('statusMsg').innerText = 'Sende...';";<br />
  html += "  fetch('/send?ga=' + encodeURIComponent(ga) + '&amp;dpt=' + encodeURIComponent(dpt) + '&amp;val=' + encodeURIComponent(val))";<br />
  html += "  .then(response =&gt; response.text())";<br />
  html += "  .then(data =&gt; { document.getElementById('statusMsg').innerText = data; })";<br />
  html += "  .catch(err =&gt; { document.getElementById('statusMsg').innerText = 'Fehler beim Senden!'; });";<br />
  html += "}";<br />
  html += "function reconnectKnx(){";<br />
  html += "  fetch('/reconnect').then(r=&gt;r.text()).then(d=&gt;{ updateStatus(); });";<br />
  html += "}";<br />
  html += "function updateStatus(){";<br />
  html += "  fetch('/status').then(r=&gt;r.json()).then(d=&gt;{";<br />
  html += "    document.getElementById('dtNow').innerText = d.datetime;";<br />
  html += "    document.getElementById('knxStatus').innerHTML = d.connected ? (&#92;"&lt;b style='color:green;'&gt;Verbunden (Channel &#92;" + d.channel + &#92;")&lt;/b&gt;&#92;") : &#92;"&lt;b style='color:red;'&gt;Getrennt&lt;/b&gt;&#92;";";<br />
  html += "    var rows = '';";<br />
  html += "    d.log.forEach(function(e){ rows += '&lt;tr&gt;&lt;td&gt;'+e.time+'&lt;/td&gt;&lt;td&gt;'+e.ga+'&lt;/td&gt;&lt;td&gt;'+e.len+'&lt;/td&gt;&lt;td&gt;'+e.hex+'&lt;/td&gt;&lt;td&gt;'+e.value+'&lt;/td&gt;&lt;/tr&gt;'; });";<br />
  html += "    document.getElementById('logBody').innerHTML = rows || '&lt;tr&gt;&lt;td colspan=5&gt;Noch keine Telegramme empfangen&lt;/td&gt;&lt;/tr&gt;';";<br />
  html += "  }).catch(function(){});";<br />
  html += "}";<br />
  html += "setInterval(updateStatus, 1000);";<br />
  html += "updateStatus();";<br />
  html += "&lt;/script&gt;";<br />
<br />
  html += "&lt;/body&gt;&lt;/html&gt;";<br />
  server.send(200, "text/html", html);<br />
}<br />
<br />
void handleSend() {<br />
  if (server.hasArg("ga") &amp;&amp; server.hasArg("dpt") &amp;&amp; server.hasArg("val")) {<br />
    String ga = server.arg("ga");<br />
    String dpt = server.arg("dpt");<br />
    String val = server.arg("val");<br />
<br />
    bool ok = sendKnxValue(ga, dpt, val);<br />
    server.send(200, "text/plain", ok ? "Telegramm gesendet und per ACK bestaetigt!" : "Gesendet, aber KEIN ACK erhalten, siehe Serial Monitor!");<br />
  } else {<br />
    server.send(400, "text/plain", "Fehlende Parameter!");<br />
  }<br />
}<br />
<br />
void handleReconnect() {<br />
  connectKnx();<br />
  server.send(200, "text/plain", "Reconnected!");<br />
}<br />
<br />
void handleStatus() {<br />
  String json = "{";<br />
  json += "&#92;"project&#92;":&#92;"" + escapeJson(String(projectName)) + "&#92;",";<br />
  json += "&#92;"datetime&#92;":&#92;"" + escapeJson(getFormattedDateTime()) + "&#92;",";<br />
  json += "&#92;"connected&#92;":" + String(isKnxConnected ? "true" : "false") + ",";<br />
  json += "&#92;"channel&#92;":" + String(knxChannelId) + ",";<br />
  json += "&#92;"log&#92;":[";<br />
<br />
  for (int i = 0; i &lt; knxLogFilled; i++) {<br />
    int idx = (knxLogNext - 1 - i + KNX_LOG_SIZE) % KNX_LOG_SIZE;<br />
    KnxLogEntry &amp;e = knxLog[idx];<br />
<br />
    String hex = "";<br />
    for (int b = 0; b &lt; e.len; b++) {<br />
      char hb[4];<br />
      snprintf(hb, sizeof(hb), "%02X ", e.data[b]);<br />
      hex += hb;<br />
    }<br />
    hex.trim();<br />
<br />
    if (i &gt; 0) json += ",";<br />
    json += "{";<br />
    json += "&#92;"time&#92;":&#92;"" + escapeJson(String(e.timeStr)) + "&#92;",";<br />
    json += "&#92;"ga&#92;":&#92;"" + escapeJson(gaToString(e.ga)) + "&#92;",";<br />
    json += "&#92;"len&#92;":" + String(e.len) + ",";<br />
    json += "&#92;"hex&#92;":&#92;"" + escapeJson(hex) + "&#92;",";<br />
    json += "&#92;"value&#92;":&#92;"" + escapeJson(interpretKnxData(e.data, e.len)) + "&#92;"";<br />
    json += "}";<br />
  }<br />
  json += "]}";<br />
  server.send(200, "application/json", json);<br />
}<br />
<br />
void setup() {<br />
  Serial.begin(115200);<br />
  delay(1000);<br />
<br />
  Serial.printf("&#92;n===&gt; %s &lt;===&#92;n", projectName);<br />
<br />
  WiFi.begin(ssid, password);<br />
  while (WiFi.status() != WL_CONNECTED) {<br />
    delay(500);<br />
    Serial.print(".");<br />
  }<br />
<br />
  Serial.println("&#92;nWLAN Verbunden!");<br />
  Serial.print("IP Adresse - "); Serial.println(WiFi.localIP());<br />
  Serial.print("RSSI: "); Serial.println(WiFi.RSSI());<br />
<br />
  configTzTime(tzInfo, ntpServer);<br />
  Serial.println("Warte auf Zeitsynchronisation (NTP)...");<br />
  struct tm timeinfo;<br />
  if (getLocalTime(&amp;timeinfo, 5000)) {<br />
    Serial.println("Zeit synchronisiert - " + getFormattedDateTime());<br />
  } else {<br />
    Serial.println("Zeit konnte nicht synchronisiert werden (wird spaeter automatisch nachgeholt).");<br />
  }<br />
<br />
  udp.begin(localPort);<br />
<br />
  connectKnx();<br />
<br />
  server.on("/", handleRoot);<br />
  server.on("/send", handleSend);<br />
  server.on("/reconnect", handleReconnect);<br />
  server.on("/status", handleStatus);<br />
  server.begin();<br />
}<br />
<br />
void loop() {<br />
  server.handleClient();<br />
  handleKnxRx();<br />
<br />
  if (isKnxConnected &amp;&amp; (millis() - lastHeartbeat &gt; HEARTBEAT_INTERVAL)) {<br />
    sendConnectionStateRequest();<br />
    lastHeartbeat = millis();<br />
  }<br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Script PHP pour connexion par tunnel IP KNX]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=16448</link>
			<pubDate>Tue, 15 Sep 2026 17:35:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=16448</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">Bonjour,</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Je mets à disposition ce petit code PHP pour ceux qui souhaitent créer davantage de choses avec PHP et KNX. Il établit une connexion par tunnel IP, envoie des données pour les DPT 1, 5 ou 9, puis se déconnecte.</span><br />
<span style="font-weight: bold;" class="mycode_b">Cela n'a rien à voir non plus avec mon wrapper, c'est totalement indépendant.</span><br />
<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Code PHP :</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;text/html;&nbsp;charset=utf-8'</span><span style="color: #007700">);<br /><br />class&nbsp;</span><span style="color: #0000BB">KNXTunnel&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">string&nbsp;&#36;ip</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;port</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">&#36;socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">__construct</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3671</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;ip</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;port</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;msg</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">void&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">&#36;msg&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&#092;n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ob_get_level</span><span style="color: #007700">()&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;@</span><span style="color: #0000BB">ob_flush</span><span style="color: #007700">();&nbsp;}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">flush</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">getLocalIp</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;sock&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">socket_create</span><span style="color: #007700">(</span><span style="color: #0000BB">AF_INET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOCK_DGRAM</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_UDP</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_getsockname</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;addr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_close</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">&#36;addr</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">statusText</span><span style="color: #007700">(</span><span style="color: #0000BB">int&nbsp;&#36;status</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;match&nbsp;(</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_ERROR'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x22&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_CONNECTION_TYPE&nbsp;(Verbindungstyp&nbsp;nicht&nbsp;unterstützt)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x23&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_CONNECTION_OPTION&nbsp;(Option&nbsp;nicht&nbsp;unterstützt)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x24&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_MORE_CONNECTIONS&nbsp;(max.&nbsp;Anzahl&nbsp;Tunnel-Verbindungen&nbsp;erreicht)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x26&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_DATA_CONNECTION'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x27&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_KNX_CONNECTION'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x29&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_MORE_UNIQUE_CONNECTIONS'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">default&nbsp;=&gt;&nbsp;</span><span style="color: #DD0000">'unbekannt&nbsp;(0x'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">')'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">};<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">connect</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">socket_create</span><span style="color: #007700">(</span><span style="color: #0000BB">AF_INET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOCK_DGRAM</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_UDP</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Socket&nbsp;konnte&nbsp;nicht&nbsp;erstellt&nbsp;werden&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">()));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_set_option</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_SOCKET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SO_RCVTIMEO</span><span style="color: #007700">,&nbsp;[</span><span style="color: #DD0000">'sec'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'usec'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;myPcIp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLocalIp</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"ℹ️&nbsp;Lokale&nbsp;IP&nbsp;:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">}</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(!@</span><span style="color: #0000BB">socket_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Fehler&nbsp;beim&nbsp;Binden&nbsp;an&nbsp;PC&nbsp;IP&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;localPort&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_getsockname</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;ipParts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'intval'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'.'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;hpaiControl&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x08</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x01</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;hpaiData&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x08</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x01</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;header&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x02&#092;x05&#092;x00&#092;x1a"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;cri&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x04&#092;x04&#092;x02&#092;x00"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;connectRequest&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;hpaiControl&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;hpaiData&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;cri</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;connectRequest</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;connectRequest</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;CONNECT_REQUEST&nbsp;gesendet&nbsp;an&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">}</span><span style="color: #DD0000">:</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">}</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;buffer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;from&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;fromPort&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;bytes&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">socket_recvfrom</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1024</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;fromPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;recvfrom&nbsp;Fehler&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Zu&nbsp;kurze&nbsp;Antwort&nbsp;empfangen&nbsp;(</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;bytes</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;Bytes)."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;Rohdaten&nbsp;empfangen&nbsp;von&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">}</span><span style="color: #DD0000">:</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;fromPort</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;("&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&nbsp;Bytes):&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;serviceType&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">])&nbsp;&lt;&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;|&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;serviceType&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0x0206</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Unerwarteter&nbsp;Service&nbsp;Type&nbsp;:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%04X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;serviceType</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;(erwartet&nbsp;:&nbsp;0x0206&nbsp;CONNECT_RESPONSE)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">7</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;status&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;IP&nbsp;Gateway&nbsp;abbruch,&nbsp;Status&nbsp;:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;("&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">statusText</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">")"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">6</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"✅&nbsp;IP&nbsp;Gateway&nbsp;Tunnel&nbsp;erfolgreich&nbsp;aufgebaut!&nbsp;(Channel&nbsp;ID&nbsp;:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">}</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">parseGroupAddress</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;ga</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;parts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ga</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">)&nbsp;===&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;main&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0x1F</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;middle&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0x07</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;sub&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;val&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;main&nbsp;</span><span style="color: #007700">&lt;&lt;&nbsp;</span><span style="color: #0000BB">11</span><span style="color: #007700">)&nbsp;|&nbsp;(</span><span style="color: #0000BB">&#36;middle&nbsp;</span><span style="color: #007700">&lt;&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;|&nbsp;</span><span style="color: #0000BB">&#36;sub</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #DD0000">"&#092;x00&#092;x00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">encodeDPT</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">switch&nbsp;(</span><span style="color: #0000BB">strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT1'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80&nbsp;</span><span style="color: #007700">|&nbsp;(</span><span style="color: #0000BB">&#36;value&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT5'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">max</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">min</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;(int)</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT9'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;v&nbsp;</span><span style="color: #007700">=&nbsp;(float)</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;sign&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;v&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #0000BB">0x8000&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">0x0000</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">abs</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;v</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;mantissa&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">round</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;v&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;exponent&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">while&nbsp;(</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">2047</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;mantissa&nbsp;</span><span style="color: #007700">&gt;&gt;=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;exponent</span><span style="color: #007700">++;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;sign</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">=&nbsp;-</span><span style="color: #0000BB">&#36;mantissa</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;raw&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;sign&nbsp;</span><span style="color: #007700">|&nbsp;((</span><span style="color: #0000BB">&#36;exponent&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0x0F</span><span style="color: #007700">)&nbsp;&lt;&lt;&nbsp;</span><span style="color: #0000BB">11</span><span style="color: #007700">)&nbsp;|&nbsp;(</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0x07FF</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80</span><span style="color: #007700">,&nbsp;(</span><span style="color: #0000BB">&#36;raw&nbsp;</span><span style="color: #007700">&gt;&gt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;raw&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">default:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">throw&nbsp;new&nbsp;</span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #DD0000">"DPT&nbsp;Typ&nbsp;'</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">}</span><span style="color: #DD0000">'&nbsp;nicht&nbsp;unterstützt."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;groupAddress</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">string&nbsp;&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;send()&nbsp;ohne&nbsp;aktiven&nbsp;Tunnel&nbsp;aufgerufen,&nbsp;zuerst&nbsp;connect()&nbsp;erfolgreich&nbsp;ausführen."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;gaBytes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">parseGroupAddress</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;groupAddress</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;payload&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">encodeDPT</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;payloadLen&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;payload</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;cemi&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x11&#092;x00&#092;xbc&#092;xe0&#092;x00&#092;x00"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;gaBytes&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;payloadLen</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&#092;x00"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;payload</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;totalLen&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">6&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">4&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;cemi</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;header&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x04&#092;x20"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;totalLen</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;connectionHeader&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x04</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;packet&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;connectionHeader&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;cemi</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;packet</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;packet</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;Telegramm&nbsp;an&nbsp;&lt;b&gt;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;groupAddress</span><span style="color: #007700">}</span><span style="color: #DD0000">&lt;/b&gt;&nbsp;gesendet!&nbsp;(Seq:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber</span><span style="color: #007700">}</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;ack&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">receiveACK</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">)&nbsp;%&nbsp;</span><span style="color: #0000BB">256</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">&#36;ack</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">receiveACK</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;buffer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;from&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;bytes&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">socket_recvfrom</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1024</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;port</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Kein&nbsp;ACK&nbsp;erhalten&nbsp;(Timeout)&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">&gt;=&nbsp;</span><span style="color: #0000BB">10&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">])&nbsp;===&nbsp;</span><span style="color: #0000BB">0x04&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;===&nbsp;</span><span style="color: #0000BB">0x21</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">9</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;status&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;ACK&nbsp;vom&nbsp;IP&nbsp;Gateway&nbsp;erhalten."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"⚠️&nbsp;ACK&nbsp;erhalten,&nbsp;aber&nbsp;mit&nbsp;Fehlerstatus:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"⚠️&nbsp;Unerwartete&nbsp;Antwort&nbsp;statt&nbsp;ACK&nbsp;erhalten&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">disconnect</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">void&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;disconnectRequest&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x02&#092;x09&#092;x00&#092;x10"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&#092;x08&#092;x01&#092;x00&#092;x00&#092;x00&#092;x00&#092;x00&#092;x00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;disconnectRequest</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;disconnectRequest</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;IP&nbsp;Gateway&nbsp;Tunnel&nbsp;Verbindung&nbsp;(Channel&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">}</span><span style="color: #DD0000">)&nbsp;ordnungsgemäß&nbsp;getrennt."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">socket_close</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br />}<br /><br /></span><span style="color: #0000BB">&#36;Ip&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'192.168.178.42'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;knx&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">KNXTunnel</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;Ip</span><span style="color: #007700">);<br /><br />try&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">())&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #DD0000">'1/0/0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'DPT1'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br />}&nbsp;finally&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">disconnect</span><span style="color: #007700">();<br />}&nbsp;<br /></span></code></div></div></div>]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">Bonjour,</span><br />
<br />
<span style="font-weight: bold;" class="mycode_b">Je mets à disposition ce petit code PHP pour ceux qui souhaitent créer davantage de choses avec PHP et KNX. Il établit une connexion par tunnel IP, envoie des données pour les DPT 1, 5 ou 9, puis se déconnecte.</span><br />
<span style="font-weight: bold;" class="mycode_b">Cela n'a rien à voir non plus avec mon wrapper, c'est totalement indépendant.</span><br />
<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">Code PHP :</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;text/html;&nbsp;charset=utf-8'</span><span style="color: #007700">);<br /><br />class&nbsp;</span><span style="color: #0000BB">KNXTunnel&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">string&nbsp;&#36;ip</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;port</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">&#36;socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">__construct</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">int&nbsp;&#36;port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3671</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;ip</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;port</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;msg</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">void&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">&#36;msg&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&lt;br&gt;&#092;n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ob_get_level</span><span style="color: #007700">()&nbsp;&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{&nbsp;@</span><span style="color: #0000BB">ob_flush</span><span style="color: #007700">();&nbsp;}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">flush</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">getLocalIp</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;sock&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">socket_create</span><span style="color: #007700">(</span><span style="color: #0000BB">AF_INET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOCK_DGRAM</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_UDP</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_getsockname</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;addr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_close</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;sock</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">&#36;addr</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">statusText</span><span style="color: #007700">(</span><span style="color: #0000BB">int&nbsp;&#36;status</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;match&nbsp;(</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_ERROR'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x22&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_CONNECTION_TYPE&nbsp;(Verbindungstyp&nbsp;nicht&nbsp;unterstützt)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x23&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_CONNECTION_OPTION&nbsp;(Option&nbsp;nicht&nbsp;unterstützt)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x24&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_MORE_CONNECTIONS&nbsp;(max.&nbsp;Anzahl&nbsp;Tunnel-Verbindungen&nbsp;erreicht)'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x26&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_DATA_CONNECTION'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x27&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_KNX_CONNECTION'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x29&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'E_NO_MORE_UNIQUE_CONNECTIONS'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">default&nbsp;=&gt;&nbsp;</span><span style="color: #DD0000">'unbekannt&nbsp;(0x'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">')'</span><span style="color: #007700">,<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">};<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">connect</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">socket_create</span><span style="color: #007700">(</span><span style="color: #0000BB">AF_INET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOCK_DGRAM</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_UDP</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Socket&nbsp;konnte&nbsp;nicht&nbsp;erstellt&nbsp;werden&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">()));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_set_option</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SOL_SOCKET</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SO_RCVTIMEO</span><span style="color: #007700">,&nbsp;[</span><span style="color: #DD0000">'sec'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'usec'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;myPcIp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLocalIp</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"ℹ️&nbsp;Lokale&nbsp;IP&nbsp;:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">}</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(!@</span><span style="color: #0000BB">socket_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Fehler&nbsp;beim&nbsp;Binden&nbsp;an&nbsp;PC&nbsp;IP&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;localPort&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_getsockname</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;ipParts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'intval'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'.'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;myPcIp</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;hpaiControl&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x08</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x01</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;hpaiData&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x08</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x01</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">&#36;ipParts</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;localPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;header&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x02&#092;x05&#092;x00&#092;x1a"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;cri&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x04&#092;x04&#092;x02&#092;x00"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;connectRequest&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;hpaiControl&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;hpaiData&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;cri</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;connectRequest</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;connectRequest</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;CONNECT_REQUEST&nbsp;gesendet&nbsp;an&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">}</span><span style="color: #DD0000">:</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">}</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;buffer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;from&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;fromPort&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;bytes&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">socket_recvfrom</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1024</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;fromPort</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;recvfrom&nbsp;Fehler&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Zu&nbsp;kurze&nbsp;Antwort&nbsp;empfangen&nbsp;(</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;bytes</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;Bytes)."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;Rohdaten&nbsp;empfangen&nbsp;von&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">}</span><span style="color: #DD0000">:</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;fromPort</span><span style="color: #007700">}</span><span style="color: #DD0000">&nbsp;("&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&nbsp;Bytes):&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;serviceType&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">])&nbsp;&lt;&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;|&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;serviceType&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0x0206</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Unerwarteter&nbsp;Service&nbsp;Type&nbsp;:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%04X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;serviceType</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;(erwartet&nbsp;:&nbsp;0x0206&nbsp;CONNECT_RESPONSE)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">7</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;status&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;IP&nbsp;Gateway&nbsp;abbruch,&nbsp;Status&nbsp;:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;("&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">statusText</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">")"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">6</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"✅&nbsp;IP&nbsp;Gateway&nbsp;Tunnel&nbsp;erfolgreich&nbsp;aufgebaut!&nbsp;(Channel&nbsp;ID&nbsp;:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">}</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">parseGroupAddress</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;ga</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;parts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">explode</span><span style="color: #007700">(</span><span style="color: #DD0000">'/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;ga</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">)&nbsp;===&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;main&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0x1F</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;middle&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0x07</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;sub&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">&#36;parts</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;val&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;main&nbsp;</span><span style="color: #007700">&lt;&lt;&nbsp;</span><span style="color: #0000BB">11</span><span style="color: #007700">)&nbsp;|&nbsp;(</span><span style="color: #0000BB">&#36;middle&nbsp;</span><span style="color: #007700">&lt;&lt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;|&nbsp;</span><span style="color: #0000BB">&#36;sub</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #DD0000">"&#092;x00&#092;x00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">encodeDPT</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">string&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">switch&nbsp;(</span><span style="color: #0000BB">strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">))&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT1'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80&nbsp;</span><span style="color: #007700">|&nbsp;(</span><span style="color: #0000BB">&#36;value&nbsp;</span><span style="color: #007700">?&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT5'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">max</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">min</span><span style="color: #007700">(</span><span style="color: #0000BB">255</span><span style="color: #007700">,&nbsp;(int)</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;val</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">case&nbsp;</span><span style="color: #DD0000">'DPT9'</span><span style="color: #007700">:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;v&nbsp;</span><span style="color: #007700">=&nbsp;(float)</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;sign&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;v&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #0000BB">0x8000&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #0000BB">0x0000</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">abs</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;v</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;mantissa&nbsp;</span><span style="color: #007700">=&nbsp;(int)</span><span style="color: #0000BB">round</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;v&nbsp;</span><span style="color: #007700">*&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;exponent&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">while&nbsp;(</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">&gt;&nbsp;</span><span style="color: #0000BB">2047</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;mantissa&nbsp;</span><span style="color: #007700">&gt;&gt;=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;exponent</span><span style="color: #007700">++;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;sign</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">=&nbsp;-</span><span style="color: #0000BB">&#36;mantissa</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;raw&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;sign&nbsp;</span><span style="color: #007700">|&nbsp;((</span><span style="color: #0000BB">&#36;exponent&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0x0F</span><span style="color: #007700">)&nbsp;&lt;&lt;&nbsp;</span><span style="color: #0000BB">11</span><span style="color: #007700">)&nbsp;|&nbsp;(</span><span style="color: #0000BB">&#36;mantissa&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0x07FF</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C*'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x80</span><span style="color: #007700">,&nbsp;(</span><span style="color: #0000BB">&#36;raw&nbsp;</span><span style="color: #007700">&gt;&gt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">)&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;raw&nbsp;</span><span style="color: #007700">&amp;&nbsp;</span><span style="color: #0000BB">0xFF</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">default:<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">throw&nbsp;new&nbsp;</span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #DD0000">"DPT&nbsp;Typ&nbsp;'</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">}</span><span style="color: #DD0000">'&nbsp;nicht&nbsp;unterstützt."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">string&nbsp;&#36;groupAddress</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">string&nbsp;&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">):&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;send()&nbsp;ohne&nbsp;aktiven&nbsp;Tunnel&nbsp;aufgerufen,&nbsp;zuerst&nbsp;connect()&nbsp;erfolgreich&nbsp;ausführen."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;gaBytes&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">parseGroupAddress</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;groupAddress</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;payload&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">encodeDPT</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;dptType</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;value</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;payloadLen&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;payload</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;cemi&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x11&#092;x00&#092;xbc&#092;xe0&#092;x00&#092;x00"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;gaBytes&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'C'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;payloadLen</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&#092;x00"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;payload</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;totalLen&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">6&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">4&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;cemi</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;header&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x04&#092;x20"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'n'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;totalLen</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;connectionHeader&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x04</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;packet&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;header&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;connectionHeader&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">&#36;cemi</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;packet</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;packet</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;Telegramm&nbsp;an&nbsp;&lt;b&gt;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;groupAddress</span><span style="color: #007700">}</span><span style="color: #DD0000">&lt;/b&gt;&nbsp;gesendet!&nbsp;(Seq:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber</span><span style="color: #007700">}</span><span style="color: #DD0000">)"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;ack&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">receiveACK</span><span style="color: #007700">();<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">sequenceNumber&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">)&nbsp;%&nbsp;</span><span style="color: #0000BB">256</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">&#36;ack</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><span style="color: #0000BB">receiveACK</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">bool&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;buffer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;from&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;port&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;bytes&nbsp;</span><span style="color: #007700">=&nbsp;@</span><span style="color: #0000BB">socket_recvfrom</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1024</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;from</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;port</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"❌&nbsp;Kein&nbsp;ACK&nbsp;erhalten&nbsp;(Timeout)&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">socket_strerror</span><span style="color: #007700">(</span><span style="color: #0000BB">socket_last_error</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;bytes&nbsp;</span><span style="color: #007700">&gt;=&nbsp;</span><span style="color: #0000BB">10&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">2</span><span style="color: #007700">])&nbsp;===&nbsp;</span><span style="color: #0000BB">0x04&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">3</span><span style="color: #007700">])&nbsp;===&nbsp;</span><span style="color: #0000BB">0x21</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">[</span><span style="color: #0000BB">9</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;status&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;ACK&nbsp;vom&nbsp;IP&nbsp;Gateway&nbsp;erhalten."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"⚠️&nbsp;ACK&nbsp;erhalten,&nbsp;aber&nbsp;mit&nbsp;Fehlerstatus:&nbsp;0x"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">sprintf</span><span style="color: #007700">(</span><span style="color: #DD0000">'%02X'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;status</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"⚠️&nbsp;Unerwartete&nbsp;Antwort&nbsp;statt&nbsp;ACK&nbsp;erhalten&nbsp;:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">bin2hex</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;buffer</span><span style="color: #007700">));<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">public&nbsp;function&nbsp;</span><span style="color: #0000BB">disconnect</span><span style="color: #007700">():&nbsp;</span><span style="color: #0000BB">void&nbsp;</span><span style="color: #007700">{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">0&nbsp;</span><span style="color: #007700">&amp;&amp;&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;disconnectRequest&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"&#092;x06&#092;x10&#092;x02&#092;x09&#092;x00&#092;x10"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">pack</span><span style="color: #007700">(</span><span style="color: #DD0000">'CC'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x00</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&#092;x08&#092;x01&#092;x00&#092;x00&#092;x00&#092;x00&#092;x00&#092;x00"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">socket_sendto</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;disconnectRequest</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;disconnectRequest</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ip</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">port</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">log</span><span style="color: #007700">(</span><span style="color: #DD0000">"?&nbsp;IP&nbsp;Gateway&nbsp;Tunnel&nbsp;Verbindung&nbsp;(Channel&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId</span><span style="color: #007700">}</span><span style="color: #DD0000">)&nbsp;ordnungsgemäß&nbsp;getrennt."</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">channelId&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">)&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">@</span><span style="color: #0000BB">socket_close</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#36;this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">socket&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: #007700">}<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br />}<br /><br /></span><span style="color: #0000BB">&#36;Ip&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'192.168.178.42'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">&#36;knx&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">KNXTunnel</span><span style="color: #007700">(</span><span style="color: #0000BB">&#36;Ip</span><span style="color: #007700">);<br /><br />try&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">())&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp; &nbsp; &nbsp;&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #DD0000">'1/0/0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'DPT1'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;</span><span style="color: #007700">}<br />}&nbsp;finally&nbsp;{<br /></span><span style="color: #0000BB"> &nbsp; &nbsp;&#36;knx</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">disconnect</span><span style="color: #007700">();<br />}&nbsp;<br /></span></code></div></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Se former au SEO quand on vient du monde KNX, y'a du monde ?]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=15882</link>
			<pubDate>Wed, 29 Jul 2026 03:51:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=15777">Aleex</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=15882</guid>
			<description><![CDATA[Bonjour, ça fait 6 ans que je bosse sur des installations KNX, que ce soit des maisons individuelles ou des projets un peu plus costauds avec ETS5/ETS6, linknx et tout le bordel. Je gère ma propre petite activité depuis 2 ans maintenant, et j'ai monté un blog pour partager mes configs, mes retours sur le matériel, quelques tutos sur pKNXy aussi. Je me suis rendu compte y'a 3 mois que mon blog existe... mais personne le lit vraiment. Genre j'ai 40 visiteurs par mois, c'est franchement décourageant vu le temps que j'y passe. Un pote m'a dit "mec t'as juste à te former au SEO" comme si c'était une évidence, sauf que moi sa me parle pas du tout, j'ai 0 bagage là-dedans.<br />
<br />
Il y a des gens ici qui sont passé par là? Parce que la domotique KNX c'est quand même une niche assez pointue, j'imagine que <a href="https://leswizards.com/formations-seo/" target="_blank" rel="noopener" class="mycode_url"><span style="color: #333333;" class="mycode_color">se former au SEO</span></a> quand on est sur une thématique aussi technique c'est pas pareil que pour un blog de cuisine ou de voyage. Les volumes de recherche sont probablement ridicules, les mots-clés très specifiques... j'sais pas si les formations SEO classiques qu'on trouve un peu partout en ligne couvrent vraiment ce genre de cas. Quelqu'un ici a bossé sa visibilité sur son propre site autour du KNX ? Vous êtes passé par une formation, des ressources gratuites, un forum spécialisé SEO ? Curieux de savoir comment vous avez géré ça concrètement.]]></description>
			<content:encoded><![CDATA[Bonjour, ça fait 6 ans que je bosse sur des installations KNX, que ce soit des maisons individuelles ou des projets un peu plus costauds avec ETS5/ETS6, linknx et tout le bordel. Je gère ma propre petite activité depuis 2 ans maintenant, et j'ai monté un blog pour partager mes configs, mes retours sur le matériel, quelques tutos sur pKNXy aussi. Je me suis rendu compte y'a 3 mois que mon blog existe... mais personne le lit vraiment. Genre j'ai 40 visiteurs par mois, c'est franchement décourageant vu le temps que j'y passe. Un pote m'a dit "mec t'as juste à te former au SEO" comme si c'était une évidence, sauf que moi sa me parle pas du tout, j'ai 0 bagage là-dedans.<br />
<br />
Il y a des gens ici qui sont passé par là? Parce que la domotique KNX c'est quand même une niche assez pointue, j'imagine que <a href="https://leswizards.com/formations-seo/" target="_blank" rel="noopener" class="mycode_url"><span style="color: #333333;" class="mycode_color">se former au SEO</span></a> quand on est sur une thématique aussi technique c'est pas pareil que pour un blog de cuisine ou de voyage. Les volumes de recherche sont probablement ridicules, les mots-clés très specifiques... j'sais pas si les formations SEO classiques qu'on trouve un peu partout en ligne couvrent vraiment ce genre de cas. Quelqu'un ici a bossé sa visibilité sur son propre site autour du KNX ? Vous êtes passé par une formation, des ressources gratuites, un forum spécialisé SEO ? Curieux de savoir comment vous avez géré ça concrètement.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[KNX Reast API]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=13186</link>
			<pubDate>Mon, 30 Mar 2026 10:34:53 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=13186</guid>
			<description><![CDATA[Bonjour à tous,<br />
<br />
j’ai développé une API REST en ASP.NET qui permet de se connecter à un système KNX (via USB, IP ou KNX IP Secure).<br />
Cette API propose de nombreuses fonctionnalités, notamment :<ul class="mycode_list"><li>WriteBool<br />
</li>
<li>WriteByte<br />
</li>
<li>WriteDPT<br />
</li>
<li>ReadValue<br />
</li>
<li>le chargement des adresses de groupe à partir d’un fichier XML <br />
</li>
<li>ainsi que d’autres commandes utiles pour la communication KNX <br />
</li>
</ul>
<br />
<br />
En outre, tous les endpoints de l’API sont affichés directement sur le serveur avec des explications détaillées, ce qui facilite grandement l’utilisation et l’intégration.<br />
Vous trouverez ci-dessous quelques-unes des principales fonctionnalités et endpoints :<br />
<br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/swagger/index.html" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/swagger/index.html</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connectusb" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connectusb</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connect?ip=192.168.178.42&amp;port=3671&amp;nat=true" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connect?i...1&amp;nat=true</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connectsecure?ip=192.168.178.42&amp;port=3671&amp;nat=true&amp;indiaddress=1.1.241&amp;filename=C:\\keys\\test.kexkeys&amp;password=1234" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connectse...sword=1234</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/dispose" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/dispose</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/readvalue?groupaddress=1/2/10&amp;dpt1=1&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/readvalue...1=1&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writebool?groupaddress=1/2/10&amp;value=true" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writebool...value=true</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writebyte?groupaddress=1/2/10&amp;value=100" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writebyte...&amp;value=100</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writevaluetodpt?groupaddress=1/2/10&amp;value=22.5&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writevalu...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/converttoraw?value=22.5&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/convertto...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/converttodpt?value=0x07D0&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/convertto...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/loaddptlist?filename=C:\\data\\dpt.xml" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/loaddptli...a\\dpt.xml</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/telegrams" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/telegrams</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/check?groupaddress=1/2/10" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/check?gro...ess=1/2/10</a></span><br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #e82a1f;" class="mycode_color">lien de téléchargement:</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #e82a1f;" class="mycode_color"><a href="https://www.knx-board.org/download.php?file=knxwebapiv19.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...apiv19.zip</a></span></span>]]></description>
			<content:encoded><![CDATA[Bonjour à tous,<br />
<br />
j’ai développé une API REST en ASP.NET qui permet de se connecter à un système KNX (via USB, IP ou KNX IP Secure).<br />
Cette API propose de nombreuses fonctionnalités, notamment :<ul class="mycode_list"><li>WriteBool<br />
</li>
<li>WriteByte<br />
</li>
<li>WriteDPT<br />
</li>
<li>ReadValue<br />
</li>
<li>le chargement des adresses de groupe à partir d’un fichier XML <br />
</li>
<li>ainsi que d’autres commandes utiles pour la communication KNX <br />
</li>
</ul>
<br />
<br />
En outre, tous les endpoints de l’API sont affichés directement sur le serveur avec des explications détaillées, ce qui facilite grandement l’utilisation et l’intégration.<br />
Vous trouverez ci-dessous quelques-unes des principales fonctionnalités et endpoints :<br />
<br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/swagger/index.html" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/swagger/index.html</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connectusb" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connectusb</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connect?ip=192.168.178.42&amp;port=3671&amp;nat=true" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connect?i...1&amp;nat=true</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/connectsecure?ip=192.168.178.42&amp;port=3671&amp;nat=true&amp;indiaddress=1.1.241&amp;filename=C:\\keys\\test.kexkeys&amp;password=1234" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/connectse...sword=1234</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/dispose" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/dispose</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/readvalue?groupaddress=1/2/10&amp;dpt1=1&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/readvalue...1=1&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writebool?groupaddress=1/2/10&amp;value=true" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writebool...value=true</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writebyte?groupaddress=1/2/10&amp;value=100" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writebyte...&amp;value=100</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/writevaluetodpt?groupaddress=1/2/10&amp;value=22.5&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/writevalu...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/converttoraw?value=22.5&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/convertto...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/converttodpt?value=0x07D0&amp;dpt1=9&amp;dpt2=1" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/convertto...1=9&amp;dpt2=1</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/loaddptlist?filename=C:\\data\\dpt.xml" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/loaddptli...a\\dpt.xml</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/telegrams" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/telegrams</a></span><br />
<span style="color: #0074d9;" class="mycode_color"><a href="https://localhost:7061/api/knx/check?groupaddress=1/2/10" target="_blank" rel="noopener" class="mycode_url">https://localhost:7061/api/knx/check?gro...ess=1/2/10</a></span><br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #e82a1f;" class="mycode_color">lien de téléchargement:</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #e82a1f;" class="mycode_color"><a href="https://www.knx-board.org/download.php?file=knxwebapiv19.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...apiv19.zip</a></span></span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Création d'une passerelle onduleur huawei sun2000 -> KNX IP]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=9182</link>
			<pubDate>Thu, 06 Feb 2025 18:18:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=2153">tof70270</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=9182</guid>
			<description><![CDATA[Bonjour,<br />
Je suis en train d'essayer de créer une passerelle sun2000 pour échanger les donner avec le KNX via mon Raspberry 4. J'ai réussi à créer la passerelle KNX ainsi que d'installer et de connecter l'application fusion solar. Mon problème est de savoir quel node utiliser dans node-red pour faire la liaison entre les 2.<br />
Merci pour votre aide.]]></description>
			<content:encoded><![CDATA[Bonjour,<br />
Je suis en train d'essayer de créer une passerelle sun2000 pour échanger les donner avec le KNX via mon Raspberry 4. J'ai réussi à créer la passerelle KNX ainsi que d'installer et de connecter l'application fusion solar. Mon problème est de savoir quel node utiliser dans node-red pour faire la liaison entre les 2.<br />
Merci pour votre aide.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Partagez vos meilleurs outils, applications et liens KNX – La collection ultime !]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8868</link>
			<pubDate>Sun, 26 Jan 2025 14:45:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8868</guid>
			<description><![CDATA[Bonjour à tous,<br />
<br />
Je souhaite mettre à disposition quelques outils qui pourraient être utiles à certains d'entre vous, que ce soit pour des tests de fonctionnalités, la création de graphiques pour les panneaux tactiles MDT, ou encore pour créer un message BBCode hors ligne sur le forum, ce qui peut faciliter le travail.<br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">1. Programme : KNX Tableau</span></span><br />
KNX Tableau est un outil simple qui ouvre une fenêtre sur le bureau et propose 16 fonctions de commutation. Dans le fichier XML (settings.xml), il est possible de configurer les adresses IP, les noms de groupes, les adresses de groupe ainsi que les informations de commutation et de statut.<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KnxTableau.zip" target="_blank" rel="noopener" class="mycode_url">KNX Tableau</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">2. Programme : KNX Acteur</span></span><br />
KNX Acteur fonctionne essentiellement de la même manière que KNX Tableau, mais sous la forme d'un actionneur de commutation.<br />
<br />
<img src="http://www.knx-board.org/images/knxaktor.png" loading="lazy"  width="400" height="320" alt="[Image: knxaktor.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KnxAktor.zip" target="_blank" rel="noopener" class="mycode_url">KNX Acteur</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">3. Programme : SVGtoBMP</span></span><br />
SVGtoBMP est un outil simple qui convertit des fichiers SVG en fichiers graphiques BMP, à la fois en version monochrome et en couleur, et dans cinq résolutions différentes. Inversement, il peut également convertir des fichiers BMP en SVG.<br />
<br />
<img src="http://www.knx-board.org/images/svg.png" loading="lazy"  width="400" height="219" alt="[Image: svg.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=SVGtoBMP.zip" target="_blank" rel="noopener" class="mycode_url">SVGtoBMP</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">4. Programme : BBCodeEditor</span></span><br />
J'ai écrit cet outil pour simplifier la création de messages BBCode hors ligne sur le forum. Récemment, je l'utilise moi-même très fréquemment, car il facilite considérablement la gestion.<br />
<br />
<img src="http://www.knx-board.org/images/BBCode.png" loading="lazy"  width="400" height="213" alt="[Image: BBCode.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=BBCodeEditor.zip" target="_blank" rel="noopener" class="mycode_url">BBCodeEditor</a><br />
<br />
Je serais heureux si vous partagiez également des outils utiles sur le sujet KNX ici, cela pourrait certainement intéresser certains d'entre vous. Il est toujours avantageux de rassembler des outils intéressants et de les rendre plus accessibles afin de ne pas passer des heures à chercher des applications utiles sur Internet.<br />
<br />
Veuillez bien vouloir partager vos outils préférés directement ici dans ce fil, afin qu'il soit plus facile de les retrouver.<br />
<br />
D'ici là, amusez-vous bien avec les nombreux outils à venir sur le thème KNX !]]></description>
			<content:encoded><![CDATA[Bonjour à tous,<br />
<br />
Je souhaite mettre à disposition quelques outils qui pourraient être utiles à certains d'entre vous, que ce soit pour des tests de fonctionnalités, la création de graphiques pour les panneaux tactiles MDT, ou encore pour créer un message BBCode hors ligne sur le forum, ce qui peut faciliter le travail.<br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">1. Programme : KNX Tableau</span></span><br />
KNX Tableau est un outil simple qui ouvre une fenêtre sur le bureau et propose 16 fonctions de commutation. Dans le fichier XML (settings.xml), il est possible de configurer les adresses IP, les noms de groupes, les adresses de groupe ainsi que les informations de commutation et de statut.<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KnxTableau.zip" target="_blank" rel="noopener" class="mycode_url">KNX Tableau</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">2. Programme : KNX Acteur</span></span><br />
KNX Acteur fonctionne essentiellement de la même manière que KNX Tableau, mais sous la forme d'un actionneur de commutation.<br />
<br />
<img src="http://www.knx-board.org/images/knxaktor.png" loading="lazy"  width="400" height="320" alt="[Image: knxaktor.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KnxAktor.zip" target="_blank" rel="noopener" class="mycode_url">KNX Acteur</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">3. Programme : SVGtoBMP</span></span><br />
SVGtoBMP est un outil simple qui convertit des fichiers SVG en fichiers graphiques BMP, à la fois en version monochrome et en couleur, et dans cinq résolutions différentes. Inversement, il peut également convertir des fichiers BMP en SVG.<br />
<br />
<img src="http://www.knx-board.org/images/svg.png" loading="lazy"  width="400" height="219" alt="[Image: svg.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=SVGtoBMP.zip" target="_blank" rel="noopener" class="mycode_url">SVGtoBMP</a><br />
<br />
<span style="color: #0080FF;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">4. Programme : BBCodeEditor</span></span><br />
J'ai écrit cet outil pour simplifier la création de messages BBCode hors ligne sur le forum. Récemment, je l'utilise moi-même très fréquemment, car il facilite considérablement la gestion.<br />
<br />
<img src="http://www.knx-board.org/images/BBCode.png" loading="lazy"  width="400" height="213" alt="[Image: BBCode.png]" class="mycode_img" /><br />
<br />
<span style="color: Red;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=BBCodeEditor.zip" target="_blank" rel="noopener" class="mycode_url">BBCodeEditor</a><br />
<br />
Je serais heureux si vous partagiez également des outils utiles sur le sujet KNX ici, cela pourrait certainement intéresser certains d'entre vous. Il est toujours avantageux de rassembler des outils intéressants et de les rendre plus accessibles afin de ne pas passer des heures à chercher des applications utiles sur Internet.<br />
<br />
Veuillez bien vouloir partager vos outils préférés directement ici dans ce fil, afin qu'il soit plus facile de les retrouver.<br />
<br />
D'ici là, amusez-vous bien avec les nombreux outils à venir sur le thème KNX !]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Falcon SDK 6 et Python]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8682</link>
			<pubDate>Tue, 19 Nov 2024 23:14:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8682</guid>
			<description><![CDATA[Bonjour,<br />
<br />
J'ai maintenant également utilisé le wrapper C# pour Python et il fonctionne également comme avec WinDev et Delphi.<br />
<br />
<span style="color: #336633;" class="mycode_color"><span style="text-decoration: underline;" class="mycode_u">Avant d'utiliser, la DLL signée du Falcon SDK doit être enregistrée sur l'ordinateur afin que Python puisse y accéd</span></span>er :<br />
<span style="color: #339933;" class="mycode_color">1. Copiez le dossier « Falcon SDK 6 Signé » dans votre dossier « Documents ».</span><br />
<span style="color: #339933;" class="mycode_color">2. C'est tout.</span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">1. Installation de PythonNet :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">Assurez-vous d'avoir Python (version 3.7–3.11) et un framework .NET compatible installés.</span><br />
</li>
<li><span style="color: #339933;" class="mycode_color">Installez PythonNet avec la commande :  pip install pythonnet</span><br />
</li>
<li><span style="color: #339933;" class="mycode_color">En cas de problèmes, des outils de développement comme Visual Studio Build Tools peuvent être nécessaires.</span><br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">2. Version recommandée :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">PythonNet fonctionne mieux avec Python 3.7 à 3.11.</span><br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">3. Utilisation :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">Après l'installation, utilisez le module </span><span style="color: #336633;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">clr</span></span><span style="color: #339933;" class="mycode_color"> pour charger et utiliser des assemblies .NET dans Python.</span><br />
</li>
</ul>
Les commandes sont identiques à celles de WinDev, mais la gestion des Assemblies .NET dans Delphi est un peu différente. Je vais maintenant reprendre quelques exemples de mon code source pour illustrer les commandes disponibles :<br />
<br />
<span style="color: #993333;" class="mycode_color">Utilisation des assemblies .NET dans Python avec PythonNet :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">import clr</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">clr.AddReference(r'C:\Users\</span><span style="color: #ff6633;" class="mycode_color">Username</span><span style="color: #3333ff;" class="mycode_color">\Documents\Falcon SDK 6 Signiert\KNXlib.dll')<br />
</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">from KNXlib import KnxController</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">knxcontroller = KnxController()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous au gateway USB :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ConnectUSB()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.Connect("192.168.178.42", 3671, False)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP sécurisée :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ConnectSecure("192.168.178.150", 3671, False, "1.1.243","test.knxkeys", "admin123!")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Chargement du fichier XML :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.LoadDptList("knxxml.xml")</span></span><br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteBool("1/0/0" , True)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT9.1 :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteValueToDPT(Groupaddress, value as string, DPTupper value, DPTlower value)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteValueToDPT("11/7/4", "20.5", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">A lire :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ReadValueAsync("11/7/4")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.1 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteValueToDPT("6/0/9", "90", 5, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.4 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteValueToDPT("6/0/9", "240", 5, 4)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Lire DPT9.1 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ReadValue("11/7/4", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteDate("11/5/0")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer l'heure actuelle :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteTime("11/5/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle en tant que DPT16 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteTimeAsText("11/6/1")</span></span><br />
<br />
<br />
<span style="color: #ff3333;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Voici le lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KNXwrapper.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...rapper.zip</a>]]></description>
			<content:encoded><![CDATA[Bonjour,<br />
<br />
J'ai maintenant également utilisé le wrapper C# pour Python et il fonctionne également comme avec WinDev et Delphi.<br />
<br />
<span style="color: #336633;" class="mycode_color"><span style="text-decoration: underline;" class="mycode_u">Avant d'utiliser, la DLL signée du Falcon SDK doit être enregistrée sur l'ordinateur afin que Python puisse y accéd</span></span>er :<br />
<span style="color: #339933;" class="mycode_color">1. Copiez le dossier « Falcon SDK 6 Signé » dans votre dossier « Documents ».</span><br />
<span style="color: #339933;" class="mycode_color">2. C'est tout.</span><br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">1. Installation de PythonNet :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">Assurez-vous d'avoir Python (version 3.7–3.11) et un framework .NET compatible installés.</span><br />
</li>
<li><span style="color: #339933;" class="mycode_color">Installez PythonNet avec la commande :  pip install pythonnet</span><br />
</li>
<li><span style="color: #339933;" class="mycode_color">En cas de problèmes, des outils de développement comme Visual Studio Build Tools peuvent être nécessaires.</span><br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">2. Version recommandée :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">PythonNet fonctionne mieux avec Python 3.7 à 3.11.</span><br />
</li>
</ul>
<span style="font-weight: bold;" class="mycode_b"><span style="color: #336633;" class="mycode_color">3. Utilisation :</span></span><ul class="mycode_list"><li><span style="color: #339933;" class="mycode_color">Après l'installation, utilisez le module </span><span style="color: #336633;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">clr</span></span><span style="color: #339933;" class="mycode_color"> pour charger et utiliser des assemblies .NET dans Python.</span><br />
</li>
</ul>
Les commandes sont identiques à celles de WinDev, mais la gestion des Assemblies .NET dans Delphi est un peu différente. Je vais maintenant reprendre quelques exemples de mon code source pour illustrer les commandes disponibles :<br />
<br />
<span style="color: #993333;" class="mycode_color">Utilisation des assemblies .NET dans Python avec PythonNet :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">import clr</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">clr.AddReference(r'C:\Users\</span><span style="color: #ff6633;" class="mycode_color">Username</span><span style="color: #3333ff;" class="mycode_color">\Documents\Falcon SDK 6 Signiert\KNXlib.dll')<br />
</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">from KNXlib import KnxController</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">knxcontroller = KnxController()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous au gateway USB :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ConnectUSB()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.Connect("192.168.178.42", 3671, False)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP sécurisée :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ConnectSecure("192.168.178.150", 3671, False, "1.1.243","test.knxkeys", "admin123!")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Chargement du fichier XML :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.LoadDptList("knxxml.xml")</span></span><br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteBool("1/0/0" , True)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT9.1 :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteValueToDPT(Groupaddress, value as string, DPTupper value, DPTlower value)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3333ff;" class="mycode_color">knxcontroller.</span>WriteValueToDPT("11/7/4", "20.5", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">A lire :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ReadValueAsync("11/7/4")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.1 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteValueToDPT("6/0/9", "90", 5, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.4 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteValueToDPT("6/0/9", "240", 5, 4)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Lire DPT9.1 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.ReadValue("11/7/4", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteDate("11/5/0")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer l'heure actuelle :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteTime("11/5/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle en tant que DPT16 :</span><br />
<span style="color: #3333ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxcontroller.WriteTimeAsText("11/6/1")</span></span><br />
<br />
<br />
<span style="color: #ff3333;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Voici le lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KNXwrapper.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...rapper.zip</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[WinDev et le SDK Falcon 6]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8655</link>
			<pubDate>Tue, 05 Nov 2024 21:37:27 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=10826">Smart Guido 73</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8655</guid>
			<description><![CDATA[Bonjour chère communauté,<br />
<br />
Je suis nouveau sur le forum et on m'a demandé si je pouvais aider quelqu'un avec Windev. À ce moment-là, je ne connaissais pas encore ce logiciel, alors je l'ai testé et c'est ainsi que je suis tombé sur ce forum.<br />
J'y ai vu qu'il existait un fil de discussion concernant KNX dans Windev, mais uniquement en lien avec le Falcon SDK 5 et ses fonctionnalités limitées. Le Falcon SDK 6 n'était pas abordé.<br />
<br />
<br />
Ainsi, j'ai démarré mon premier projet avec Windev et j'ai écrit un wrapper C# pour le Falcon SDK 6.<br />
Ce wrapper utilise les commandes les plus courantes et permet de réaliser un grand nombre de fonctions.<br />
<br />
<span style="color: #339966;" class="mycode_color">Les fonctionnalités incluent par exemple :</span><br />
<br />
<span style="color: #339966;" class="mycode_color">    - Établir une connexion USB</span><br />
<span style="color: #339966;" class="mycode_color">    - Connexion IP, y compris avec des Secure Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Envoi de valeurs dans différents DPTS (y compris DPT10, DPT11 et date sous DPT16) </span><br />
<span style="color: #339966;" class="mycode_color">    - Interrogation de valeurs au format Raw ainsi qu'au format DPT</span><br />
<span style="color: #339966;" class="mycode_color">    - Lecture des données reçues, permettant de réagir aux télégrammes entrants</span><br />
<span style="color: #339966;" class="mycode_color">    - Recherche de IP Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Recherche de IP Secure Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Sauvegarde des 100 derniers télégrammes</span><br />
<span style="color: #339966;" class="mycode_color">    - Chargement de la liste d'adresses de groupe depuis le DPT (export de l'ETS)</span><br />
<br />
Le fichier à télécharger contient un exemple de code que j'ai écrit et testé avec la version gratuite de WinDev 28 Express. Le Falcon SDK 6 est également inclus dans le fichier. <br />
L'exemple de code est un simple moniteur de bus qui, lorsque la liste d'adresses de groupe exportée depuis ETS est ajoutée, affiche également les types DPT (types de points de données) ainsi que les identificateurs textuels correspondants des adresses de groupe.<br />
<br />
<span style="color: #336633;" class="mycode_color"><span style="text-decoration: underline;" class="mycode_u">Avant d'utiliser, il est nécessaire d'enregistrer la DLL signée du Falcon SDK :</span></span><br />
<span style="color: #336633;" class="mycode_color">1. Copiez le dossier "Falcon SDK 6 Signé" dans vos documents.</span><br />
<span style="color: #336633;" class="mycode_color">2. Ouvrez l'invite de commande (CMD) en tant qu'administrateur.</span><br />
<span style="color: #336633;" class="mycode_color">3. Allez dans le dossier </span><span style="color: #3366ff;" class="mycode_color">C:\Windows\Microsoft.NET\Framework\v4.0.30319</span><span style="color: #336633;" class="mycode_color">.</span><br />
<span style="color: #336633;" class="mycode_color">4. Enregistrez la DLL avec la commande suivante : </span><span style="color: #3366ff;" class="mycode_color">regasm "C:\Users\Utilisateur\Documents\Falcon SDK 6 Signé\KNXlib.dll" /tlb:KNXlib.tlb /codebase</span><br />
<span style="color: #336633;" class="mycode_color">5. Ensuite, allez dans le dossier </span><span style="color: #3366ff;" class="mycode_color">C:\Windows\Microsoft.NET\Framework64\v4.0.30319</span><span style="color: #336633;" class="mycode_color">.</span><br />
<span style="color: #336633;" class="mycode_color">6. Enregistrez à nouveau la DLL avec la même commande : </span><span style="color: #3366ff;" class="mycode_color">regasm "C:\Users\Utilisateur\Documents\Falcon SDK 6 Signé\KNXlib.dll" /tlb:KNXlib.tlb /codebase</span><br />
<span style="color: #336633;" class="mycode_color">7. Si un message d'erreur indique que l'enregistrement a été bloqué, il peut être nécessaire de désactiver la fonction "Accès protégé aux dossiers".</span><br />
<span style="color: #336633;" class="mycode_color">8. Vous pouvez vérifier l'enregistrement réussi dans le Registre :</span><br />
<span style="color: #336633;" class="mycode_color">   Appuyez sur </span><span style="color: #3366ff;" class="mycode_color">[Windows]+R</span><span style="color: #336633;" class="mycode_color"> et tapez regedit pour ouvrir l'éditeur de registre.</span><br />
<span style="color: #336633;" class="mycode_color">   Vérifiez les chemins suivants :</span><br />
<span style="color: #ff6633;" class="mycode_color">  </span><span style="color: #ff6633;" class="mycode_color"> Ordinateur\HKEY_CLASSES_ROOT\CLSID{E45D1244-ABCD-4E1D-8D9F-9992B7F017A2}  </span><br />
<span style="color: #ff6633;" class="mycode_color">   </span><span style="color: #ff6633;" class="mycode_color">Ordinateur\HKEY_CLASSES_ROOT\WOW6432Node\CLSID{E45D1244-ABCD-4E1D-8D9F-9992B7F017A2}</span><br />
<br />
<br />
Exemples de code :<br />
<br />
<span style="color: #993333;" class="mycode_color">Établir une connexion USB :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()</span></span><span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color"><br />
knxCon.ConnectUSB()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxIp is string = "192.168.178.42"<br />
knxCon.Connect(knxIp, 3671, False)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP sécurisée :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()<br />
knxIp is string = "192.168.178.42"</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon.ConnectSecure(knxIp, 3671, False, "1.1.243", " file.knxkeys", "password")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteBool("1/0/0" , True)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT9.1 :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon.WriteValueToDPT(Groupaddress, value as string, DPTupper value, DPTlower value)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3366ff;" class="mycode_color">knxCon.WriteValueToDPT("11/7/4", "20.5", 9, 1)</span></span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">A lire :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">value is string  = knxCon.ReadValueAsync("11/7/4")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteValueToDPT("6/0/9", "90", 5, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.4 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteValueToDPT("6/0/9", "240", 5, 4)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Lire DPT9.1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">tempvalue is string = knxCon.ReadValue("11/7/4", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteDate("11/5/0")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer l'heure actuelle :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteTime("11/5/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle en tant que DPT16 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteTimeAsText("11/6/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">La routine affiche les télégrammes actuellement reçus et démarre une action pour un télégramme spécifique :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">IF knxCon.receiveValue.Count &gt; lastcountinfo THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    IF knxCon.receiveValue.Count &gt;= 100 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        knxCon.receiveValue.Clear()  </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        lastcountinfo = 0 </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    ELSE</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        FOR i = lastcountinfo TO knxCon.receiveValue.Count - 1</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x1 is string = knxCon.GetReceiveDataValueAt(i, "date") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x2 is string = knxCon.GetReceiveDataValueAt(i, "time") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x3 is string = knxCon.GetReceiveDataValueAt(i, "paddress") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x4 is string = knxCon.GetReceiveDataValueAt(i, "gaddress")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x5 is string = knxCon.GetReceiveDataValueAt(i, "prio")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x6 is string = knxCon.GetReceiveDataValueAt(i, "issecure")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x7 is string = knxCon.GetReceiveDataValueAt(i, "hopcount")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x8 is string = knxCon.GetReceiveDataValueAt(i, "eventtype")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x9 is string = knxCon.GetReceiveDataValueAt(i, "value")        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">                </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">               </span><span style="color: #3333cc;" class="mycode_color"> IF x4 = "10/0/3" AND x9 = 0 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                    STC_NoName1.Text = "Hit the value !"        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                    knxCon.WriteByte("6/0/9", 10)             </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">                </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            LIST_NoName5.Add(x1 + " - " + x2 + " - " + x3 + " - " + x4 + " - " + x5 + " - " + x6 + " - " + x7 + " - " + x8 + " - " + x9) </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        lastcountinfo = knxCon.receiveValue.Count </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        IF LIST_NoName5.Count &lt;&gt; 0 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            ListPosition(LIST_NoName5, LIST_NoName5.Count)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">END</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Chargement du fichier d'adresses de groupe XML :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.LoadDptList("knxdptlist.xml</span></span><span style="color: #3366ff;" class="mycode_color">")</span><br />
<br />
<br />
J'espère que cela vous aidera et que vous vous en sortirez jusqu'à présent. Je n'ai pu le tester que tant que la version démo me le permettait.<br />
<br />
<span style="color: #ff3333;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KNXwrapper.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...rapper.zip</a><br />
<br />
Bonne chance]]></description>
			<content:encoded><![CDATA[Bonjour chère communauté,<br />
<br />
Je suis nouveau sur le forum et on m'a demandé si je pouvais aider quelqu'un avec Windev. À ce moment-là, je ne connaissais pas encore ce logiciel, alors je l'ai testé et c'est ainsi que je suis tombé sur ce forum.<br />
J'y ai vu qu'il existait un fil de discussion concernant KNX dans Windev, mais uniquement en lien avec le Falcon SDK 5 et ses fonctionnalités limitées. Le Falcon SDK 6 n'était pas abordé.<br />
<br />
<br />
Ainsi, j'ai démarré mon premier projet avec Windev et j'ai écrit un wrapper C# pour le Falcon SDK 6.<br />
Ce wrapper utilise les commandes les plus courantes et permet de réaliser un grand nombre de fonctions.<br />
<br />
<span style="color: #339966;" class="mycode_color">Les fonctionnalités incluent par exemple :</span><br />
<br />
<span style="color: #339966;" class="mycode_color">    - Établir une connexion USB</span><br />
<span style="color: #339966;" class="mycode_color">    - Connexion IP, y compris avec des Secure Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Envoi de valeurs dans différents DPTS (y compris DPT10, DPT11 et date sous DPT16) </span><br />
<span style="color: #339966;" class="mycode_color">    - Interrogation de valeurs au format Raw ainsi qu'au format DPT</span><br />
<span style="color: #339966;" class="mycode_color">    - Lecture des données reçues, permettant de réagir aux télégrammes entrants</span><br />
<span style="color: #339966;" class="mycode_color">    - Recherche de IP Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Recherche de IP Secure Gateways</span><br />
<span style="color: #339966;" class="mycode_color">    - Sauvegarde des 100 derniers télégrammes</span><br />
<span style="color: #339966;" class="mycode_color">    - Chargement de la liste d'adresses de groupe depuis le DPT (export de l'ETS)</span><br />
<br />
Le fichier à télécharger contient un exemple de code que j'ai écrit et testé avec la version gratuite de WinDev 28 Express. Le Falcon SDK 6 est également inclus dans le fichier. <br />
L'exemple de code est un simple moniteur de bus qui, lorsque la liste d'adresses de groupe exportée depuis ETS est ajoutée, affiche également les types DPT (types de points de données) ainsi que les identificateurs textuels correspondants des adresses de groupe.<br />
<br />
<span style="color: #336633;" class="mycode_color"><span style="text-decoration: underline;" class="mycode_u">Avant d'utiliser, il est nécessaire d'enregistrer la DLL signée du Falcon SDK :</span></span><br />
<span style="color: #336633;" class="mycode_color">1. Copiez le dossier "Falcon SDK 6 Signé" dans vos documents.</span><br />
<span style="color: #336633;" class="mycode_color">2. Ouvrez l'invite de commande (CMD) en tant qu'administrateur.</span><br />
<span style="color: #336633;" class="mycode_color">3. Allez dans le dossier </span><span style="color: #3366ff;" class="mycode_color">C:\Windows\Microsoft.NET\Framework\v4.0.30319</span><span style="color: #336633;" class="mycode_color">.</span><br />
<span style="color: #336633;" class="mycode_color">4. Enregistrez la DLL avec la commande suivante : </span><span style="color: #3366ff;" class="mycode_color">regasm "C:\Users\Utilisateur\Documents\Falcon SDK 6 Signé\KNXlib.dll" /tlb:KNXlib.tlb /codebase</span><br />
<span style="color: #336633;" class="mycode_color">5. Ensuite, allez dans le dossier </span><span style="color: #3366ff;" class="mycode_color">C:\Windows\Microsoft.NET\Framework64\v4.0.30319</span><span style="color: #336633;" class="mycode_color">.</span><br />
<span style="color: #336633;" class="mycode_color">6. Enregistrez à nouveau la DLL avec la même commande : </span><span style="color: #3366ff;" class="mycode_color">regasm "C:\Users\Utilisateur\Documents\Falcon SDK 6 Signé\KNXlib.dll" /tlb:KNXlib.tlb /codebase</span><br />
<span style="color: #336633;" class="mycode_color">7. Si un message d'erreur indique que l'enregistrement a été bloqué, il peut être nécessaire de désactiver la fonction "Accès protégé aux dossiers".</span><br />
<span style="color: #336633;" class="mycode_color">8. Vous pouvez vérifier l'enregistrement réussi dans le Registre :</span><br />
<span style="color: #336633;" class="mycode_color">   Appuyez sur </span><span style="color: #3366ff;" class="mycode_color">[Windows]+R</span><span style="color: #336633;" class="mycode_color"> et tapez regedit pour ouvrir l'éditeur de registre.</span><br />
<span style="color: #336633;" class="mycode_color">   Vérifiez les chemins suivants :</span><br />
<span style="color: #ff6633;" class="mycode_color">  </span><span style="color: #ff6633;" class="mycode_color"> Ordinateur\HKEY_CLASSES_ROOT\CLSID{E45D1244-ABCD-4E1D-8D9F-9992B7F017A2}  </span><br />
<span style="color: #ff6633;" class="mycode_color">   </span><span style="color: #ff6633;" class="mycode_color">Ordinateur\HKEY_CLASSES_ROOT\WOW6432Node\CLSID{E45D1244-ABCD-4E1D-8D9F-9992B7F017A2}</span><br />
<br />
<br />
Exemples de code :<br />
<br />
<span style="color: #993333;" class="mycode_color">Établir une connexion USB :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()</span></span><span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color"><br />
knxCon.ConnectUSB()</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #6666ff;" class="mycode_color">knxIp is string = "192.168.178.42"<br />
knxCon.Connect(knxIp, 3671, False)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Connectez-vous à la passerelle IP sécurisée :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon is KNXlib.KnxController<br />
knxCon &lt;- new KNXlib.KnxController()<br />
knxIp is string = "192.168.178.42"</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon.ConnectSecure(knxIp, 3671, False, "1.1.243", " file.knxkeys", "password")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteBool("1/0/0" , True)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer DPT9.1 :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">knxCon.WriteValueToDPT(Groupaddress, value as string, DPTupper value, DPTlower value)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color"><span style="color: #3366ff;" class="mycode_color">knxCon.WriteValueToDPT("11/7/4", "20.5", 9, 1)</span></span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">A lire :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">value is string  = knxCon.ReadValueAsync("11/7/4")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteValueToDPT("6/0/9", "90", 5, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoi DPT5.4 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteValueToDPT("6/0/9", "240", 5, 4)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Lire DPT9.1 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">tempvalue is string = knxCon.ReadValue("11/7/4", 9, 1)</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteDate("11/5/0")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer l'heure actuelle :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteTime("11/5/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Envoyer la date actuelle en tant que DPT16 :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.WriteTimeAsText("11/6/1")</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">La routine affiche les télégrammes actuellement reçus et démarre une action pour un télégramme spécifique :</span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">IF knxCon.receiveValue.Count &gt; lastcountinfo THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    IF knxCon.receiveValue.Count &gt;= 100 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        knxCon.receiveValue.Clear()  </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        lastcountinfo = 0 </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    ELSE</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        FOR i = lastcountinfo TO knxCon.receiveValue.Count - 1</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x1 is string = knxCon.GetReceiveDataValueAt(i, "date") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x2 is string = knxCon.GetReceiveDataValueAt(i, "time") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x3 is string = knxCon.GetReceiveDataValueAt(i, "paddress") </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x4 is string = knxCon.GetReceiveDataValueAt(i, "gaddress")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x5 is string = knxCon.GetReceiveDataValueAt(i, "prio")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x6 is string = knxCon.GetReceiveDataValueAt(i, "issecure")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x7 is string = knxCon.GetReceiveDataValueAt(i, "hopcount")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x8 is string = knxCon.GetReceiveDataValueAt(i, "eventtype")</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            x9 is string = knxCon.GetReceiveDataValueAt(i, "value")        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">                </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">               </span><span style="color: #3333cc;" class="mycode_color"> IF x4 = "10/0/3" AND x9 = 0 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                    STC_NoName1.Text = "Hit the value !"        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                    knxCon.WriteByte("6/0/9", 10)             </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333cc;" class="mycode_color">                END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">                </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            LIST_NoName5.Add(x1 + " - " + x2 + " - " + x3 + " - " + x4 + " - " + x5 + " - " + x6 + " - " + x7 + " - " + x8 + " - " + x9) </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        lastcountinfo = knxCon.receiveValue.Count </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        </span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        IF LIST_NoName5.Count &lt;&gt; 0 THEN</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">            ListPosition(LIST_NoName5, LIST_NoName5.Count)</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">        END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">    END</span></span><br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3366ff;" class="mycode_color">END</span></span><br />
<br />
<span style="color: #993333;" class="mycode_color">Chargement du fichier d'adresses de groupe XML :</span><br />
<span style="color: #3366ff;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">knxCon.LoadDptList("knxdptlist.xml</span></span><span style="color: #3366ff;" class="mycode_color">")</span><br />
<br />
<br />
J'espère que cela vous aidera et que vous vous en sortirez jusqu'à présent. Je n'ai pu le tester que tant que la version démo me le permettait.<br />
<br />
<span style="color: #ff3333;" class="mycode_color"><span style="font-weight: bold;" class="mycode_b">Lien de téléchargement :</span></span><br />
<a href="https://www.knx-board.org/download.php?file=KNXwrapper.zip" target="_blank" rel="noopener" class="mycode_url">https://www.knx-board.org/download.php?f...rapper.zip</a><br />
<br />
Bonne chance]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[DOMOVEA TJA450 hs bascule vers JEEDOM]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8642</link>
			<pubDate>Fri, 25 Oct 2024 13:51:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=3170">stephan</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8642</guid>
			<description><![CDATA[Bonjour a tous,<br />
<br />
Suite a une galère avec mon TJA450 qui viens de me lâcher, j'ai installé JEEDOM 4 + plugin KNK sur un Raspebby 4.<br />
Install sans souci et ma passerelle SIEMENS dialogue bien avec jeedom (quand j'allume une lumière depuis l'interrupteur j'ai une remonté sur le bus jeedom).<br />
<br />
Toute ma maison est sous ETS5 et est fonctionnelle sauf que je n'ai plus les programmations des volet roulants ouverture et fermeture a certaine heure.<br />
<br />
Je n'arrive pas voir comment recréé mes Groupe d'adresse et les actionneurs sur JEEDOM et comme un pépin n'arrive jamais seul, nous partons en congé dimanche et pas envie que la maison soit fermé pendant notre absence.<br />
<br />
L'un d'entre aurait il un tuto ou un exemple pour que j'arrive a cree rapidement l'ouverture et fermeture des volets sur jeedom<br />
<br />
MErci a tous pour votre aide<br />
<br />
 Stephane]]></description>
			<content:encoded><![CDATA[Bonjour a tous,<br />
<br />
Suite a une galère avec mon TJA450 qui viens de me lâcher, j'ai installé JEEDOM 4 + plugin KNK sur un Raspebby 4.<br />
Install sans souci et ma passerelle SIEMENS dialogue bien avec jeedom (quand j'allume une lumière depuis l'interrupteur j'ai une remonté sur le bus jeedom).<br />
<br />
Toute ma maison est sous ETS5 et est fonctionnelle sauf que je n'ai plus les programmations des volet roulants ouverture et fermeture a certaine heure.<br />
<br />
Je n'arrive pas voir comment recréé mes Groupe d'adresse et les actionneurs sur JEEDOM et comme un pépin n'arrive jamais seul, nous partons en congé dimanche et pas envie que la maison soit fermé pendant notre absence.<br />
<br />
L'un d'entre aurait il un tuto ou un exemple pour que j'arrive a cree rapidement l'ouverture et fermeture des volets sur jeedom<br />
<br />
MErci a tous pour votre aide<br />
<br />
 Stephane]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[NR] Section Node-RED]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8601</link>
			<pubDate>Thu, 19 Sep 2024 09:57:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=1754">filou59</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8601</guid>
			<description><![CDATA[Il y a matiere a faire des sujets / tuto Node-RED<br />
<br />
On associe souvent Node-RED a Home Assistant, mais ce sont 2 choses différentes.<br />
<br />
Pensez-vous qu'il faille mettre en place une section dédié a Node-RED ?<br />
Ou est-ce que l'on classe les sujets Node-RED dans HA ?]]></description>
			<content:encoded><![CDATA[Il y a matiere a faire des sujets / tuto Node-RED<br />
<br />
On associe souvent Node-RED a Home Assistant, mais ce sont 2 choses différentes.<br />
<br />
Pensez-vous qu'il faille mettre en place une section dédié a Node-RED ?<br />
Ou est-ce que l'on classe les sujets Node-RED dans HA ?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Cherche Aide pour un petit Script]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8582</link>
			<pubDate>Thu, 12 Sep 2024 07:55:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=1754">filou59</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8582</guid>
			<description><![CDATA[Hello<br />
<br />
Comme j'ai commencé a l'expliqué <a href="https://www.knx-fr.com/showthread.php?tid=8417&amp;pid=63758#pid63758" target="_blank" rel="noopener" class="mycode_url">ici</a> je suis en train de traduire des produits du projet OpenKNX fait par des allemand.<br />
<br />
On a donc 2 type de chose a traduire, un fichier XML, puis des fichiers texte qui contiennent l'aide interactive dans ETS.<br />
<br />
Dans le fichier XML on par exemple ceci : <br />
&lt;Enumeration Text="Präsenzmelder" Value="2" Id="M-00FA_A-A012-32-0000_PT-ModuleSelector_EN-2" /&gt;<br />
&lt;ParameterSeparator Id="M-00FA_A-A012-32-0000_PS-212" Text="In der gesamten Applikation wird vom Präsenzmelder gesprochen. Ob sich die Applikation als Präsenz- oder als Bewegungsmelder verhält, wird von der verwendeten Hardware (Präsenz-Sensor) bestimmt." /&gt;[/code]<br />
<br />
Pour le moment j'ai fais du Recherche et Remplace dans Notepad++ pour valider le concept et pour voir si ca fonctionne ensuite dans ETS, comme je ne regénère pas une nouvelle version d'application il faut ruser un peu, mais bon ca marche et le problème est pas là.<br />
<br />
Je souhaiterais automatiser la traduction, faire une petite application ou un script qui fasse le boulot : <br />
L'idée serait de rechercher toute les occurence d'une chaine de caractère avec les guillemets et de la remplacer par une autre<br />
Le script devrait parcourir un fichier CSV qui contiendrait le dico de conversion : <br />
Exemple : <br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>original,change to<br />
"Präsenzmelder","Détecteur de présence"<br />
"Ja","Oui"</code></div></div><br />
Pourquoi je précise avec les guillemets, car un même mot peu etre utilisé dans plusieurs context, seul ou dans une phrase ou dans un groupe de mot :<br />
Exemple ici : <br />
"In der gesamten Applikation wird vom Präsenzmelder gesprochen. Ob sich die Applikation als Präsenz- oder als Bewegungsmelder verhält, wird von der verwendeten Hardware (Präsenz-Sensor) bestimmt."<br />
si on remplace d'abord Präsenzmelder et que l'on recherche ensuite l'occurence de la phrase complete elle ne sera plus trouvé et on ne pourra pas la traduire par ca :<br />
"Dans toute l'application, on parle de détecteur de présence. C'est le matériel utilisé (capteur de présence) qui détermine si l'application se comporte comme un détecteur de présence ou comme un détecteur de mouvement"<br />
<br />
J'ai trouvé un script python qui fonctionne mais sans les guillemets, je pense pas que ce soit bien compliqué pour qq maitrisant la prog, donc si qq a une solution, ce serait sympa <br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>import lxml.html&nbsp;&nbsp; # check https://pypi.org/project/lxml/<br />
from csv import reader<br />
from os.path import exists<br />
import glob<br />
<br />
<br />
def update_xml(path: str) -&gt; None:<br />
&nbsp;&nbsp;&nbsp;&nbsp;with open('./convertions.csv', 'r') as convertions, open(path, 'r') as annotation:&nbsp;&nbsp;# noqa: E501<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tree = lxml.html.fromstring(annotation.read())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csv_reader = reader(convertions)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for idx, row in enumerate(csv_reader, start=1):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if idx == 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;original, change_to = row<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tags = tree.xpath(f".//name[text()='{original}']")<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for tag in tags:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tag.text = change_to<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Changed class {original} to {change_to} in {path}')<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;with open(path, 'wb') as annotation:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new_content = lxml.html.tostring(tree)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if new_content.strip():<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;annotation.write(new_content)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;print(f'Processing on {path} done')<br />
<br />
<br />
if __name__ == '__main__':<br />
&nbsp;&nbsp;&nbsp;&nbsp;for xml_file in glob.glob('*.xml'):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if exists(xml_file):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update_xml(path=xml_file)</code></div></div>]]></description>
			<content:encoded><![CDATA[Hello<br />
<br />
Comme j'ai commencé a l'expliqué <a href="https://www.knx-fr.com/showthread.php?tid=8417&amp;pid=63758#pid63758" target="_blank" rel="noopener" class="mycode_url">ici</a> je suis en train de traduire des produits du projet OpenKNX fait par des allemand.<br />
<br />
On a donc 2 type de chose a traduire, un fichier XML, puis des fichiers texte qui contiennent l'aide interactive dans ETS.<br />
<br />
Dans le fichier XML on par exemple ceci : <br />
&lt;Enumeration Text="Präsenzmelder" Value="2" Id="M-00FA_A-A012-32-0000_PT-ModuleSelector_EN-2" /&gt;<br />
&lt;ParameterSeparator Id="M-00FA_A-A012-32-0000_PS-212" Text="In der gesamten Applikation wird vom Präsenzmelder gesprochen. Ob sich die Applikation als Präsenz- oder als Bewegungsmelder verhält, wird von der verwendeten Hardware (Präsenz-Sensor) bestimmt." /&gt;[/code]<br />
<br />
Pour le moment j'ai fais du Recherche et Remplace dans Notepad++ pour valider le concept et pour voir si ca fonctionne ensuite dans ETS, comme je ne regénère pas une nouvelle version d'application il faut ruser un peu, mais bon ca marche et le problème est pas là.<br />
<br />
Je souhaiterais automatiser la traduction, faire une petite application ou un script qui fasse le boulot : <br />
L'idée serait de rechercher toute les occurence d'une chaine de caractère avec les guillemets et de la remplacer par une autre<br />
Le script devrait parcourir un fichier CSV qui contiendrait le dico de conversion : <br />
Exemple : <br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>original,change to<br />
"Präsenzmelder","Détecteur de présence"<br />
"Ja","Oui"</code></div></div><br />
Pourquoi je précise avec les guillemets, car un même mot peu etre utilisé dans plusieurs context, seul ou dans une phrase ou dans un groupe de mot :<br />
Exemple ici : <br />
"In der gesamten Applikation wird vom Präsenzmelder gesprochen. Ob sich die Applikation als Präsenz- oder als Bewegungsmelder verhält, wird von der verwendeten Hardware (Präsenz-Sensor) bestimmt."<br />
si on remplace d'abord Präsenzmelder et que l'on recherche ensuite l'occurence de la phrase complete elle ne sera plus trouvé et on ne pourra pas la traduire par ca :<br />
"Dans toute l'application, on parle de détecteur de présence. C'est le matériel utilisé (capteur de présence) qui détermine si l'application se comporte comme un détecteur de présence ou comme un détecteur de mouvement"<br />
<br />
J'ai trouvé un script python qui fonctionne mais sans les guillemets, je pense pas que ce soit bien compliqué pour qq maitrisant la prog, donc si qq a une solution, ce serait sympa <br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>import lxml.html&nbsp;&nbsp; # check https://pypi.org/project/lxml/<br />
from csv import reader<br />
from os.path import exists<br />
import glob<br />
<br />
<br />
def update_xml(path: str) -&gt; None:<br />
&nbsp;&nbsp;&nbsp;&nbsp;with open('./convertions.csv', 'r') as convertions, open(path, 'r') as annotation:&nbsp;&nbsp;# noqa: E501<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tree = lxml.html.fromstring(annotation.read())<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csv_reader = reader(convertions)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for idx, row in enumerate(csv_reader, start=1):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if idx == 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;original, change_to = row<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tags = tree.xpath(f".//name[text()='{original}']")<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for tag in tags:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tag.text = change_to<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(f'Changed class {original} to {change_to} in {path}')<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;with open(path, 'wb') as annotation:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new_content = lxml.html.tostring(tree)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if new_content.strip():<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;annotation.write(new_content)<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;print(f'Processing on {path} done')<br />
<br />
<br />
if __name__ == '__main__':<br />
&nbsp;&nbsp;&nbsp;&nbsp;for xml_file in glob.glob('*.xml'):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if exists(xml_file):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update_xml(path=xml_file)</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[pKNyX] Nouveautés]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8549</link>
			<pubDate>Sat, 03 Aug 2024 08:23:41 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=12">fma38</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8549</guid>
			<description><![CDATA[Hello !<br />
<br />
Voilà une paire d'année que j'ai quelques services basés sur mon framework pKNyX, qui tournent H24 sans aucun souci.<br />
<br />
Mais pKNyX a été initialement développé en Python2, et aujourd'hui, cette version de Python est abandonnée sur la plupart des distros linux.<br />
<br />
Du coup, je viens de le migrer pour Python3 !<br />
<br />
<a href="https://framagit.org/fma38/pKNyX" target="_blank" rel="noopener" class="mycode_url">https://framagit.org/fma38/pKNyX</a><br />
<br />
(il faut que je génère un nouveau tag stable, j'ai fait des corrections depuis le tag 1.1.0).<br />
<br />
L'idée derrière pKNyX a toujours été de créer des devices virtuels. J'ai par exemple une passerelle pour ma VMC double flux Helios, qui tourne sur mon ancien routeur, lequel sert plus qu'à ça depuis que j'ai la fibre. C'est un peu ballo ! Du coup, je me suis lancé dans la migration pour <span style="font-weight: bold;" class="mycode_b">Micropython</span>, afin de pouvoir faire tourner cette passerelle sur une carte à microcontrôleur genre RPi Pico W, ou à base d'ESP32.<br />
<br />
La seconde étape a donc été de migrer les threads vers les coroutines (asyncio) :<br />
<br />
<a href="https://framagit.org/fma38/pKNyX/-/tree/asyncio?ref_type=heads" target="_blank" rel="noopener" class="mycode_url">https://framagit.org/fma38/pKNyX/-/tree/...type=heads</a><br />
<br />
Enfin, j'ai créé une nouvelle version, nommée, <span style="font-weight: bold;" class="mycode_b">upKNyX</span>, spécifiquement conçue pour tourner sous Micropython. Le dépôt n'est pas encore public, mais sachez que ça marche déjà nickel sur le portage linux de Micropython !<br />
<br />
Hier soir, j'ai fait un déploiement rapide sur une RPi Pico W, et je tombe sur un premier souci qui est l'occupation mémoire ; il va falloir que j'optimise les choses, et sans doute que je taille dans le gras pour alléger le truc. J'espère pouvoir garder l'esprit, qui est de pouvoir déployer des choses de manière super simple.<br />
<br />
L'autre souci, c'est que pour le moment, les trames Multicast n'ont pas l'air de passer... Je ferai un test sur ESP32, pour voir si ça ne vient pas du chip wifi de la Pico W.<br />
<br />
Voili-voilou. Je ne sais pas si ça intéressera beaucoup de monde, mais de mon côté, ça va bien me servir. N'hésitez pas à commenter/suggérer !]]></description>
			<content:encoded><![CDATA[Hello !<br />
<br />
Voilà une paire d'année que j'ai quelques services basés sur mon framework pKNyX, qui tournent H24 sans aucun souci.<br />
<br />
Mais pKNyX a été initialement développé en Python2, et aujourd'hui, cette version de Python est abandonnée sur la plupart des distros linux.<br />
<br />
Du coup, je viens de le migrer pour Python3 !<br />
<br />
<a href="https://framagit.org/fma38/pKNyX" target="_blank" rel="noopener" class="mycode_url">https://framagit.org/fma38/pKNyX</a><br />
<br />
(il faut que je génère un nouveau tag stable, j'ai fait des corrections depuis le tag 1.1.0).<br />
<br />
L'idée derrière pKNyX a toujours été de créer des devices virtuels. J'ai par exemple une passerelle pour ma VMC double flux Helios, qui tourne sur mon ancien routeur, lequel sert plus qu'à ça depuis que j'ai la fibre. C'est un peu ballo ! Du coup, je me suis lancé dans la migration pour <span style="font-weight: bold;" class="mycode_b">Micropython</span>, afin de pouvoir faire tourner cette passerelle sur une carte à microcontrôleur genre RPi Pico W, ou à base d'ESP32.<br />
<br />
La seconde étape a donc été de migrer les threads vers les coroutines (asyncio) :<br />
<br />
<a href="https://framagit.org/fma38/pKNyX/-/tree/asyncio?ref_type=heads" target="_blank" rel="noopener" class="mycode_url">https://framagit.org/fma38/pKNyX/-/tree/...type=heads</a><br />
<br />
Enfin, j'ai créé une nouvelle version, nommée, <span style="font-weight: bold;" class="mycode_b">upKNyX</span>, spécifiquement conçue pour tourner sous Micropython. Le dépôt n'est pas encore public, mais sachez que ça marche déjà nickel sur le portage linux de Micropython !<br />
<br />
Hier soir, j'ai fait un déploiement rapide sur une RPi Pico W, et je tombe sur un premier souci qui est l'occupation mémoire ; il va falloir que j'optimise les choses, et sans doute que je taille dans le gras pour alléger le truc. J'espère pouvoir garder l'esprit, qui est de pouvoir déployer des choses de manière super simple.<br />
<br />
L'autre souci, c'est que pour le moment, les trames Multicast n'ont pas l'air de passer... Je ferai un test sur ESP32, pour voir si ça ne vient pas du chip wifi de la Pico W.<br />
<br />
Voili-voilou. Je ne sais pas si ça intéressera beaucoup de monde, mais de mon côté, ça va bien me servir. N'hésitez pas à commenter/suggérer !]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Frigate NVR]]></title>
			<link>https://www.knx-fr.com/showthread.php?tid=8519</link>
			<pubDate>Thu, 09 May 2024 21:55:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.knx-fr.com/member.php?action=profile&uid=1754">filou59</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.knx-fr.com/showthread.php?tid=8519</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b"><a href="https://frigate.video/" target="_blank" rel="noopener" class="mycode_url">Frigate c'est quoi</a> : </span>C'est un NVR open source <br />
<br />
NVR : Network Video Recorder, Un truc qui permet d'enregistrer les video de vos caméra en gros  <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> <br />
<br />
Voici la présentation tiré de leur site :<br />
<br />
<blockquote class="mycode_quote"><cite>Citation :</cite><span style="font-weight: bold;" class="mycode_b">Surveillez vos caméras de sécurité avec une IA traitée localement</span><br />
<br />
Frigate est un NVR open source construit autour de la détection d'objets IA en temps réel. Tout le traitement est effectué localement sur votre propre matériel et les flux de vos caméras ne quittent jamais votre domicile.</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">Home Assistant: </span><br />
Frigate s'intègre facilement a HA.<br />
Peut importe la méthode, je vous conseille d'installer Frigate de maniere séparé a Home Assistant. Ca peut être sur la meme machine mais dans une VM ou un container a part.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Materiel Recommandé :</span><br />
Vous trouverez le materiel recommandé : <a href="https://docs.frigate.video/frigate/hardware" target="_blank" rel="noopener" class="mycode_url">https://docs.frigate.video/frigate/hardware</a><br />
Pour un bien Frigate necessite du materiel capable de faire la travail d'analyse video, pour eviter que ca passe par le CPU il existe des petites cartes qui permettent de faire ce travail. <br />
Frigate appel ca : Detectors.<br />
Les plus connu sont probablement les Google Coral, qui existe en plusieurs version : USB/NVMe/M.2...<br />
Mais il y a aussi du materiel récent qui embarque des détecteurd compatible sur des architecture Intel/AMD...<br />
<br />
Avant de vous jeter sur l'achat d'un module, réfléchissez bien a comment vous allez faire tourner Frigate, cherchez des tuto a la recherche de toutes les astuces.<br />
<br />
Il faut aussi penser DDur, il y a des série qui sont plus approprié a ce type d'usage qui sollicité en permanence les ddur.<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">Comment on fait tourner ca : </span></span><br />
On peut le faire tourner de plusieurs façon :<br />
<ol type="1" class="mycode_list"><li>Sur une machine dédié<br />
</li>
<li>Sur une VM (Dans Proxmox par exemple)<br />
</li>
<li>Dans un container LXC (plusieurs manière aussi de faire je pense là aussi)<br />
</li>
<li>...<br />
</li>
</ol>
<span style="font-weight: bold;" class="mycode_b">Installation de Frigate :</span><br />
<br />
Frigrate tourne normalement sous Docker.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1. Sur une Machine Dédié</span> : <br />
Il n'y a qu'a suivre le site<br />
Cette méthode est probablement la plus simple. <br />
<br />
Par contre ca vaut le coup de se donner un peu de peine de regarder un peu coté virtualisation je pense, car la virtualisation apporte pas mal d'atout en therme de backup par exemple. <br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2.Sur proxmox : </span><br />
Frigate recommande un container LXC plutôt qu'une VM, par contre c'est pas la partie la plus facile. Enfin oui et non, quand on recolte les bonnes info a droite et gauche ca le fait.<br />
<br />
Pour une install sur une VM, le passage d'une clé Coral a la VM nécessite quand même quelque manip. C'est pas forcément le plus simple.<br />
On trouve des tuto sur le NET, mais attention, en fonction de votre plateforme Intel/AMD il faudra adapter certaine étape.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Option 1 : Sur une VM</span><br />
Creer une VM Debian ou ubuntu<br />
Installer Docker<br />
Installer Frigate<br />
* Si on utilise un Detecteur Type Google Coral, il faudra faire du Passthrough de périphérique PCIe/USB<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Option 2 : Dans CT LXC via Script tteck</span><br />
<a href="https://tteck.github.io/Proxmox/" target="_blank" rel="noopener" class="mycode_url">tteck </a>propose un script d'installation de Frigate pour un Container LXC, il me semble qu'il n'utilise pas docker.<br />
<br />
<blockquote class="mycode_quote"><cite>Citation :</cite><span style="color: #0080c4;" class="mycode_color"><span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Frigate LXC</span></span></span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><a href="https://frigate.video/" target="_blank" rel="noopener" class="mycode_url">Frigate</a> is an open source NVR built around real-time AI object detection. All processing is performed locally on your own hardware, and your camera feeds never leave your home.</span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font">To create a new Proxmox VE Frigate LXC, run the command below in the <span style="font-weight: bold;" class="mycode_b">Proxmox VE Shell</span>.</span></span><br />
<span style="color: #eaeaea;" class="mycode_color"><span style="font-size: medium;" class="mycode_size"><span style="color: #0080c4;" class="mycode_color"><span style="font-size: small;" class="mycode_size">Copy</span></span></span></span><br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>bash -c "&#36;(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/frigate.sh)"</code></div></div><br />
<span style="color: #9b5923;" class="mycode_color"><span style="font-family: Monaco,;" class="mycode_font">⚡ Default Settings: 1GB RAM - 20GB Storage - 4vCPU ⚡</span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Frigate Interface: IP:5000</span></span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">go2rtc Interface: IP:1984</span></span></span></blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">Option 3 : Dans CT LXC via Docker</span><br />
Créer un CT LXC Debian 12<br />
Configuration du Passthrough : Il faut configurer le CT pour que l'on passe la clé USB* ou NVMe au CT<br />
Installer Docker<br />
Installer Frigate<br />
<br />
*Le passage de clé USB au container peu paraitre déroutant, car la clé change de nom quand elle n'a pas encore été utilisé et ensuite quand les drivers sont chargé (une histoire comme ca). Du coup ca complique les choses quand on veut dire a proxmox qu'il faut passer la Clé Toto quand elle s'appellait Titi 2s avant.  <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /><br />
Mais pas panique il y des solutions.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Quelques Liens utiles :</span><br />
<br />
Bon avant de vous donner plus de détail : voici qq lien qui peuvent être utile : <br />
Raynox : VM + Clé Coral USB<br />
<a href="https://www.youtube.com/watch?v=jEgKU5U4kGw" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=jEgKU5U4kGw</a><br />
<br />
apalrd : LXC + Podman  (alternative a Docker) + Coral PCIe<br />
<a href="https://www.apalrd.net/posts/2023/ultimate_frigate/" target="_blank" rel="noopener" class="mycode_url">https://www.apalrd.net/posts/2023/ultimate_frigate/</a><br />
<a href="https://www.youtube.com/watch?v=sCkswrK0G3I&amp;list=PLZcFwaChdgSrldxG1CCk_TBxVCtMT7d_0&amp;index=12" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=sCkswrK0...0&amp;index=12</a><br />
<br />
Raspberry Pi Cloud (Video En allemand, mais avec les sous titre ... )<br />
Install tteck <br />
<a href="https://www.youtube.com/watch?v=OHnLHljs_jo" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=OHnLHljs_jo</a><br />
<br />
De mon coté j'ai 3 Clé Coral : USB/PCIe Dual TPU (De mémoire)/M2. Histoire d'avoir le choix du matériel.<br />
Je n'ai pas de config hyper récente, mais je n'ai pas non plus chercher a savoir <br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #ff3333;" class="mycode_color">En cours de rédaction.</span></span>]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b"><a href="https://frigate.video/" target="_blank" rel="noopener" class="mycode_url">Frigate c'est quoi</a> : </span>C'est un NVR open source <br />
<br />
NVR : Network Video Recorder, Un truc qui permet d'enregistrer les video de vos caméra en gros  <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> <br />
<br />
Voici la présentation tiré de leur site :<br />
<br />
<blockquote class="mycode_quote"><cite>Citation :</cite><span style="font-weight: bold;" class="mycode_b">Surveillez vos caméras de sécurité avec une IA traitée localement</span><br />
<br />
Frigate est un NVR open source construit autour de la détection d'objets IA en temps réel. Tout le traitement est effectué localement sur votre propre matériel et les flux de vos caméras ne quittent jamais votre domicile.</blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">Home Assistant: </span><br />
Frigate s'intègre facilement a HA.<br />
Peut importe la méthode, je vous conseille d'installer Frigate de maniere séparé a Home Assistant. Ca peut être sur la meme machine mais dans une VM ou un container a part.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Materiel Recommandé :</span><br />
Vous trouverez le materiel recommandé : <a href="https://docs.frigate.video/frigate/hardware" target="_blank" rel="noopener" class="mycode_url">https://docs.frigate.video/frigate/hardware</a><br />
Pour un bien Frigate necessite du materiel capable de faire la travail d'analyse video, pour eviter que ca passe par le CPU il existe des petites cartes qui permettent de faire ce travail. <br />
Frigate appel ca : Detectors.<br />
Les plus connu sont probablement les Google Coral, qui existe en plusieurs version : USB/NVMe/M.2...<br />
Mais il y a aussi du materiel récent qui embarque des détecteurd compatible sur des architecture Intel/AMD...<br />
<br />
Avant de vous jeter sur l'achat d'un module, réfléchissez bien a comment vous allez faire tourner Frigate, cherchez des tuto a la recherche de toutes les astuces.<br />
<br />
Il faut aussi penser DDur, il y a des série qui sont plus approprié a ce type d'usage qui sollicité en permanence les ddur.<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #3333ff;" class="mycode_color">Comment on fait tourner ca : </span></span><br />
On peut le faire tourner de plusieurs façon :<br />
<ol type="1" class="mycode_list"><li>Sur une machine dédié<br />
</li>
<li>Sur une VM (Dans Proxmox par exemple)<br />
</li>
<li>Dans un container LXC (plusieurs manière aussi de faire je pense là aussi)<br />
</li>
<li>...<br />
</li>
</ol>
<span style="font-weight: bold;" class="mycode_b">Installation de Frigate :</span><br />
<br />
Frigrate tourne normalement sous Docker.<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">1. Sur une Machine Dédié</span> : <br />
Il n'y a qu'a suivre le site<br />
Cette méthode est probablement la plus simple. <br />
<br />
Par contre ca vaut le coup de se donner un peu de peine de regarder un peu coté virtualisation je pense, car la virtualisation apporte pas mal d'atout en therme de backup par exemple. <br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">2.Sur proxmox : </span><br />
Frigate recommande un container LXC plutôt qu'une VM, par contre c'est pas la partie la plus facile. Enfin oui et non, quand on recolte les bonnes info a droite et gauche ca le fait.<br />
<br />
Pour une install sur une VM, le passage d'une clé Coral a la VM nécessite quand même quelque manip. C'est pas forcément le plus simple.<br />
On trouve des tuto sur le NET, mais attention, en fonction de votre plateforme Intel/AMD il faudra adapter certaine étape.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Option 1 : Sur une VM</span><br />
Creer une VM Debian ou ubuntu<br />
Installer Docker<br />
Installer Frigate<br />
* Si on utilise un Detecteur Type Google Coral, il faudra faire du Passthrough de périphérique PCIe/USB<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Option 2 : Dans CT LXC via Script tteck</span><br />
<a href="https://tteck.github.io/Proxmox/" target="_blank" rel="noopener" class="mycode_url">tteck </a>propose un script d'installation de Frigate pour un Container LXC, il me semble qu'il n'utilise pas docker.<br />
<br />
<blockquote class="mycode_quote"><cite>Citation :</cite><span style="color: #0080c4;" class="mycode_color"><span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Frigate LXC</span></span></span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><a href="https://frigate.video/" target="_blank" rel="noopener" class="mycode_url">Frigate</a> is an open source NVR built around real-time AI object detection. All processing is performed locally on your own hardware, and your camera feeds never leave your home.</span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font">To create a new Proxmox VE Frigate LXC, run the command below in the <span style="font-weight: bold;" class="mycode_b">Proxmox VE Shell</span>.</span></span><br />
<span style="color: #eaeaea;" class="mycode_color"><span style="font-size: medium;" class="mycode_size"><span style="color: #0080c4;" class="mycode_color"><span style="font-size: small;" class="mycode_size">Copy</span></span></span></span><br />
<div class="codeblock"><div class="title">Code :</div><div class="body" dir="ltr"><code>bash -c "&#36;(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/frigate.sh)"</code></div></div><br />
<span style="color: #9b5923;" class="mycode_color"><span style="font-family: Monaco,;" class="mycode_font">⚡ Default Settings: 1GB RAM - 20GB Storage - 4vCPU ⚡</span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">Frigate Interface: IP:5000</span></span></span><br />
<span style="font-size: medium;" class="mycode_size"><span style="font-family: Monaco,;" class="mycode_font"><span style="font-weight: bold;" class="mycode_b">go2rtc Interface: IP:1984</span></span></span></blockquote>
<br />
<span style="font-weight: bold;" class="mycode_b">Option 3 : Dans CT LXC via Docker</span><br />
Créer un CT LXC Debian 12<br />
Configuration du Passthrough : Il faut configurer le CT pour que l'on passe la clé USB* ou NVMe au CT<br />
Installer Docker<br />
Installer Frigate<br />
<br />
*Le passage de clé USB au container peu paraitre déroutant, car la clé change de nom quand elle n'a pas encore été utilisé et ensuite quand les drivers sont chargé (une histoire comme ca). Du coup ca complique les choses quand on veut dire a proxmox qu'il faut passer la Clé Toto quand elle s'appellait Titi 2s avant.  <img src="https://www.knx-fr.com/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /><br />
Mais pas panique il y des solutions.<br />
<br />
<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Quelques Liens utiles :</span><br />
<br />
Bon avant de vous donner plus de détail : voici qq lien qui peuvent être utile : <br />
Raynox : VM + Clé Coral USB<br />
<a href="https://www.youtube.com/watch?v=jEgKU5U4kGw" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=jEgKU5U4kGw</a><br />
<br />
apalrd : LXC + Podman  (alternative a Docker) + Coral PCIe<br />
<a href="https://www.apalrd.net/posts/2023/ultimate_frigate/" target="_blank" rel="noopener" class="mycode_url">https://www.apalrd.net/posts/2023/ultimate_frigate/</a><br />
<a href="https://www.youtube.com/watch?v=sCkswrK0G3I&amp;list=PLZcFwaChdgSrldxG1CCk_TBxVCtMT7d_0&amp;index=12" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=sCkswrK0...0&amp;index=12</a><br />
<br />
Raspberry Pi Cloud (Video En allemand, mais avec les sous titre ... )<br />
Install tteck <br />
<a href="https://www.youtube.com/watch?v=OHnLHljs_jo" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/watch?v=OHnLHljs_jo</a><br />
<br />
De mon coté j'ai 3 Clé Coral : USB/PCIe Dual TPU (De mémoire)/M2. Histoire d'avoir le choix du matériel.<br />
Je n'ai pas de config hyper récente, mais je n'ai pas non plus chercher a savoir <br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #ff3333;" class="mycode_color">En cours de rédaction.</span></span>]]></content:encoded>
		</item>
	</channel>
</rss>