Skip to content
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

Camera Snapshots Based on Printer Activity #27

Open
der-eine opened this issue May 18, 2024 · 10 comments
Open

Camera Snapshots Based on Printer Activity #27

der-eine opened this issue May 18, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@der-eine
Copy link

Hello and thank you for this great project.

I noticed that the camera always takes snapshots as soon as it is turned on. Is it possible to link this to the state of the printer so that pictures are only taken when the printer is actually working? Or have I overlooked a relevant setting?

Best regards,
der-eine

@johnyHV
Copy link
Collaborator

johnyHV commented May 19, 2024

Hello @der-eine . Currently, Prusa Connect does not have an API to allow the camera to determine the state of the printer. So camera continuously sends photos...

But the idea of connecting a printer with a camera is interesting. I will try to analyze this problem and find another solution.

@der-eine
Copy link
Author

@johnyHV
All right. Thanks for the info. I was hoping, since you are working very closely with Prusa, that this would be an option to query the status via the API.

Another question regarding snapshots: will there ever be a direct snapshot URL? To be able to send a snap via Telegram, for example?
I already know the option of „calling http://ip/action_capture and then downloading it from http://ip/saved-photo.jpg.“

@johnyHV
Copy link
Collaborator

johnyHV commented May 20, 2024

@der-eine I will open this topic at the next meeting with people from Prusa. It would be best to have an API from Prusa Connect. I believe that the API for the Prusa Connect about printer status will be added in the near future. It would also be good for them, so that they don't have such a big photo traffic.

You mean sending photo from the camera to telegram ? Prusa Connect have added this feature for printer status. But it is just text message without photo.

@der-eine
Copy link
Author

@johnyHV That's a great idea. I also think that an API would be helpful for many things.

Thanks for the information. Correct, unfortunately, it currently only supports starting, stopping, and error messages. An option to send a photo via Telegram every x percent or at layer X would certainly be useful.

@Anheledir
Copy link
Contributor

Anheledir commented May 27, 2024

Just sharing my thoughts on this feature from an architectural perspective:

  1. Webhooks with Custom Endpoint:

    • Pros: Can start/stop camera updates based on printer activity.
    • Cons: Requires internet access, raises security concerns.
  2. Regular API Calls:

    • Pros: Reduces image traffic.
    • Cons: Impacts server resources due to frequent status checks.
  3. WebRPC Connection:

    • Pros: Offers direct control over the camera.
    • Cons: Requires additional implementation in Prusa Connect.
  4. Serial Connection Control:

    • Pros: Uses existing hardware connections.
    • Cons: Needs hardware/firmware modifications.
  5. Hardware Switch/Sensor:

    • Pros: Automatically triggers camera based on printer movements.
    • Cons: Involves hardware modifications, adds G-code complexity.
  6. Local Image Analysis:

    • Pros: No extra API or hardware required.
    • Cons: Could be unreliable in low light, requires initial setup.

Just a few ideas to consider, feel free to add more :)

@VibroAxe
Copy link

VibroAxe commented Jun 15, 2024

Given the camera is likely on the same network as the printer, it could query the prusalink API running locally on the printer for this instead of going via prusa connect.

The best option I can think of here would be to have different refresh rates based on printer state. So if the printer isn't moving it sends an image once every X minutes, once printing starts it sends every y seconds

@mikromcz
Copy link

Given the camera is likely on the same network as the printer, it could query the prusalink API running locally on the printer for this instead of going via prusa connect.

The best option I can think of here would be to have different refresh rates based on printer state. So if the printer isn't moving it sends an image once every X minutes, once printing starts it sends every y seconds

Connecting to the printer API sounds like a good idea to me. I already did my research and here you can see what is available on the API. (I'm using it for Homepage dashboard) https://github.com/mikromcz/homepage/blob/main/widget_prusalink.yaml
widget_prusalink

@donmaro
Copy link

donmaro commented Jul 17, 2024

I've connected my printer to prusa connect and prusa connect to home assistant. In home assistant i get state changes and i can call API's. Is there an API on the ESP i can call to start and stop the filming / photos?

@johnyHV johnyHV added the enhancement New feature or request label Jul 31, 2024
@JWindy
Copy link

JWindy commented Aug 26, 2024

Hey,
I setup my camera during the last few days and I'm very happy with the result! Thanks for the effort!

Although a trigger through the API would be most convinient, the trigger could also be provided by connection a gpio pin of the microcontroller to a gpio pin of the new hackboard. This might be a workaround until (hopefully) the api is extended by this feature. What do you think?

Windy

@ZevEisenberg
Copy link
Contributor

Just came here to +1 this! I have no SD card in the camera, and I'm not planning to use it for time lapses; just for checking in on the printer. Therefore, I don't need it taking pictures and heating up the components unless I'm actively looking at the feed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants