From 4628ff98ea962fd7180df8c171f6f3430933bacf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabor=20K=C3=B6rber?= Date: Wed, 9 Apr 2025 01:02:21 +0200 Subject: [PATCH] streaming ewie from nookie --- larry/larry.yaml | 59 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/larry/larry.yaml b/larry/larry.yaml index 1df9140..1f0048c 100644 --- a/larry/larry.yaml +++ b/larry/larry.yaml @@ -8,7 +8,6 @@ substitutions: external_media_player: your_media_player ##change this to your external media player enity_id: do not include media_player. home_assistant_host: http://nookie.nex:8123 ##change to the full url or IP of your HA server including port - home_assistant_ip: "192.168.50.36" tts_voice_speed: "16000" #options #nabu casa "24000" #piper "16000" elevenlabs "44100" must include quotes #################### ON DEVICE WAKE WORDS ####################################### @@ -124,6 +123,8 @@ wifi: static_ip: 192.168.50.201 gateway: 192.168.50.1 subnet: 255.255.255.0 + dns1: 192.168.50.1 + dns2: 8.8.8.8 ap: ssid: ${name} @@ -201,6 +202,17 @@ interval: wifi.connected: then: - lambda: "id(wifi_connection) = false;" + + - interval: 3s + id: ewie_feed_refresh_interval + then: + - if: + condition: + # - lambda: 'return id(s3_box_lcd).get_active_page() == id(video_feed_page);' + - lambda: 'return id(global_ewie_streaming);' + then: + - script.execute: update_ewie_feed_image + select: - platform: template @@ -308,7 +320,7 @@ script: then: - if: condition: - switch.is_on: s_saver + - switch.is_on: s_saver then: - lambda: id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform(); - delay: !lambda return id(s_saver_delay).state * 1000; @@ -327,7 +339,9 @@ script: then: - if: condition: - - switch.is_on: s_saver + and: + - switch.is_on: s_saver + - lambda: 'return !id(global_ewie_streaming);' then: - lambda: id(led).turn_on().set_brightness(id(s_saver_brightness).state /100).perform(); - display.page.show: saver_page @@ -435,6 +449,20 @@ script: - lambda: |- id(current_pin) += "0"; ESP_LOGD("increment_digit_0", "Current PIN: %s", id(current_pin).c_str()); + + - id: update_ewie_feed_image + mode: restart + then: + - lambda: |- + std::string host = "${home_assistant_host}"; + std::string path = id(ewie_image_path).state; + std::string full_url = host + path; + ESP_LOGD("video_feed_page", "Current url: %s", full_url); + id(ewie_live_feed_image).set_url(full_url); + - component.update: ewie_live_feed_image + - component.update: s3_box_lcd + - script.execute: saver_enabled + globals: - id: wifi_connection type: bool @@ -474,6 +502,10 @@ globals: - id: global_is_assisting type: bool restore_value: false + - id: global_ewie_streaming + type: bool + initial_value: "false" + restore_value: no number: - id: s_saver_delay @@ -2388,6 +2420,18 @@ display: lambda: |- it.fill(id(purple)); it.image(0, 0, id(ewie_live_feed_image)); + on_page_change: + - to: video_feed_page + then: + - lambda: |- + ESP_LOGD("ewie", "starting to stream"); + id(global_ewie_streaming) = true; + - from: video_feed_page + then: + - lambda: |- + ESP_LOGD("ewie", "stopping to stream"); + id(global_ewie_streaming) = false; + i2c: - id: bus_a sda: GPIO08 @@ -2835,15 +2879,8 @@ binary_sensor: min_length: 10ms max_length: 500ms then: - - lambda: |- - std::string host = "http://${home_assistant_ip}"; - std::string path = id(ewie_image_path).state; - std::string full_url = host + path; - ESP_LOGD("video_feed_page", "Current url: %s", full_url); - id(ewie_live_feed_image).set_url(full_url); - - component.update: ewie_live_feed_image - display.page.show: video_feed_page - - component.update: s3_box_lcd + - script.execute: update_ewie_feed_image - platform: touchscreen page_id: climate_page