User Tools

Site Tools


homeassistantrpi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
homeassistantrpi [2023/11/10 12:34] – [HACS installieren] larshomeassistantrpi [2025/01/13 22:01] (current) – [Backup] lars
Line 1: Line 1:
 ====== Homeassistant ====== ====== Homeassistant ======
 Auf dem schwarzen Raspberry Pi 4 der früher [[raspi4cloud|Raspi4Cloud]] war. Auf dem schwarzen Raspberry Pi 4 der früher [[raspi4cloud|Raspi4Cloud]] war.
 +
 +===== Backup =====
 +Über das Plugin [[https://github.com/sabeechen/hassio-google-drive-backup|"Google Drive Backup"]] werden regelmäßig Backups des ganzen Homeassistant-Systems auf ein Samba-Netzlaufwerk gemacht. 
 +Das Laufwerk ist in ''Datastore1/Backup/Homeassistant'' auf TrueNAS zu finden.
 +
 +Um das Backup einzuspielen installiert man HomeAssistant auf einer neuen/leeren SD-Card.
 +Am einfachsten mit dem Raspberry Pi Imager.
 +Dann den Computer starten, dabei wird HomeAssistant vorbereitet. Unter der IP:8123 kann man per Web darauf zugreifen.
 +Der Initiale Login Screen/Setup Screen erlaubt das wiederherstellen von einer Datei.
 +Hier lädt man das aktuellste Backup (ein tar-File mit aktuell > 1 GB Größe) hoch.
 +
 +Nachdem das Backup wiederhergestellt wurde (ca. 1 Stunde) läuft wieder fast alles. 
 +Bei einer Wiederherstellung (SD-Card kaputt) im Januar 2025 musste ich nur die Tuya-Integration wieder anmelden (also die Login-Daten wurden vergessen) und das Netzlaufwerk für die Backups erneut einrichten.
 +
 +{{::2025-01_screenshot_homeassistant_backup_drive.png?100|}}
 +
 +Auf manchen Seiten (z.B. [[https://www.home-assistant.io/more-info/backup-emergency-kit/|hier]]) wird auf eine AES-Verschlüsselung und ein "Backup Emergency Kit" (was eigentlich nur der AES-Schlüssel ist) verwiesen. 
 +Ich habe aber so einen Schlüssel nicht und konnte ihn auch nicht in HomeAssistant finden.
 +Das Wiederherstellen im Jan 2025 ging auch ohne, ich wurde nie nach einem Passwort gefragt.
 +In den Einstellungen von "Google Drive Backup" ist das Passwort leer gelassen - also nicht gesetzt.
 +
 +
  
 ===== HACS installieren ===== ===== HACS installieren =====
Line 7: Line 29:
 Quelle des HACS-Install-Scripts: https://hacs.xyz/docs/setup/download Quelle des HACS-Install-Scripts: https://hacs.xyz/docs/setup/download
  
 +===== Push-Nachrichten =====
 +Damit ich von nodered aus Push-Nachrichten aufs Handy senden kann, habe ich in Noidered die Homeassistant-Bibliothek eingebunden. Mit einem Webservice-Aufruf kann dann eine Push-Nachricht abgesendet werden. Eine Erklärung dafür gibt es hier: https://community.home-assistant.io/t/how-to-send-mobile-notification-through-ha-app-with-nodered/318405/2 \\
 +Und diese Seite beschreibt die Funktion in der Companion-App: https://companion.home-assistant.io/docs/notifications/notifications-basic/
 +
 +===== Nextcloud Talk Inegration =====
 +Damit ich von HomeAssistant aus Chat-Nachrichten an die Familie senden (und empfangen) kann, habe ich unter HACS die Integration "[[https://github.com/klatka/nc-talk-bot-component|Nextcloud Talk Bot]]" installiert. Die initiale Konfiguration hat mir folgende Daten zum eintragen bei Nextcloud gegeben:
 +
 +Webhook URL: http://192.168.17.25:8123/api/webhook/2a498cbf05de7cc4b07e024740edd4351be0a4afd670d3de8046c1b2fa4f889c \\
 +Shared secret: b93649f5f916daa02dd3c64e16c5bda04fb982e2a88163674bebe7d96cc651e2caa4130c43c0ffc0ff2c721fd2474a84356f33a59b7ad76d5cfd353c9d12db24
 +
 +Der in Nextcloud erzeugte Bot: (Ausgabe von ''occ talk:bot:list'')
 +<code>
 ++----+-----------+--------------------------------------------------+-------------+-------+-------------------+
 +| id | name      | description                                      | error_count | state | features          |
 ++----+-----------+--------------------------------------------------+-------------+-------+-------------------+
 +| 1  | HATalkBot | Dieser Bot verbindet Nextcloud und HomeAssistant | 0           | 1     | webhook, response |
 ++----+-----------+--------------------------------------------------+-------------+-------+-------------------+
 +</code>
 +
 +Der erzeugte Chatroom "Hausautomat" hat das ''Room token: gaug8fv2'' .
 ===== Tipps und Tricks ===== ===== Tipps und Tricks =====
-Sucht man ein Gerät z.B. nach IP-Adresse, dann kann man in ''/root/config/.storage/core.device_registry'' alle Geräte aufgelistet finden. Hier kann man gut suchen. +Sucht man ein Gerät z.B. nach IP-Adresse, dann kann man in ''/root/config/.storage/core.device_registry'' alle Geräte aufgelistet finden. Das z.B. mit dem Terminal-AddOn und dem Befehl ''less'' öffnen. Hier kann man gut suchen.  
 + 
 +===== ToDos ===== 
 +* Bring! App Synchronisieren. Vielleicht damit: https://github.com/sh00t2kill/HA-Bring-ToDo-List 
 + 
 +===== Alte Config ===== 
 + 
 +++++ Die in einer vmware laufende HomeAssistant-Instanz hatte diese Konfiguration: | 
 +<file yaml configuration.yaml> 
 +# Loads default set of integrations. Do not remove. 
 +default_config: 
 + 
 +# Load frontend themes from the themes folder 
 +frontend: 
 +  themes: !include_dir_merge_named themes 
 + 
 +# LARS: http-Sektion hinzugefügt 
 +http: 
 +  trusted_proxies: 192.168.17.16 
 +  use_x_forwarded_for: true 
 + 
 +# MQTT-Werte als sensoren einbinden 
 +mqtt: 
 +  sensor: 
 +    - name: "Temperatur Warmwasser" 
 +      state_topic: "larshome/temperaturen/Keller/Warmwasser" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.warmwasser" 
 +    - name: "Temperatur Zirkulation Rücklauf" 
 +      state_topic: "larshome/temperaturen/Keller/Zirkulation_Ruecklauf" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.zirkulation_ruecklauf" 
 +    - name: "Temperatur Heizungskeller Raum" 
 +      state_topic: "larshome/temperaturen/Keller/Raum" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.raum" 
 +    - name: "Temperatur Heizung Vorlauf" 
 +      state_topic: "larshome/temperaturen/Keller/Heizung_Vorlauf" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.heizung_vorlauf" 
 +    - name: "Temperatur Heizung Rücklauf" 
 +      state_topic: "larshome/temperaturen/Keller/Heizung_Ruecklauf" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.Heizung_Ruecklauf" 
 +    - name: "Temperatur Therme Ausgang Warmwasser" 
 +      state_topic: "larshome/temperaturen/Keller/ThermeAusgangWarmwasser" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.ThermeAusgangWarmwasser" 
 +    - name: "Temperatur Therme Ausgang Heizung" 
 +      state_topic: "larshome/temperaturen/Keller/ThermeAusgangHeizung" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.ThermeAusgangHeizung" 
 +    - name: "Temperatur Solaranlage Rücklauf" 
 +      state_topic: "larshome/temperaturen/Keller/Solaranlage_Ruecklauf" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.Solaranlage_Ruecklauf" 
 +    - name: "Temperatur Solarspeicher" 
 +      state_topic: "larshome/temperaturen/Keller/Solarspeicher" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.Solarspeicher" 
 +    - name: "Temperatur Heizung Rücklauf nach Solar" 
 +      state_topic: "larshome/temperaturen/Keller/HeizungRuecklaufNachSolar" 
 +      unit_of_measurement: "°C" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "temperature" 
 +      state_class: "measurement" 
 +      unique_id: "larshome.temperaturen.keller.HeizungRuecklaufNachSolar" 
 +    - name: "Gasverbrauch Pulse" 
 +      state_topic: "larshome/gas/Keller/zaehler" 
 +      unit_of_measurement: "m³" 
 +      value_template: "{{ value_json.value }} * 0.001" 
 +      device_class: "gas" 
 +      unique_id: "larshome.gas.Keller.zaehler" 
 +      state_class: "measurement" 
 +      icon: "mdi:fire" 
 +    - name: "Gasverbrauch pro Stunde" 
 +      state_topic: "larshome/gas/Keller/zaehler" 
 +      unit_of_measurement: "m³" 
 +      value_template: "{{ value_json.VerbrauchQmProH }}" 
 +      device_class: "gas" 
 +      unique_id: "larshome.gas.Keller.gasProStunde" 
 +      state_class: "measurement" 
 +      icon: "mdi:fire" 
 +    - name: "Gasverbrauch pro Tag" 
 +      state_topic: "larshome/gas/Keller/zaehlerTag" 
 +      unit_of_measurement: "m³" 
 +      value_template: "{{ value_json.value }}" 
 +      device_class: "gas" 
 +      unique_id: "larshome.gas.Keller.gasProTag" 
 +      state_class: "measurement" 
 +      icon: "mdi:fire" 
 + 
 +sensor: 
 +  - platform: integration 
 +    source: sensor.gasverbrauch_pulse 
 +    name: "Gas pro h Integral" 
 +    unique_id: larshome.gas.Keller.gasProStundeIntegral 
 +    round: 3 
 +    method: left 
 + 
 +# Text to speech 
 +tts: 
 +  - platform: google_translate 
 + 
 +automation: !include automations.yaml 
 +script: !include scripts.yaml 
 +scene: !include scenes.yaml 
 +</file> 
 +++++ 
 + 
 + 
 + 
 +++++ Und hier die Konfiguration des ESP32-ble (Bluetooth Thermometer auslesen im Hauswirtschaftsraum) in der alten instanz: | 
 +<file yaml esp32-ble.yaml> 
 +esphome: 
 +  name: esp32-ble 
 + 
 +esp32: 
 +  board: esp32dev 
 +  framework: 
 +    type: arduino 
 + 
 +# Enable logging 
 +# mqtt should be below "DEBUG", otherwise all sensor readings are published 
 +logger: 
 +  level: DEBUG 
 +  logs: 
 +    mqtt.client: ERROR 
 +    mqtt.component: ERROR 
 +    mqtt: ERROR 
 + 
 +# Enable Home Assistant API 
 +api: 
 +  encryption: 
 +    key: "j82jwnhRmLocjRVTEoVAj1uNpWCQf+bT5hhCwuULeO8=" 
 + 
 +ota: 
 +  password: "4a928ce0a0e6b80414f54ab4bc5588eb" 
 + 
 +wifi: 
 +  ssid: !secret wifi_ssid 
 +  password: !secret wifi_password 
 + 
 +  # Enable fallback hotspot (captive portal) in case wifi connection fails 
 +  ap: 
 +    ssid: "Esp32-Ble Fallback Hotspot" 
 +    password: "rrcjAeoCOkOt" 
 + 
 + 
 +mqtt: 
 +  broker: 192.168.17.22 
 +  username: esp 
 +  password: "#Filmkunsttheater" 
 +  topic_prefix: "esp32-ble" 
 +  discovery: false 
 +  reboot_timeout: "0s" 
 +  birth_message: 
 +    topic: "esp32-ble/status" 
 +    payload: online 
 +  will_message: 
 +    topic: "esp32-ble/status" 
 +    payload: offline   
 +  log_topic: null 
 + 
 +captive_portal: 
 +     
 +sensor: 
 +# GOVEE Sensor1 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Gästezimmer Govee Humidity" 
 +    id: govee1_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Gaestezimmer/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee1_humidity).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Gästezimmer Govee Temperature" 
 +    id: govee1_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Gaestezimmer/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee1_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Gästezimmer Govee Battery" 
 +    id: govee1_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Gaestezimmer/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee1_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor2 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Kinderzimmer Mattis Govee Humidity" 
 +    id: govee2_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Mattis/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee2_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Kinderzimmer Mattis Govee Temperature" 
 +    id: govee2_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Mattis/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee2_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Kinderzimmer Mattis Govee Battery" 
 +    id: govee2_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Mattis/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee2_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor3 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Badezimmer oben Govee Humidity" 
 +    id: govee3_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_oben/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee3_humidity).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Badezimmer oben Govee Temperature" 
 +    id: govee3_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_oben/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee3_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Badezimmer oben Govee Battery" 
 +    id: govee3_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_oben/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee3_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor4 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Elternschlafzimmer Govee Humidity" 
 +    id: govee4_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Elternschlafzimmer/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee4_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Elternschlafzimmer Govee Temperature" 
 +    id: govee4_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Elternschlafzimmer/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee4_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Elternschlafzimmer Govee Battery" 
 +    id: govee4_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Elternschlafzimmer/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee4_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor5 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Wohnzimmer Govee Humidity" 
 +    id: govee5_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Wohnzimmer/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee5_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Wohnzimmer Govee Temperature" 
 +    id: govee5_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Wohnzimmer/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee5_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Wohnzimmer Govee Battery" 
 +    id: govee5_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Wohnzimmer/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee5_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor6 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Terasse Govee Humidity" 
 +    id: govee6_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Terasse/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee6_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Terasse Govee Temperature" 
 +    id: govee6_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Terasse/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee6_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Terasse Govee Battery" 
 +    id: govee6_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Terasse/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee6_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor7 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Arbeitszimmer Govee Humidity" 
 +    id: govee7_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Arbeitszimmer/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee7_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Arbeitszimmer Govee Temperature" 
 +    id: govee7_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Arbeitszimmer/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee7_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Arbeitszimmer Govee Battery" 
 +    id: govee7_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Arbeitszimmer/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee7_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor8 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Kinderzimmer Lukas Govee Humidity" 
 +    id: govee8_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Lukas/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee8_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Kinderzimmer Lukas Govee Temperature" 
 +    id: govee8_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Lukas/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee8_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Kinderzimmer Lukas Govee Battery" 
 +    id: govee8_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement"             
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Kinderzimmer_Lukas/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee8_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor9 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Badezimmer unten Govee Humidity" 
 +    id: govee9_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_unten/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee9_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Badezimmer unten Govee Temperature" 
 +    id: govee9_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_unten/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee9_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Badezimmer unten Govee Battery" 
 +    id: govee9_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement"      
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Badezimmer_unten/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee9_battery).state); 
 +            return buf; 
 + 
 +# GOVEE Sensor10 CHANGE NAMES AS NEEDED here and in Lamda Section 
 +  - platform: template 
 +    name: "Dachboden Govee Humidity" 
 +    id: govee10_humidity 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:water-percent" 
 +    device_class: "humidity" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Dachboden/Luftfeuchte/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee10_humidity).state); 
 +            return buf;     
 +  - platform: template 
 +    name: "Dachboden Govee Temperature" 
 +    id: govee10_temperature 
 +    unit_of_measurement: '°C' 
 +    icon: "mdi:thermometer" 
 +    device_class: "temperature" 
 +    state_class: "measurement" 
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Dachboden/Temperatur/Raum" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.1f", id(govee10_temperature).state); 
 +            return buf; 
 +  - platform: template 
 +    name: "Dachboden Govee Battery" 
 +    id: govee10_battery 
 +    unit_of_measurement: '%' 
 +    icon: "mdi:battery" 
 +    device_class: "battery" 
 +    state_class: "measurement"    
 +    internal: true 
 +    on_value: 
 +      - mqtt.publish: 
 +          topic: "esp32-ble/Dachboden/Govee_Thermometer_5075/battery" 
 +          payload: !lambda |- 
 +            char buf[10]; 
 +            sprintf(buf, "%.0f", id(govee10_battery).state); 
 +            return buf; 
 + 
 + 
 +esp32_ble_tracker: 
 +  on_ble_advertise: 
 +# Script For The First 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:00:A8:0B #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee1_humidity).publish_state(humidity); 
 +                id(govee1_temperature).publish_state(temperature); 
 +                id(govee1_battery).publish_state(battery_level); 
 +              }  
 +            } 
 + 
 +# Script For The Second 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:FA:0F:1A #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee2_humidity).publish_state(humidity); 
 +                id(govee2_temperature).publish_state(temperature); 
 +                id(govee2_battery).publish_state(battery_level); 
 +              }  
 +            }     
 + 
 +# Script For The Third 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:AD:1D:32 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee3_humidity).publish_state(humidity); 
 +                id(govee3_temperature).publish_state(temperature); 
 +                id(govee3_battery).publish_state(battery_level); 
 +              }  
 +            }     
 + 
 +# Script For The Fourth 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:32:74:FE #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee4_humidity).publish_state(humidity); 
 +                id(govee4_temperature).publish_state(temperature); 
 +                id(govee4_battery).publish_state(battery_level); 
 +              }  
 +            }          
 + 
 +# Script For The Fifth 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:11:26:74 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee5_humidity).publish_state(humidity); 
 +                id(govee5_temperature).publish_state(temperature); 
 +                id(govee5_battery).publish_state(battery_level); 
 +              }  
 +            }                                     
 + 
 +# Script For The Sixth 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:1C:00:1D #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee6_humidity).publish_state(humidity); 
 +                id(govee6_temperature).publish_state(temperature); 
 +                id(govee6_battery).publish_state(battery_level); 
 +              }  
 +            }                                     
 + 
 +# Script For The Seventh 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:D3:EB:60 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee7_humidity).publish_state(humidity); 
 +                id(govee7_temperature).publish_state(temperature); 
 +                id(govee7_battery).publish_state(battery_level); 
 +              }  
 +            }                                     
 + 
 +# Script For The Eight 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:0F:AE:C8 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee8_humidity).publish_state(humidity); 
 +                id(govee8_temperature).publish_state(temperature); 
 +                id(govee8_battery).publish_state(battery_level); 
 +              }  
 +            }                                                                         
 + 
 +# Script For The Ninth 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:4A:66:30 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee9_humidity).publish_state(humidity); 
 +                id(govee9_temperature).publish_state(temperature); 
 +                id(govee9_battery).publish_state(battery_level); 
 +              }  
 +            }     
 + 
 +# Script For The Tenth 5075 Govee Themometer/Humidity Sensor     
 +    - mac_address: A4:C1:38:21:AA:E0 #MAC Adress of First Sensor 
 +      then: 
 +        - lambda: |- 
 +            for (auto data : x.get_manufacturer_datas()) { 
 +              if(data.data.size()==6) { 
 +                int basenum = (int16_t(data.data[1]) << 16) + (int16_t(data.data[2]) << 8) + int16_t(data.data[3]); 
 +                bool is_negative = false; 
 +                if (basenum & 0x800000) { 
 +                  is_negative = true; 
 +                  basenum = basenum ^ 0x800000; 
 +                } 
 +                float temperature = ((basenum / 10000.0f)); 
 +                const float humidity = (basenum % 1000) / 10.0f; 
 +                const float battery_level = uint16_t(data.data[4]) / 1.0f; 
 +                if (is_negative) { 
 +                  temperature = -temperature; 
 +                } 
 +                int16_t rssi=x.get_rssi(); 
 +                id(govee10_humidity).publish_state(humidity); 
 +                id(govee10_temperature).publish_state(temperature); 
 +                id(govee10_battery).publish_state(battery_level); 
 +              }  
 +            }    
  
 +</file>
 +++++
homeassistantrpi.1699616041.txt.gz · Last modified: by lars