Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT benötige Hilfestellung bei Home Assistant with MQTT Broker #1590

Open
rmayergfx opened this issue Apr 16, 2024 · 7 comments
Open

MQTT benötige Hilfestellung bei Home Assistant with MQTT Broker #1590

rmayergfx opened this issue Apr 16, 2024 · 7 comments
Assignees

Comments

@rmayergfx
Copy link

In den alten Versionen von AhoyDTU war das Topic bei MQTT so aufgebaut, das im Channel0 die Infos zur FW etc einzeln abgefragt werden konnten:

state_topic: ".../ch0/FWBuildYear"
.../ch0/FWVersion"

In den aktuellen Versionen findet man diese Daten unter .../firmware in diesem Format:
firmware = {"version":10010,"build_year":"2021","build_month_day":1101,"build_hour_min":842,"bootloader":104}

Wie kann ich nun diese einzelnen Auflistungen wieder in HA einbetten?

@knickohr
Copy link

Indem Du dein HA auf JSON-Payload umstellst.

@rmayergfx
Copy link
Author

@knickohr
Verstehe nicht ganz was du meinst. HA läuft im Docker und auch MQTT (eclipse-mosquitto). Es wird alles automatisch eingelesen, ich habe nichts geändert.

@knickohr
Copy link

Du hast nichts geändert, aber es ändern sich hin und wieder Dinge im Ahoy. Dieses automatische Discovery wird halt gerne vergessen anzupassen 😉

@lumapu lumapu self-assigned this Apr 17, 2024
@lumapu lumapu added the bug Something isn't working label Apr 17, 2024
@lumapu
Copy link
Owner

lumapu commented Apr 17, 2024

kann man sich das nicht manuell reinholen? Ist das eine so dringende Information?

@lumapu lumapu added discussion and removed bug Something isn't working labels Apr 17, 2024
@rmayergfx
Copy link
Author

rmayergfx commented Apr 18, 2024

Wenn ich wüsste wie ich das manuell einpflegen kann dann gerne. Mein Problem ist, das die Topics umgestellt wurden und ich finde zu dem ganzen Thema auch nicht wirklich eine Anleitung, was wann wo und wie in den verschiedenen Versionen bei MQTT umgestellt oder geändert wurde. Das ist problematisch, wenn ich Werte abfrage und diese plötzlich nicht mehr so erreichbar sind wie ursprünglich eingepflegt.
Am Beispiel:
.../ch0/FWVersion"
Hier wurde die FWVersion des WR unter Channel0 mit Topic FWVersion ausgelesen, es gab nur einen Wert. Das war relativ einfach in einem mqtt.yaml umsetzbar:

  • name: "TSUN M800 FWVersion"
    unique_id: 0tsunm800ch0FWVersion
    state_topic: "M800/TSUN_M800/ch0/FWVersion"
    unit_of_measurement: ''
    icon: mdi:symbol

Nun liegt das aber unter
M800/TSUN_M800/firmware
{
"version": 10010,
"build_year": "2021",
"build_month_day": 1101,
"build_hour_min": 842,
"bootloader": 104
}

Und somit muss alles umgebaut werden. Denn es hat sich sowohl der Name FWVersion >> firmware als auch der Pfad und die Formatierung geändert.

Mir würde hier schon ein Beispiel für die Abfrage genügen, die man ein die mqtt.yaml passend eintragen kann, das ganze scheint ja JSON formatiert zu sein.

@rmayergfx
Copy link
Author

rmayergfx commented Apr 18, 2024

Für alle die an dieser Stelle auch ein Problem haben, hier der Auszug aus einer mqtt.yaml die funktioniert:

 - name: "TSUN M800 Firmware"
   unique_id:  0tsunm800fw   
   state_topic: "M800/TSUN_M800/firmware"
   value_template: '{{ value_json.version }}'
   json_attributes_topic: "M800/TSUN_M800/firmware"
   json_attributes_template: '{{ value_json | tojson }}'
   icon: mdi:information
   
 - name: "TSUN M800 Firmware Year"
   unique_id:  0tsunm800fwyear   
   state_topic: "M800/TSUN_M800/firmware"
   value_template: '{{ value_json.build_year }}'
   json_attributes_topic: "M800/TSUN_M800/firmware"
   json_attributes_template: '{{ value_json | tojson }}'
   icon: mdi:information   

@andewo
Copy link

andewo commented May 12, 2024

@rmayergfx - vielen Dank für das mqtt.yaml - Beispiel. Ich konnte das erfolgreich in meinem HA umsetzten. Wieder was dazugelernt....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants