Code Monkey home page Code Monkey logo

Comments (21)

sibbl avatar sibbl commented on August 23, 2024 3

Hey @lanrat, thanks for your fork and the changes you made there.

Do you see any chance that we can get features into this repository via a PR? Ideally without dropping any features so e.g. users can decide whether to use MQTT or HTTP reporting to Home Assistant?

I can understand that it was easier for you to make a fork and adapt it to your needs. However, I don't think most people will want to build their own docker image and make it available to their devices, as most just run Portainer on Hass.io itself. I think everyone can benefit from this if we can merge the best solutions together.

I'd appreciate if you think this is possible and would love to invest some time in merging pieces of your code. I for myself don't have that much time to develop this project in the next month, but would love to look over code and help testing so I can support this process as good as I can.

Let me know what you think and feel free to create a PR whenever you think it makes sense 😊 thank you!

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024 1

I've fixed this in my fork (as well as lots of other changes) by having the code sleep for a bit and then retry when it can't reach Home Assistant. I've found it greatly helps performance to not have the docker container constantly being restarted just because Home Assistant is down.

https://github.com/lanrat/hass-screenshot

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024 1

Is this fork inline with recent changed in the main code? (battery reporting changes).

I changed all metadata being reported to the server to use HTTP headers instead of query parameters. And I use MQTT Discovery to automatically report the data to Home Assistant.

It also has a better index page with stats/info on the screenshots and devices connected.

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024 1

I have a modified version of that too: https://github.com/lanrat/hass-kindle-screensaver

The readme has not been fully updated yet.

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024 1

Correct. You need to build it yourself. Just run make.

from hass-lovelace-kindle-screensaver.

aptonline avatar aptonline commented on August 23, 2024 1

@sibbl , @lanrat as a user, and someone who has now tried both versions of each project, it would be really great to see a combination of both feature sets in one release but also do understand the time constraints for both of you.

@lanrat would it be possible to enable issue tracking on your repositories as although I have it installed there are a number things that I don’t have working (MQTT discovery for one) and I don’t feel it’s right posting about them here 🤣.

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024 1

@aptonline I just enabled issues. Thanks for letting me know!

from hass-lovelace-kindle-screensaver.

blockarchitech avatar blockarchitech commented on August 23, 2024

If you can, submit the docker log. Also try seeing if your firewall (on the host) accepts both out and inbound traffic on udp and tcp w/ port 8123.

from hass-lovelace-kindle-screensaver.

bictorv avatar bictorv commented on August 23, 2024

That's what it was at the end (output from "docker logs"), or what kind of docker log do you mean?

The firewall etc has absolutely nothing to do with this - it's just that Home Assistant wasn't up and running when h-l-k-s started. When h-l-k-s is restarted everything works fine. What is needed is to catch the exception, sleep, and retry.

from hass-lovelace-kindle-screensaver.

sibbl avatar sibbl commented on August 23, 2024

@bictorv thanks for the report. Seems like I never had this issue as I have the nginx HASS addon running in front of Home Assistant. Perhaps this is a quick workaround as I currently don't have much time to fix this.

If the whole Docker container crashes (and not just some thread inside the Node.js app), then it would also be possible to run the docker container with --restart unless-stopped or add restart: unless-stopped to the docker-compose.yml. But I haven't tried this myself.

from hass-lovelace-kindle-screensaver.

Karli2727 avatar Karli2727 commented on August 23, 2024

Hi there,

I'm having the same issue and tried out several things, I solved it temporarily by doing a scheduled docker restart every hour to prevent freezing if I restart home-assistant for some reason (scheduled or just playing around).

A permanent solution would be really appreciated, either by acutally fixing it the way bictorv suggested or maybe easier by just letting the container crash when that error is thrown so that the docker restart policy can actually detect it and do the reboot that solves the issue. Would you consider that?

from hass-lovelace-kindle-screensaver.

