HASwitchPlate / openHASP

HomeAutomation Switchplate based on lvgl for ESP32
https://www.openhasp.com
MIT License
695 stars 179 forks source link

SenseCAP D1 Indicator: No Data on http image #766

Closed deepaksrivastav closed 2 months ago

deepaksrivastav commented 2 months ago

I am trying to load an image on my sensecap d1 as follows: {"page":6,"id":2,"obj":"img","x":0, "y":50, "src":"http://192.168.179.139:8000/doorbell.png","w":320, "h":240}

Unfortunately, the screen displays: "No data".

Any ideas ?

Serial logs show the following: Prompt > [11:43:32.566][102388/114764 10][35144/35644 2] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.578][102388/114764 10][35144/35644 2] LVGL: Image draw: src is NULL Prompt > [11:43:32.593][102388/114764 10][35144/35644 2] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.605][102388/114764 10][35144/35644 2] LVGL: Image draw: src is NULL Prompt > [11:43:32.622][102388/114764 10][34964/35636 2] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.634][102388/114764 10][34964/35636 2] LVGL: Image draw: src is NULL Prompt > [11:43:32.649][102388/114764 10][34964/35636 2] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.661][102388/114764 10][34964/35636 2] LVGL: Image draw: src is NULL Prompt > [11:43:32.678][102388/114764 10][34420/35524 4] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.690][102388/114764 10][34420/35524 4] LVGL: Image draw: src is NULL Prompt > [11:43:32.706][102388/114764 10][34420/35524 4] LVGL: lv_img_design: image source type is unknown Prompt > [11:43:32.717][102388/114764 10][34420/35524 4] LVGL: Image draw: src is NULL

Hardware specs:

Device Memory Free Heap 106.06 KiB Free Block 95.98 KiB Fragmentation 9% PSRam Free 7.47 MiB PSRam Size 7.99 MiB

LVGL Memory Total 64.00 KiB Free 35.64 KiB Fragmentation 1%

Model ESP32-S3 rev0 Frequency 240MHz Core Version 4.4.6 Reset Reason CPU0: SW_CPU_RESET / CPU1: SW_CPU_RESET Flash Size 8.00 MiB Program Size Used 1.56 MiB Program Size Free 1.93 MiB Filesystem Size 3.93 MiB Filesystem Used 68.00 KiB Filesystem Free 3.87 MiB

deepaksrivastav commented 2 months ago

I have ensured that content length is set correctly.

$ http http://192.168.179.139:8000/doorbell.png

HTTP/1.0 200 OK Content-Length: 154550 Content-type: image/png Date: Thu, 18 Jul 2024 09:26:22 GMT Last-Modified: Thu, 18 Jul 2024 09:11:41 GMT Server: SimpleHTTP/0.6 Python/3.12.4

EDIT: To ensure that image is correctly encoded, I uploaded the same image onto the device and render it as follows: {"page":6,"id":2,"obj":"img","x":0, "y":50, "src":"L:/doorbell.png", "w":320, "h":240} This works fine. But not the http source.

I am serving the image using a simple python http server: "python3 -m http.server"

deepaksrivastav commented 2 months ago

I found workaround.

The image is loaded when setting the "src" with home assistant.

openhasp:
  sensecap:
    objects:
      - obj: "p6b2"
        properties:
          "src": "http://192.168.179.139:8000/image.png"

The other thing that also worked was to invoke MQTT: Publish from home assistant with the following parameters: Topic: hasp/sensecap/command/jsonl Payload: {"page":6,"id":2,"obj":"img","x":0, "y":50, "src":"http://192.168.179.139:8000/image.png", "auto_size":1, "w":480, "h":380}