Metainformationen zur Seite
  •  

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
digitales:software:homeassistant:mqtt [24.04.2025] – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1digitales:software:homeassistant:mqtt [25.04.2025] (aktuell) – ↷ Links angepasst, weil Seiten im Wiki verschoben wurden cs
Zeile 1: Zeile 1:
 +{{tag>MQTT Nützliche_Links}}
 +
 +====== MQTT ======
 +
 +===== Shelly TRV =====
 +
 +  * [[https://shelly-api-docs.shelly.cloud/gen1/#shelly-trv-mqtt|Shelly TRV: MQTT]]
 +  * [[https://community.home-assistant.io/t/shelly-trv-mqtt-configuration-and-lovelace-configuration/378474/11|Shelly TRV mqtt configuration and lovelace configuration]]
 +  * [[https://sequr.be/blog/2020/10/getting-started-with-mqtt-and-home-assistant-and-shelly/|Getting started with MQTT and Home Assistant (and Shelly)]]
 +  * [[https://www.hivemq.com/mqtt-essentials/|MQTT Essentials, The Ultimate Kickstart For MQTT Beginners]]
 +  * {{digitales:software:mqtt-buch-v1.2.pdf|Edi's Techlab MQTT}}
 +  * [[https://sequr.be/blog/2020/10/mqtt-templates-for-shelly-devices/#shelly-dw2|MQTT templates for Shelly devices]]
 +  * [[https://stevessmarthomeguide.com/adding-mqtt-sensor-to-home-assistant/|Adding a MQTT Sensor To Home Assistant]]
 +
 +  * [[https://schwaeppe.synology.me/webpages/MQTT%20Set%20TRV%20target_t.html|MQTT Set TRV target_t]]
 +  * [[MQTT Set TRV target_t]]
 +
 +==== TRVs ausschalten ====
 +
 +%%Push reset button for 5-6 sek. Will see AP on screen. Then push shortly once. And device will be switched off.%%
 +
 +==== Retain Message löschen ====
 +
 +  * von [[https://community.home-assistant.io/t/mqtt-event-keeps-coming-back-as-retained-how-to-turn-that-off/300971/30|https://community.home-assistant.io/t/mqtt-event-keeps-coming-back-as-retained-how-to-turn-that-off/300971/30]]
 +
 +For the folks still reading this thread, I’ve been using MQTT since 2018 and have never experienced the difficulties the OP has reported.
 +
 +My introduction to MQTT began when I wanted to add MQTT support to an old home automation system. In order to do that, I had to gain a sufficient understanding of MQTT’s operation to ensure success. The resulting MQTT converter has worked very reliably and predictably for nearly 3 years now.
 +
 +What the OP has experienced is anomalous. In my tests, using Developer Tools > Services > MQTT: Publish, to purge a retained message, does indeed work; the topic’s payload does not reappear as a retained message.
 +
 +  * Using MQTT Explorer, published a retained message to a new topic.
 +  * Using Developer Tools > Services > MQTT: Publish, published an empty string, as a retained message, to the topic .
 +  * Disconnected/reconnected MQTT Explorer and now the topic and its payload were no longer present (i.e. retained payload removed from the broker’s storage).
 +  * Restarted the MQTT Mosquitto Broker Add-On.
 +  * Disconnected/reconnected MQTT Explorer. Topic and its payload did not return and were truly purged from the broker’s storage.
 +  * Using Developer Tools > Services > MQTT: Publish, published a //non//-retained message to the previous topic.
 +  * In MQTT Explorer (already running) it displayed the topic and its payload (//not//  as a retained message).
 +
 +In short, everything worked as expected.
 +
 +The OP carried out a similar procedure but reported a different outcome, one where the topic always contains a retained message despite attempts to disable it.
 +
 +There have been reports of performance issues with the MQTT Mosquitto Broker Add-on version 5.1.1 and maybe (just maybe) this is one of its manifestations. I can’t say for sure because I still use version 5.1 and it runs flawlessly.
 +
 +==== TRV-Liste ====
 +
 +Liste der TRV's nach Räumen
 +
 +=== Wohnen ===
 +
 +**Zieltemperatur setzen**
 +
 +  * Wohnen-01-alt: ''- shellies/shellytrv-60A423D925E8/thermostat/0/command/target_t''
 +  * Wohnen-01: ''- shellies/shellytrv-60A4239931B4/thermostat/0/command/target_t'' 
 +  * Wohnen-02: ''- shellies/shellytrv-84FD271BDE5E/thermostat/0/command/target_t''
 +  * Wohnen-03: ''- shellies/shellytrv-14B457E5D19E/thermostat/0/command/target_t''
 +
 +**Externe Temperatur senden**
 +
 +  * Wohnen-01: ''- shellies/shellytrv-60A423D925E8/thermostat/0/command/ext_t''
 +  * Wohnen-02: ''- shellies/shellytrv-84FD271BDE5E/thermostat/0/command/ext_t''
 +  * Wohnen-03: ''- shellies/shellytrv-14B457E5D19E/thermostat/0/command/ext_t''
 +
 +
 +=== Schlafen ===
 +
 +  * ''shellies/shellytrv-8CF6811873D3/thermostat/0/command/target_t''
 +
 +=== Flur ===
 +
 +**Zieltemperatur setzen**
 +
 +  * Flur-01: ''- shellies/shellytrv-84FD276ED9DC/thermostat/0/command/target_t''
 +  * Flur-02: ''- shellies/shellytrv-8CF6811870A3/thermostat/0/command/target_t''
 +
 +**Externe Temperatur senden**
 +
 +  * Flur-01: ''- shellies/shellytrv-84FD276ED9DC/thermostat/0/command/ext_t''
 +  * Flur-02: ''- shellies/shellytrv-8CF6811870A3/thermostat/0/command/ext_t''
 +
 +=== Küche ===
 +
 +  * ''shellies/shellytrv-8CF6811C9B49/thermostat/0/command/target_t''
 +
 +=== Bad ===
 +
 +  * ''shellies/shellytrv-8CF6811CA673/thermostat/0/command/target_t''
 +
 +==== Shellies entdecken ====
 +
 +In HA unter [[https://gatoneroha.duckdns.org/config/integrations/integration/mqtt|Settings --> Devices & services -> Integrations -> MQTT]] [[https://gatoneroha.duckdns.org/config/mqtt?config_entry=998620d729956de43ad013ef3c5c4224|Configure]] anklicken.
 +
 +Folgendes eintragen:
 +
 +  * **Publish a packet:** \\ **Topic:** ''shellies/command'' \\ **Payload:** ''announce''
 +  * **Listen to a topic:** \\ **Topic to subscribe to:**  ''shellies/#''
 +
 +Die Ausgabe für ein Shelly TRV sieht wie folgt aus:
 +
 +<code json announce>
 +{
 +    "id": "shellytrv-8CF6811CA673",
 +    "model": "SHTRV-01",
 +    "mac": "8CF6811CA673",
 +    "ip": "192.168.178.187",
 +    "new_fw": false,
 +    "fw_ver": "20231009-064451/v2.2.1@1e8f2795"
 +}
 +</code>
 +
 +<code json status>
 +{
 +    "tmp": {
 +        "value": 31.5,
 +        "units": "C",
 +        "is_valid": true
 +    },
 +    "target_t": {
 +        "enabled": true,
 +        "value": 31.0,
 +        "units": "C"
 +    },
 +    "temperature_offset": 0.0,
 +    "bat": 94
 +}
 +</code>
 +
 +<code json info>
 +{
 +  "wifi_sta": {
 +    "connected": true,
 +    "ssid": "FRITZ!Box 6660 Cable DR",
 +    "ip": "192.168.178.187",
 +    "rssi": -75
 +  },
 +  "cloud": { "enabled": false, "connected": false },
 +  "mqtt": { "connected": true },
 +  "time": "10:32",
 +  "unixtime": 1698568321,
 +  "serial": 0,
 +  "has_update": false,
 +  "mac": "8CF6811CA673",
 +  "cfg_changed_cnt": 0,
 +  "actions_stats": { "skipped": 0 },
 +  "thermostats": [
 +    {
 +      "pos": -1.0,
 +      "target_t": {
 +        "enabled": true,
 +        "value": 31.0,
 +        "value_op": 8.0,
 +        "units": "C"
 +      },
 +      "tmp": { "value": 31.5, "units": "C", "is_valid": true },
 +      "schedule": false,
 +      "schedule_profile": 1,
 +      "boost_minutes": 0,
 +      "window_open": false
 +    }
 +  ],
 +  "calibrated": false,
 +  "bat": { "value": 94, "voltage": 3.814 },
 +  "charger": true,
 +  "update": {
 +    "status": "unknown",
 +    "has_update": false,
 +    "new_version": "20231009-064451/v2.2.1@1e8f2795",
 +    "old_version": "20231009-064451/v2.2.1@1e8f2795",
 +    "beta_version": null
 +  },
 +  "ram_total": 97280,
 +  "ram_free": 30704,
 +  "fs_size": 65536,
 +  "fs_free": 59404,
 +  "uptime": 36579,
 +  "fw_info": {
 +    "device": "shellytrv-8CF6811CA673",
 +    "fw": "20231009-064451/v2.2.1@1e8f2795"
 +  },
 +  "ps_mode": 0,
 +  "dbg_flags": 0
 +}
 +</code>
 +
 +==== TRV Settings ====
 +
 +  * [[https://community.home-assistant.io/t/shelly-trv-mqtt-configuration/420140/3|Meine Settings im Forum]]
 +
 +==== Lesen ====
 +
 +<code ->
 +mqtt:
 +  sensor:
 +    - name: "Shelly-TRV Bad Target_t"
 +      unit_of_measurement: "°C"
 +      #expire_after: 86400
 +      device_class: temperature
 +      icon: mdi:home-thermometer-outline
 +      qos: 1
 +      state_topic: "shellies/shellytrv-8CF6811CA673/status"
 +      value_template: "{{ value_json.target_t.value }}"
 +
 +    - name: "Shelly-TRV Bad Temperatur"
 +      unit_of_measurement: "°C"
 +      #expire_after: 86400
 +      device_class: temperature
 +      icon: mdi:home-thermometer-outline
 +      qos: 1
 +      state_topic: "shellies/shellytrv-8CF6811CA673/status"
 +      value_template: "{{ value_json.tmp.value }}"
 +
 +    - name: "Shelly-TRV Bad Batterie"
 +      unit_of_measurement: "%"
 +      #expire_after: 86400
 +      device_class: battery
 +      icon: mdi:battery
 +      qos: 1
 +      state_topic: "shellies/shellytrv-8CF6811CA673/info"
 +      value_template: "{{ value_json.bat.value }}"
 +</code>
 +
 +==== Schreiben ====
 +
 +<code yaml>
 +service: mqtt.publish
 +data:
 +  qos: "1"
 +  retain: false
 +  topic: shellies/shellytrv-8CF6811CA673/thermostat/0/command/target_t
 +  payload_template: "{{ states('input_number.temperatur_ziel_hoch')|float(0) }}"
 +</code>
 +
 +===== Lidl-Plug =====
 +
 +Dann wählst du dein Zigbee Gerät (Lidl Steckdose) aus
 +
 +Endpunkt: 1\\  Cluster-ID: OnOff\\  Attribut: tuyaBacklightMode\\  Befehl: write (2)\\  Value: 1
 +
 +Dann den Button "Schreiben" drücken
 +
 +Im Log erscheint eine Meldung: 2023-04-17 13:41:33''Wrote '{"tuyaBacklightMode":1}' to 'genOnOff'''
 +
 +Mit dem Befehl:
 +
 +Endpunkt: 1\\  Cluster-ID: genOnOff\\  Befehlstyp: Foundation\\  Befehl: read (0)\\  Attribut: tuyaBacklightMode\\  Haken entfernen bei "Ein Wert wird benötigt"\\  Value: 0
 +