zivillian / ora2mqtt

GWM ORA Funky Cat to MQTT Bridge
14 stars 2 forks source link

MQTT per TLS #15

Closed smileyman-1 closed 2 months ago

smileyman-1 commented 4 months ago

Genial wäre es, wenn eine Anbindung an den MQTT-Broker per TLS auf Port 8883 möglich wäre.

zivillian commented 3 months ago

Ist bei dir ein gültiges Zertifikat im Einsatz? Andernfalls müsste die Zertifikatsvalidierung deaktiviert werden.

smileyman-1 commented 3 months ago

Hey @zivillian, ja, ein gültiges Zertifikat ist aktiv. - M. E. ist jedoch der Port 1883 im Docker-Container hart verdrahtet.

zivillian commented 3 months ago

Ich hab da mal was gebaut, aber mein MQTT Server hat kein TLS. Kannst du die Binaries aus dem PR irgendwie testen?

Du müsstest dafür entweder configure neu laufen lassen, oder deine yml config bearbeiten:

Mqtt:
  Host: ...
  Username: ...
  Password: ...
  UseTls: true
smileyman-1 commented 3 months ago

Hey, du bist genial - Danke.

Ich habe das eben mal getestet - leider noch ohne Erfolg. Im Log taucht danach folgende Fehlermeldung auf: Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'.

zivillian commented 3 months ago

Das klingt, als würdest du nicht die richtigen Binaries nutzen - die Fehlermeldung die du bekommst dürfte nur auftreten, wenn in deiner config das Property UseTls gesetzt ist, aber ora2mqtt das nicht kennt.

smileyman-1 commented 3 months ago

Ja, so hatte ich das auch befürchtet. Ich bekomme jedoch, mit zivillian/ora2mqtt:latest immer den Docker-Container vom 07.04.2024. - Auch wenn ich ihn bei mir komplett lösche. Muss der noch aktualisiert werden?

Danke für deine Mühe.

smileyman-1 commented 3 months ago

Wenn ich das richtig sehe, ist zwar im Github Repo .NET neu erstellt worden, der Docker-Container jedoch nicht aktualisiert. Das dürfte die Ursache sein.

smileyman-1 commented 2 months ago

@zivillian Kannst du das noch ins Docker-Image bitte aufnehmen?

zivillian commented 2 months ago

done - wenn es nicht geht einfach Bescheid geben. Wäre gut, wenn du das heute noch testest, da es ab morgen eine neue Version der App geben soll und ich nicht weiß, was sich da alles ändert.

smileyman-1 commented 2 months ago

@zivillian Danke. Ich habe eben das Docker-Image neu heruntergeladen. - Dennoch bemängelt er Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. :-(

zivillian commented 2 months ago

Kannst du mal deine config (ohne AccessToken und RefreshToken) posten? Ich hab das grad nochmal bei mir getestet und wenn ich das auf false setze (weil ich kein TLS hab) geht's problemlos. Wenn ich das auf true setze gibt es den erwarteten Fehler:

MQTTnet.Exceptions.MqttCommunicationException: Error while connecting with host '<my mqtt server>:8883'. ---> System.Net.Sockets.SocketException (111): Connection refused

und nur wenn ich es falsch schreibe kommt:

(Line: 12, Col: 3, Idx: 1339) - (Line: 12, Col: 10, Idx: 1346): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'.

smileyman-1 commented 2 months ago

@zivillian - Klar, gerne:

 DeviceId: xxx
 Country: DE
 Account:
   AccessToken: xxx
   RefreshToken: xxx
   GwId: 300260958
   BeanId: 6905372483487291567
 Mqtt:
   Host: ha
   Username: ora
   Password: 
   UseTls: true
smileyman-1 commented 2 months ago

Lautet deine Fehlermeldung wirklich Property 'UseTls1'? Müsste der Parameter damit UseTls1 und nicht UseTls lauten?

zivillian commented 2 months ago

ja, weil ich das absichtlich falsch geschrieben habe - also UseTls1 statt UseTls

smileyman-1 commented 2 months ago

habe eben nochmal beide probiert:

(Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 10, Idx: 1320): Property 'UseTls1' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'. (Line: 12, Col: 3, Idx: 1313) - (Line: 12, Col: 9, Idx: 1319): Property 'UseTls' not found on type 'ora2mqtt.Ora2MqttMqttOptions'.

zivillian commented 2 months ago

kannst du mal schauen, welches docker image du nutzt?

# docker image ls zivillian/ora2mqtt
REPOSITORY           TAG       IMAGE ID       CREATED       SIZE
zivillian/ora2mqtt   main      b2fb8292bee5   2 hours ago   85.5MB

# docker ps | grep zivillian/ora2mqtt
d9f9fddb6698   zivillian/ora2mqtt:main  "/app/ora2mqtt -c /c…"   3 minutes ago   Up 3 minutes  ora2mqtt-ora2mqtt-1
smileyman-1 commented 2 months ago

Das wird immer noch das alte Image sein.

# docker image ls zivillian/ora2mqtt
REPOSITORY           TAG       IMAGE ID       CREATED        SIZE
zivillian/ora2mqtt   latest    02b3a9beb208   2 months ago   94.7MB

# docker ps | grep zivillian/ora2mqtt
1dbaa2226e3f   zivillian/ora2mqtt:latest                                      "/app/ora2mqtt -c /c…"   54 seconds ago   Up 52 seconds                                                                                                                      ora2mqtt

ich habe es eben vor der Abfrage nochmal vollständig gelöscht. Dennoch bekommen ich mit den folgenden Befehlen immer wieder das alte Image.

docker run -itd \
--name=ora2mqtt \
--restart=always \
-e TZ=Europe/Berlin \
--net=host \
-v /home/debian/ora2mqtt.yml/ora2mqtt.yml:/config/ora2mqtt.yml \
zivillian/ora2mqtt:latest
zivillian commented 2 months ago

ah, ich nutze zivillian/ora2mqtt:main - du augenscheinlich zivillian/ora2mqtt:latest. Den Tag habe ich noch nicht aktualisiert

smileyman-1 commented 2 months ago

Top - das war mein Fehler. Danke für den Hinweis.

Ja, so funktioniert es perfekt. - Auch eine TLS-Verbindung kann nun zum MQTT-Broker aufgebaut werden. Einschränkungen durch den Wechsel der App konnte ich keinerlei feststellen.

Vielen Dank für deine Mühe

zivillian commented 2 months ago

danke fürs testen. Ich hab jetzt auch latest aktualisiert.