Closed goeland86 closed 6 months ago
Hey, I have been looking at this and the Home Assistant camera platform we use (MJPEG) does not seems to support it natively.
I will look to see if there is a workaround, but it won't be a quick fix
Understood, let me know if there's anything I can do to help. If it's easier to modify the Mjpeg add-on to provide the functionality instead, I'll direct my efforts there.
Couple of things: 1) we can get the flip/rotation information easily from moonraker API:
{"result": {"webcam": {"name": "webcam", "location": "printer", "service": "mjpegstreamer-adaptive", "target_fps": "15", "stream_url": "/webcam/?action=stream", "snapshot_url": "/webcam/?action=snapshot", "flip_horizontal": false, "flip_vertical": false, "rotation": 0, "source": "database"}}}
2) We use the MJPEG object from core home assistant and I think we need to extend it. https://github.com/home-assistant/core/blob/609a7ccda85a48e3d14c14f789a66c5445bdd733/homeassistant/components/mjpeg/camera.py#L83
Best way to start for you is to clone this repo, open vscode which should open dev container. That will allow you to test (including modification of core HASS (for testing purposes))
Feel free to join our Slack if you want to chat about it
I haven't read too much about it, but could a solution like in here be integrated into this? Not necessarily depending on card-mod, but re-use a part of it? https://community.home-assistant.io/t/rotate-webcam-feed-mjpeg-in-a-lovelace/164418/14
Would be interested, too
Think a solution via e.g. card-mod would not help with as external services (like e.g. taking a snapshot etc.) would still be upside down. Re-Using the information from moonraker seems to be like the most beneficial information
I need to double check the code, but iirc Moonraker doesn't flip the video feed itself, it just rotates the display of the video in the UI (whether MS or Fluidd), and then whatever tool is taking a snapshot uses the rotation info to rotate the image after the snapshot is captured...
maybe an option would be to rotate directly within webcam.txt / octoprint.txt..
https://community.home-assistant.io/t/rotate-a-camera-image-90-degrees/14539/11?u=mk-maddin
need to test it
Also looks like you can rotate it in lovelace: https://community.home-assistant.io/t/mjpeg-camera-rotation/130299
Anyone ever have success with any of these options? I've not gotten any of them to work to show both the still image and the livestream right side up.
AFAIK, no one is working on fixing this
just use card mod :
card:
type: picture-entity
entity: camera.mkspi_webcam
camera_view: live
show_name: false
show_state: false
card_mod:
style: |
hui-image{
transform: rotate(-180deg);
}
@pinkfloydFR this is fantastic, I will add to the documentation
Thanks that has been one of the annoying one for a long time.
added in the doc.
Hi,
I love the integration, thank you so much for your extension! Lets me manage my printer farm efficiently.
I was just wondering, since on one of my machines the webcam is mounted upside down, what would I need to do to pull the webcam parameters from mainsail regarding rotation or flip of the image?
Or, maybe simpler, adding a property allowing the flip in horizontal or vertical modes just as the mainsail interface allows?
I'm happy to contribute the code needed for it, I'm just short on time to dig through and digest the whole code at the moment, so any pointers to get me started quickly would be great.