added fixes for jpg

This commit is contained in:
2026-08-20 21:49:05 +02:00
parent 81717cb9a8
commit 2b5004a569
4 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ void FastJpeg::dump_config() {
} }
void FastJpeg::update() { void FastJpeg::update() {
if (this->is_failed() || this->task_ == nullptr) if (this->is_failed() || this->task_ == nullptr || !this->enabled_.load())
return; return;
if (this->busy_.load() || this->decoded_ready_.load()) if (this->busy_.load() || this->decoded_ready_.load())
return; return;
+3
View File
@@ -23,6 +23,8 @@ class FastJpeg : public PollingComponent {
void set_x(int x) { this->x_ = x; } void set_x(int x) { this->x_ = x; }
void set_y(int y) { this->y_ = y; } void set_y(int y) { this->y_ = y; }
void set_big_endian(bool big_endian) { this->big_endian_ = big_endian; } void set_big_endian(bool big_endian) { this->big_endian_ = big_endian; }
void set_enabled(bool enabled) { this->enabled_.store(enabled); }
bool is_stream_enabled() const { return this->enabled_.load(); }
void setup() override; void setup() override;
void loop() override; void loop() override;
@@ -71,6 +73,7 @@ class FastJpeg : public PollingComponent {
size_t http_rx_len_{0}; size_t http_rx_len_{0};
std::atomic<bool> busy_{false}; std::atomic<bool> busy_{false};
std::atomic<bool> decoded_ready_{false}; std::atomic<bool> decoded_ready_{false};
std::atomic<bool> enabled_{true};
bool bars_cleared_{false}; bool bars_cleared_{false};
char etag_[80]{}; char etag_[80]{};
uint32_t frames_{0}; uint32_t frames_{0};
+1 -4
View File
@@ -1,14 +1,11 @@
# Portainer: Stacks → Add stack → upload this file + Dockerfile/app.py/requirements.txt # Portainer-friendly: no build step. Load/push the image first, then paste this stack.
# (Web editor alone can't build; use Git stack or pre-built image — see notes below.)
services: services:
resizer: resizer:
build: .
image: doorbell-resizer:latest image: doorbell-resizer:latest
container_name: doorbell-resizer container_name: doorbell-resizer
ports: ports:
- "8080:80" - "8080:80"
environment: environment:
# Reachable from the Portainer host (LAN IP or Docker DNS if same compose network)
FRIGATE_URL: http://10.0.1.197:5050/api/doorbell/latest.jpg?h=270 FRIGATE_URL: http://10.0.1.197:5050/api/doorbell/latest.jpg?h=270
TARGET_WIDTH: "480" TARGET_WIDTH: "480"
JPEG_QUALITY: "40" JPEG_QUALITY: "40"
+5 -1
View File
@@ -8,7 +8,7 @@
substitutions: substitutions:
name: doorbell-display name: doorbell-display
friendly_name: Doorbell Display friendly_name: Doorbell Display
image_url: "http://10.0.1.70:8080/" image_url: "http://10.0.1.195:8080/"
external_components: external_components:
- source: - source:
@@ -106,6 +106,10 @@ light:
output: backlight_pwm output: backlight_pwm
restore_mode: ALWAYS_ON restore_mode: ALWAYS_ON
default_transition_length: 0s default_transition_length: 0s
on_turn_on:
- lambda: id(doorbell_jpg).set_enabled(true);
on_turn_off:
- lambda: id(doorbell_jpg).set_enabled(false);
# Simple on/off for Home Assistant automations (light still exposes brightness). # Simple on/off for Home Assistant automations (light still exposes brightness).
switch: switch: