homeassistantrpi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| homeassistantrpi [2023/11/13 21:27] – lars | homeassistantrpi [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:// | ||
| + | Das Laufwerk ist in '' | ||
| + | |||
| + | Um das Backup einzuspielen installiert man HomeAssistant auf einer neuen/ | ||
| + | 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/ | ||
| + | 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. | ||
| + | |||
| + | {{:: | ||
| + | |||
| + | Auf manchen Seiten (z.B. [[https:// | ||
| + | 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 " | ||
| + | |||
| + | |||
| ===== HACS installieren ===== | ===== HACS installieren ===== | ||
| Line 7: | Line 29: | ||
| Quelle des HACS-Install-Scripts: | Quelle des HACS-Install-Scripts: | ||
| + | ===== 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:// | ||
| + | Und diese Seite beschreibt die Funktion in der Companion-App: | ||
| + | |||
| + | ===== Nextcloud Talk Inegration ===== | ||
| + | Damit ich von HomeAssistant aus Chat-Nachrichten an die Familie senden (und empfangen) kann, habe ich unter HACS die Integration " | ||
| + | |||
| + | Webhook URL: http:// | ||
| + | Shared secret: b93649f5f916daa02dd3c64e16c5bda04fb982e2a88163674bebe7d96cc651e2caa4130c43c0ffc0ff2c721fd2474a84356f33a59b7ad76d5cfd353c9d12db24 | ||
| + | |||
| + | Der in Nextcloud erzeugte Bot: (Ausgabe von '' | ||
| + | < | ||
| + | +----+-----------+--------------------------------------------------+-------------+-------+-------------------+ | ||
| + | | id | name | description | ||
| + | +----+-----------+--------------------------------------------------+-------------+-------+-------------------+ | ||
| + | | 1 | HATalkBot | Dieser Bot verbindet Nextcloud und HomeAssistant | 0 | 1 | webhook, response | | ||
| + | +----+-----------+--------------------------------------------------+-------------+-------+-------------------+ | ||
| + | </ | ||
| + | |||
| + | Der erzeugte Chatroom " | ||
| ===== Tipps und Tricks ===== | ===== Tipps und Tricks ===== | ||
| Sucht man ein Gerät z.B. nach IP-Adresse, dann kann man in ''/ | Sucht man ein Gerät z.B. nach IP-Adresse, dann kann man in ''/ | ||
| Line 13: | Line 55: | ||
| * Bring! App Synchronisieren. Vielleicht damit: https:// | * Bring! App Synchronisieren. Vielleicht damit: https:// | ||
| + | ===== 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: | ||
| + | use_x_forwarded_for: | ||
| + | |||
| + | # MQTT-Werte als sensoren einbinden | ||
| + | mqtt: | ||
| + | sensor: | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | state_class: | ||
| + | unique_id: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | unique_id: " | ||
| + | state_class: | ||
| + | icon: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | unique_id: " | ||
| + | state_class: | ||
| + | icon: " | ||
| + | - name: " | ||
| + | state_topic: | ||
| + | unit_of_measurement: | ||
| + | value_template: | ||
| + | device_class: | ||
| + | unique_id: " | ||
| + | state_class: | ||
| + | icon: " | ||
| + | |||
| + | 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 | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | |||
| + | |||
| + | ++++ 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 " | ||
| + | logger: | ||
| + | level: DEBUG | ||
| + | logs: | ||
| + | mqtt.client: | ||
| + | mqtt.component: | ||
| + | mqtt: ERROR | ||
| + | |||
| + | # Enable Home Assistant API | ||
| + | api: | ||
| + | encryption: | ||
| + | key: " | ||
| + | |||
| + | ota: | ||
| + | password: " | ||
| + | |||
| + | wifi: | ||
| + | ssid: !secret wifi_ssid | ||
| + | password: !secret wifi_password | ||
| + | |||
| + | # Enable fallback hotspot (captive portal) in case wifi connection fails | ||
| + | ap: | ||
| + | ssid: " | ||
| + | password: " | ||
| + | |||
| + | |||
| + | mqtt: | ||
| + | broker: 192.168.17.22 | ||
| + | username: esp | ||
| + | password: "# | ||
| + | topic_prefix: | ||
| + | discovery: false | ||
| + | reboot_timeout: | ||
| + | birth_message: | ||
| + | topic: " | ||
| + | payload: online | ||
| + | will_message: | ||
| + | topic: " | ||
| + | payload: offline | ||
| + | log_topic: null | ||
| + | |||
| + | captive_portal: | ||
| + | | ||
| + | sensor: | ||
| + | # GOVEE Sensor1 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee1_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee1_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee1_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor2 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee2_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee2_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee2_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor3 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee3_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee3_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee3_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor4 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee4_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee4_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee4_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor5 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee5_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee5_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee5_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor6 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee6_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee6_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee6_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor7 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee7_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee7_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee7_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor8 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee8_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee8_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee8_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor9 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee9_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee9_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee9_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | # GOVEE Sensor10 CHANGE NAMES AS NEEDED here and in Lamda Section | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee10_humidity | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee10_temperature | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | - platform: template | ||
| + | name: " | ||
| + | id: govee10_battery | ||
| + | unit_of_measurement: | ||
| + | icon: " | ||
| + | device_class: | ||
| + | state_class: | ||
| + | internal: true | ||
| + | on_value: | ||
| + | - mqtt.publish: | ||
| + | topic: " | ||
| + | payload: !lambda |- | ||
| + | char buf[10]; | ||
| + | sprintf(buf, | ||
| + | return buf; | ||
| + | |||
| + | |||
| + | esp32_ble_tracker: | ||
| + | on_ble_advertise: | ||
| + | # Script For The First 5075 Govee Themometer/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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/ | ||
| + | - mac_address: | ||
| + | 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); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | ++++ | ||
homeassistantrpi.1699907272.txt.gz · Last modified: by lars