bictorv avatar bictorv commented on August 23, 2024

If you figure out a way to crash the container (in javascript), I could do the coding.

from hass-lovelace-kindle-screensaver.

sibbl avatar sibbl commented on August 23, 2024

Unfortunately I didn't have the time yet to look into the issue for this project.

I assume that we might get a disconnected browser at some point, or can catch timeout exceptions somewhere.
I've already had some experiences with this in another project. I assume the fix for this issue here is kind of similar: https://github.com/sibbl/blinkist-podcast-server/blob/master/src/utils/crawler.mjs#L25-L35

from hass-lovelace-kindle-screensaver.

Karli2727 avatar Karli2727 commented on August 23, 2024

that looks very promising, the error appears at a refused connection so it is safe to assume that you can catch it with this.browser.on("disconnected"

If you put it in the repo I'm happy to test it.

from hass-lovelace-kindle-screensaver.

bictorv avatar bictorv commented on August 23, 2024

I tried, but it seems "disconnected" is not catching this error (but other situations, so it's a good idea). Other suggestions?

Or does anyone know if it's possible to set the node CLI flag --unhandled-rejections=strict as indicated in the error message, through the puppeteer API? It seems it would make a lot of sense, also if its is going to be the default behaviour.

from hass-lovelace-kindle-screensaver.

aptonline avatar aptonline commented on August 23, 2024

I'm seeing a similar issue when I take the home assistant docker container down briefly to update hass-lovelace-kindle-screensaver crashes with the following in the log:

Error: net::ERR_CONNECTION_REFUSED at http://x.x.x.x:8123
stdout
12:14:19
    at navigate (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:155:23)
stdout
12:14:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
stdout
12:14:19
    at async FrameManager.navigateFrame (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:130:21)
stdout
12:14:19
    at async Frame.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:500:16)
stdout
12:14:19
    at async Page.goto (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1167:16)
stdout
12:14:19
    at async /app/index.js:40:3

from hass-lovelace-kindle-screensaver.

bictorv avatar bictorv commented on August 23, 2024

My impression is that the problem is gone: the process crashes and is then restarted. The original error message above said

In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and my guess is that we are now in that future.

Sometimes waiting will solve the problem. ;-)

from hass-lovelace-kindle-screensaver.

aptonline avatar aptonline commented on August 23, 2024

I've fixed this in my fork (as well as lots of other changes) by having the code sleep for a bit and then retry when it can't reach Home Assistant. I've found it greatly helps performance to not have the docker container constantly being restarted just because Home Assistant is down.

https://github.com/lanrat/hass-screenshot

Is this fork inline with recent changed in the main code? (battery reporting changes).

from hass-lovelace-kindle-screensaver.

aptonline avatar aptonline commented on August 23, 2024

Does it rely on the screensaver extension for the battery reporting to work?

from hass-lovelace-kindle-screensaver.

aptonline avatar aptonline commented on August 23, 2024

I've fixed this in my fork (as well as lots of other changes) by having the code sleep for a bit and then retry when it can't reach Home Assistant. I've found it greatly helps performance to not have the docker container constantly being restarted just because Home Assistant is down.

https://github.com/lanrat/hass-screenshot

lanrat/hass-screenshot Image doesn't seem to be available on Docker Hub.

from hass-lovelace-kindle-screensaver.

lanrat avatar lanrat commented on August 23, 2024

Hey @sibbl,

My original intent was to submit a few PRs. However since then, the scope of the changes increased and do contain some breaking changes, so I'm not sure how to proceed. Especially since my fork includes some changes you are not ready to include (ex: #7).

Unfortunately I don't have the time to go through and cherry pick commits to submit as PRs, especially since I also forked https://github.com/lanrat/hass-kindle-screensaver to work with the new changes as well.

If it's easiest for everyone, I can look into adding automated docker builds to my fork.

I'm happy to hear your thoughts on this.

from hass-lovelace-kindle-screensaver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.