Skip to content

Camera entities show corruption most of the time #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cmsj opened this issue Jan 9, 2025 · 9 comments
Open

Camera entities show corruption most of the time #226

cmsj opened this issue Jan 9, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@cmsj
Copy link

cmsj commented Jan 9, 2025

Describe the bug

I have several tags that are used in drawcustom automations and the tags themselves are working great, but the camera preview in Home Assistant is showing corruption instead of the actual image, and if I click on it I see nothing:

Screenshot 2025-01-09 at 15 50 18 Screenshot 2025-01-09 at 15 50 24 Screenshot 2025-01-09 at 15 50 36

Access Point is running firmware 2.75, Home Assistant integration is 1.0

@cmsj cmsj added the bug Something isn't working label Jan 9, 2025
@svenove
Copy link
Contributor

svenove commented Jan 9, 2025

«Known Issues

G5 Encoded Images that are fetched from the AP are not decoded correctly yet»

@jterrace
Copy link
Contributor

I see there's a decode_g5 method checked in but not being used. Is it functional? Is the work involved to detect the encoding of what's returned from the AP?

@g4bri3lDev
Copy link
Member

I see there's a decode_g5 method checked in but not being used. Is it functional?

the decode_g5 method is not working, i tried porting the g5 decoding algorithm from the js/c implementation from the main repo but did not have time to finish it, so it is still on my local machine.

Is the work involved to detect the encoding of what's returned from the AP?

    # Possibly decode G5 data
    if len(data) >= 0 and tag_type.g5_compression and int(tag_type.g5_compression) > 0:
        # Read G5 header
        if len(data) <6:
            print("[decode_esl_raw] Not enough data for G5 header.")
            return None
        header_size = data[0]
        bufw = (data[2] << 8) | data[1]  # little-endian
        bufh = (data[4] << 8) | data[3]
        format_indicator = data[5]
        # Go ahead with decoding g5...

@jterrace
Copy link
Contributor

Ah, thanks, I can try to take a look.

@g4bri3lDev
Copy link
Member

@jterrace
Copy link
Contributor

https://gist.github.com/g4bri3lDev/eede4c28fc0e351edd1d69e1b22a6b98

Is this fully functional or your work in progress?

@g4bri3lDev
Copy link
Member

g4bri3lDev commented Jan 24, 2025

Is this fully functional or your work in progress?

it's still work in progress (not throwing errors anymore)

@jterrace
Copy link
Contributor

Forgot to mention I worked on this over the weekend but was not able to finish: this g5 encoding is tough!

I checkpointed my work here: https://github.com/jterrace/open_epaper_link_homeassistant/tree/g5

  • I took your g5 gist and created a g5 module in the repository.
  • Found and fixed a bug related to mutable byte arrays.
  • Added a sample g5 encoded image along with the expected decoded image.
  • Added a test case using the test images.
  • Converted all the printfs to logging statements

Unfortunately, the decoder is failing on the second line of the image. I ran out of time to work on it if anyone wants to pick up where I left off. Otherwise, I'll get back to it when I have time again, maybe this weekend.

@jterrace
Copy link
Contributor

jterrace commented Mar 2, 2025

Made a little progress today, updated my branch. The decoder was failing because I wasn't stripping out the header. It at least doesn't crash and produces an image now, but the result is garbled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants